@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | $limit_start = 0; |
| 15 | 15 | $limit_end = 25; |
| 16 | 16 | $absolute_difference = 25; |
| 17 | - } else { |
|
| 17 | + } else { |
|
| 18 | 18 | $limit_explode = explode(",", $_GET['limit']); |
| 19 | 19 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
| 20 | 20 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -55,7 +55,9 @@ discard block |
||
| 55 | 55 | $title = sprintf(_("Detailed View for %s (%s)"),$airline_info[0]['name'],$airline_info[0]['icao']); |
| 56 | 56 | } elseif (isset($spotter_array[0]['airline_name']) && isset($spotter_array[0]['airline_icao'])) { |
| 57 | 57 | $title = sprintf(_("Detailed View for %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
| 58 | - } else $title = ''; |
|
| 58 | + } else { |
|
| 59 | + $title = ''; |
|
| 60 | + } |
|
| 59 | 61 | } |
| 60 | 62 | require_once('header.php'); |
| 61 | 63 | |
@@ -76,7 +78,9 @@ discard block |
||
| 76 | 78 | } |
| 77 | 79 | $Stats = new Stats(); |
| 78 | 80 | $airline_names = $Stats->getAllAirlineNames(); |
| 79 | - if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
|
| 81 | + if (empty($airline_names)) { |
|
| 82 | + $airline_names = $Spotter->getAllAirlineNames(); |
|
| 83 | + } |
|
| 80 | 84 | foreach($airline_names as $airline_name) |
| 81 | 85 | { |
| 82 | 86 | if($airline == $airline_name['airline_icao']) |
@@ -108,12 +112,22 @@ discard block |
||
| 108 | 112 | print '<div><span class="label">'._("Name").'</span>'.$airline_info[0]['name'].'</div>'; |
| 109 | 113 | print '<div><span class="label">'._("Country").'</span>'.$airline_info[0]['country'].'</div>'; |
| 110 | 114 | print '<div><span class="label">'._("ICAO").'</span>'.$airline_info[0]['icao'].'</div>'; |
| 111 | - if ($airline_info[0]['iata'] != '') print '<div><span class="label">'._("IATA").'</span>'.$airline_info[0]['iata'].'</div>'; |
|
| 112 | - if ($airline_info[0]['callsign'] != '') print '<div><span class="label">'._("Callsign").'</span>'.$airline_info[0]['callsign'].'</div>'; |
|
| 115 | + if ($airline_info[0]['iata'] != '') { |
|
| 116 | + print '<div><span class="label">'._("IATA").'</span>'.$airline_info[0]['iata'].'</div>'; |
|
| 117 | + } |
|
| 118 | + if ($airline_info[0]['callsign'] != '') { |
|
| 119 | + print '<div><span class="label">'._("Callsign").'</span>'.$airline_info[0]['callsign'].'</div>'; |
|
| 120 | + } |
|
| 113 | 121 | print '<div><span class="label">'._("Type").'</span>'.ucwords($airline_info[0]['type']).'</div>'; |
| 114 | - if (isset($airline_info[0]['home_link']) && $airline_info[0]['home_link'] != '') print '<div><a href="'.$airline_info[0]['home_link'].'"><i class="fa fa-home"></i></a></div>'; |
|
| 115 | - if (isset($airline_info[0]['wikipedia_link']) && $airline_info[0]['wikipedia_link'] != '') print '<div><a href="'.$airline_info[0]['wikipedia_link'].'"><i class="fa fa-wikipedia-w"></i></a></div>'; |
|
| 116 | - if (isset($airline_info[0]['ban_eu']) && $airline_info[0]['ban_eu'] == 1) print '<div><img src="'.$globalURL.'/images/baneu.png" alt="'._("This airline is banned in Europe").'" title="'._("This airline is banned in Europe").'" /></div>'; |
|
| 122 | + if (isset($airline_info[0]['home_link']) && $airline_info[0]['home_link'] != '') { |
|
| 123 | + print '<div><a href="'.$airline_info[0]['home_link'].'"><i class="fa fa-home"></i></a></div>'; |
|
| 124 | + } |
|
| 125 | + if (isset($airline_info[0]['wikipedia_link']) && $airline_info[0]['wikipedia_link'] != '') { |
|
| 126 | + print '<div><a href="'.$airline_info[0]['wikipedia_link'].'"><i class="fa fa-wikipedia-w"></i></a></div>'; |
|
| 127 | + } |
|
| 128 | + if (isset($airline_info[0]['ban_eu']) && $airline_info[0]['ban_eu'] == 1) { |
|
| 129 | + print '<div><img src="'.$globalURL.'/images/baneu.png" alt="'._("This airline is banned in Europe").'" title="'._("This airline is banned in Europe").'" /></div>'; |
|
| 130 | + } |
|
| 117 | 131 | print '</div>'; |
| 118 | 132 | |
| 119 | 133 | } else { |
@@ -129,10 +143,16 @@ discard block |
||
| 129 | 143 | print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['airline_name'].'</div>'; |
| 130 | 144 | print '<div><span class="label">'._("Country").'</span>'.$spotter_array[0]['airline_country'].'</div>'; |
| 131 | 145 | print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['airline_icao'].'</div>'; |
| 132 | - if (isset($spotter_array[0]['airline_iata']) && $spotter_array[0]['airline_iata'] != '') print '<div><span class="label">'._("IATA").'</span>'.$spotter_array[0]['airline_iata'].'</div>'; |
|
| 133 | - if (isset($spotter_array[0]['airline_callsign']) && $spotter_array[0]['airline_callsign'] != '') print '<div><span class="label">'._("Callsign").'</span>'.$spotter_array[0]['airline_callsign'].'</div>'; |
|
| 146 | + if (isset($spotter_array[0]['airline_iata']) && $spotter_array[0]['airline_iata'] != '') { |
|
| 147 | + print '<div><span class="label">'._("IATA").'</span>'.$spotter_array[0]['airline_iata'].'</div>'; |
|
| 148 | + } |
|
| 149 | + if (isset($spotter_array[0]['airline_callsign']) && $spotter_array[0]['airline_callsign'] != '') { |
|
| 150 | + print '<div><span class="label">'._("Callsign").'</span>'.$spotter_array[0]['airline_callsign'].'</div>'; |
|
| 151 | + } |
|
| 134 | 152 | print '<div><span class="label">'._("Type").'</span>'.ucwords($spotter_array[0]['airline_type']).'</div>'; |
| 135 | - if (isset($spotter_array[0]['ban_eu']) && $spotter_array[0]['ban_eu'] == 1) print '<div><img src="'.$globalURL.'/images/baneu.png" alt="'._("This airline is banned in Europe").'" title="'._("This airline is banned in Europe").'" /></div>'; |
|
| 153 | + if (isset($spotter_array[0]['ban_eu']) && $spotter_array[0]['ban_eu'] == 1) { |
|
| 154 | + print '<div><img src="'.$globalURL.'/images/baneu.png" alt="'._("This airline is banned in Europe").'" title="'._("This airline is banned in Europe").'" /></div>'; |
|
| 155 | + } |
|
| 136 | 156 | print '</div>'; |
| 137 | 157 | } |
| 138 | 158 | } else { |
@@ -4,20 +4,20 @@ discard block |
||
| 4 | 4 | require_once('require/class.Stats.php'); |
| 5 | 5 | require_once('require/class.Language.php'); |
| 6 | 6 | |
| 7 | -if (!isset($_GET['airline'])){ |
|
| 7 | +if (!isset($_GET['airline'])) { |
|
| 8 | 8 | header('Location: '.$globalURL.'/airline'); |
| 9 | -} else{ |
|
| 9 | +} else { |
|
| 10 | 10 | $Spotter = new Spotter(); |
| 11 | 11 | //calculuation for the pagination |
| 12 | - if(!isset($_GET['limit']) || $_GET['limit'] == "") |
|
| 12 | + if (!isset($_GET['limit']) || $_GET['limit'] == "") |
|
| 13 | 13 | { |
| 14 | 14 | $limit_start = 0; |
| 15 | 15 | $limit_end = 25; |
| 16 | 16 | $absolute_difference = 25; |
| 17 | - } else { |
|
| 17 | + } else { |
|
| 18 | 18 | $limit_explode = explode(",", $_GET['limit']); |
| 19 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 20 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 19 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 20 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 21 | 21 | if (!ctype_digit(strval($limit_start)) || !ctype_digit(strval($limit_end))) { |
| 22 | 22 | $limit_start = 0; |
| 23 | 23 | $limit_end = 25; |
@@ -28,20 +28,20 @@ discard block |
||
| 28 | 28 | $limit_previous_1 = $limit_start - $absolute_difference; |
| 29 | 29 | $limit_previous_2 = $limit_end - $absolute_difference; |
| 30 | 30 | |
| 31 | - $airline = urldecode(filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING)); |
|
| 31 | + $airline = urldecode(filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING)); |
|
| 32 | 32 | $page_url = $globalURL.'/airline/'.$airline; |
| 33 | 33 | $alliance = false; |
| 34 | - $sort = filter_input(INPUT_GET,'sort',FILTER_SANITIZE_STRING); |
|
| 34 | + $sort = filter_input(INPUT_GET, 'sort', FILTER_SANITIZE_STRING); |
|
| 35 | 35 | $airline_info = array(); |
| 36 | - if (strpos($airline,'alliance_') !== FALSE) { |
|
| 37 | - $spotter_array = $Spotter->getSpotterDataByAirline('',$limit_start.",".$absolute_difference, $sort,array('alliance' => str_replace('_',' ',str_replace('alliance_','',$airline)))); |
|
| 36 | + if (strpos($airline, 'alliance_') !== FALSE) { |
|
| 37 | + $spotter_array = $Spotter->getSpotterDataByAirline('', $limit_start.",".$absolute_difference, $sort, array('alliance' => str_replace('_', ' ', str_replace('alliance_', '', $airline)))); |
|
| 38 | 38 | $alliance = true; |
| 39 | 39 | } else { |
| 40 | - $spotter_array = $Spotter->getSpotterDataByAirline($airline,$limit_start.",".$absolute_difference, $sort); |
|
| 40 | + $spotter_array = $Spotter->getSpotterDataByAirline($airline, $limit_start.",".$absolute_difference, $sort); |
|
| 41 | 41 | if (isset($globalIVAO)) { |
| 42 | - $airline_info = $Spotter->getAllAirlineInfo($airline,'ivao'); |
|
| 42 | + $airline_info = $Spotter->getAllAirlineInfo($airline, 'ivao'); |
|
| 43 | 43 | } elseif (isset($globalVATSIM)) { |
| 44 | - $airline_info = $Spotter->getAllAirlineInfo($airline,'vatsim'); |
|
| 44 | + $airline_info = $Spotter->getAllAirlineInfo($airline, 'vatsim'); |
|
| 45 | 45 | } else { |
| 46 | 46 | $airline_info = $Spotter->getAllAirlineInfo($airline); |
| 47 | 47 | } |
@@ -49,12 +49,12 @@ discard block |
||
| 49 | 49 | if (!empty($spotter_array) || !empty($airline_info)) |
| 50 | 50 | { |
| 51 | 51 | if ($alliance) { |
| 52 | - $title = sprintf(_("Detailed View for %s"),str_replace('_',' ',str_replace('alliance_','',$airline))); |
|
| 52 | + $title = sprintf(_("Detailed View for %s"), str_replace('_', ' ', str_replace('alliance_', '', $airline))); |
|
| 53 | 53 | } else { |
| 54 | 54 | if (isset($airline_info[0]['name']) && isset($airline_info[0]['icao'])) { |
| 55 | - $title = sprintf(_("Detailed View for %s (%s)"),$airline_info[0]['name'],$airline_info[0]['icao']); |
|
| 55 | + $title = sprintf(_("Detailed View for %s (%s)"), $airline_info[0]['name'], $airline_info[0]['icao']); |
|
| 56 | 56 | } elseif (isset($spotter_array[0]['airline_name']) && isset($spotter_array[0]['airline_icao'])) { |
| 57 | - $title = sprintf(_("Detailed View for %s (%s)"),$spotter_array[0]['airline_name'],$spotter_array[0]['airline_icao']); |
|
| 57 | + $title = sprintf(_("Detailed View for %s (%s)"), $spotter_array[0]['airline_name'], $spotter_array[0]['airline_icao']); |
|
| 58 | 58 | } else $title = ''; |
| 59 | 59 | } |
| 60 | 60 | require_once('header.php'); |
@@ -66,10 +66,10 @@ discard block |
||
| 66 | 66 | $alliances = $Spotter->getAllAllianceNames(); |
| 67 | 67 | if (!empty($alliances)) { |
| 68 | 68 | foreach ($alliances as $al) { |
| 69 | - if ($alliance && str_replace('_',' ',str_replace('alliance_','',$airline)) == $al['alliance']) { |
|
| 70 | - print '<option value="alliance_'.str_replace(' ','_',$al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
| 69 | + if ($alliance && str_replace('_', ' ', str_replace('alliance_', '', $airline)) == $al['alliance']) { |
|
| 70 | + print '<option value="alliance_'.str_replace(' ', '_', $al['alliance']).'" selected>'.$al['alliance'].'</option>'; |
|
| 71 | 71 | } else { |
| 72 | - print '<option value="alliance_'.str_replace(' ','_',$al['alliance']).'">'.$al['alliance'].'</option>'; |
|
| 72 | + print '<option value="alliance_'.str_replace(' ', '_', $al['alliance']).'">'.$al['alliance'].'</option>'; |
|
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | print '<option disabled>───────────────</option>'; |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | $Stats = new Stats(); |
| 78 | 78 | $airline_names = $Stats->getAllAirlineNames(); |
| 79 | 79 | if (empty($airline_names)) $airline_names = $Spotter->getAllAirlineNames(); |
| 80 | - foreach($airline_names as $airline_name) |
|
| 80 | + foreach ($airline_names as $airline_name) |
|
| 81 | 81 | { |
| 82 | - if($airline == $airline_name['airline_icao']) |
|
| 82 | + if ($airline == $airline_name['airline_icao']) |
|
| 83 | 83 | { |
| 84 | 84 | print '<option value="'.$airline_name['airline_icao'].'" selected="selected">'.$airline_name['airline_name'].' ('.$airline_name['airline_icao'].')</option>'; |
| 85 | 85 | } else { |
@@ -137,12 +137,12 @@ discard block |
||
| 137 | 137 | } |
| 138 | 138 | } else { |
| 139 | 139 | print '<div class="info column">'; |
| 140 | - print '<h1>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</h1>'; |
|
| 141 | - if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_','',$airline).'.png')) |
|
| 140 | + print '<h1>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</h1>'; |
|
| 141 | + if (@getimagesize($globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png') || @getimagesize('images/airlines/'.str_replace('alliance_', '', $airline).'.png')) |
|
| 142 | 142 | { |
| 143 | - print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_','',$airline).'.png" alt="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" title="'.str_replace('_',' ',str_replace('alliance_','',$airline)).'" class="logo" />'; |
|
| 143 | + print '<img src="'.$globalURL.'/images/airlines/'.str_replace('alliance_', '', $airline).'.png" alt="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" title="'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'" class="logo" />'; |
|
| 144 | 144 | } |
| 145 | - print '<div><span class="label">'._("Name").'</span>'.str_replace('_',' ',str_replace('alliance_','',$airline)).'</div>'; |
|
| 145 | + print '<div><span class="label">'._("Name").'</span>'.str_replace('_', ' ', str_replace('alliance_', '', $airline)).'</div>'; |
|
| 146 | 146 | print '</div>'; |
| 147 | 147 | } |
| 148 | 148 | } else { |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | include('airline-sub-menu.php'); |
| 154 | 154 | print '<div class="table column">'; |
| 155 | 155 | if (isset($spotter_array[0]['airline_name']) && $alliance === false) { |
| 156 | - print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."),$spotter_array[0]['airline_name']).'</p>'; |
|
| 156 | + print '<p>'.sprintf(_("The table below shows the detailed information of all flights from <strong>%s</strong>."), $spotter_array[0]['airline_name']).'</p>'; |
|
| 157 | 157 | } |
| 158 | 158 | include('table-output.php'); |
| 159 | 159 | print '<div class="pagination">'; |
@@ -365,7 +365,7 @@ discard block |
||
| 365 | 365 | } |
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | - if ($type == 'aircraft') { |
|
| 368 | + if ($type == 'aircraft') { |
|
| 369 | 369 | if ((isset($globalUsePilot) && $globalUsePilot) || (!isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalVAM) && $globalVAM) || (isset($globalphpVMS) && $globalphpVMS)))) { |
| 370 | 370 | print '<th class="pilot"><span class="nomobile">'._("Pilot name").'</span><span class="mobile">'._("Pilot").'</span></a></th>'; |
| 371 | 371 | } |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | } elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){ |
| 724 | 724 | if ($type == 'aircraft') { |
| 725 | 725 | if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) { |
| 726 | - $spotter_item['squawk'] = '-'; |
|
| 726 | + $spotter_item['squawk'] = '-'; |
|
| 727 | 727 | } |
| 728 | 728 | if ($spotter_item['image_thumbnail'] != "") |
| 729 | 729 | { |
@@ -762,7 +762,7 @@ discard block |
||
| 762 | 762 | print '</td>'."\n"; |
| 763 | 763 | } else { |
| 764 | 764 | print '<td class="aircraft_thumbnail">'."\n"; |
| 765 | - // print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>'; |
|
| 765 | + // print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>'; |
|
| 766 | 766 | //} |
| 767 | 767 | if (!isset($spotter_item['airline_name']) && !isset($spotter_item['aircraft_name'])) { |
| 768 | 768 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '._("Not available").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n"; |
@@ -1034,11 +1034,11 @@ discard block |
||
| 1034 | 1034 | if (!isset($Spotter)) $Spotter = new Spotter(); |
| 1035 | 1035 | $arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['real_arrival_airport']); |
| 1036 | 1036 | if (isset($arrival_airport_info[0])) { |
| 1037 | - print '<br /><span class="nomobile">' . _("Real:") . ' <a href="' . $globalURL . '/airport/' . $spotter_item['real_arrival_airport'] . '">' . $arrival_airport_info[0]['city'] . ',' . $arrival_airport_info[0]['country'] . ' (' . $spotter_item['real_arrival_airport'] . ')</a></span>' . "\n"; |
|
| 1038 | - } |
|
| 1039 | - print '<span class="mobile">'._("Scheduled:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n"; |
|
| 1040 | - if (isset($arrival_airport_info[0])) { |
|
| 1041 | - print '<span class="mobile">'._("Real:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$arrival_airport_info[0]['city'].','.$arrival_airport_info[0]['country'].' ('.$spotter_item['real_arrival_airport'].')</a></span>'."\n"; |
|
| 1037 | + print '<br /><span class="nomobile">' . _("Real:") . ' <a href="' . $globalURL . '/airport/' . $spotter_item['real_arrival_airport'] . '">' . $arrival_airport_info[0]['city'] . ',' . $arrival_airport_info[0]['country'] . ' (' . $spotter_item['real_arrival_airport'] . ')</a></span>' . "\n"; |
|
| 1038 | + } |
|
| 1039 | + print '<span class="mobile">'._("Scheduled:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n"; |
|
| 1040 | + if (isset($arrival_airport_info[0])) { |
|
| 1041 | + print '<span class="mobile">'._("Real:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$arrival_airport_info[0]['city'].','.$arrival_airport_info[0]['country'].' ('.$spotter_item['real_arrival_airport'].')</a></span>'."\n"; |
|
| 1042 | 1042 | } |
| 1043 | 1043 | } elseif ($spotter_item['arrival_airport'] != 'NA') { |
| 1044 | 1044 | print '<span class="nomobile"><a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].')</a></span>'."\n"; |
@@ -4,15 +4,15 @@ discard block |
||
| 4 | 4 | |
| 5 | 5 | require_once(dirname(__FILE__).'/require/class.Common.php'); |
| 6 | 6 | $Common = new Common(); |
| 7 | -$showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop'); |
|
| 7 | +$showRouteStop = $Common->multiKeyExists($spotter_array, 'route_stop'); |
|
| 8 | 8 | if (isset($globalVM) && $globalVM && isset($type) && $type == 'marine') { |
| 9 | - $showDuration = $Common->multiKeyExists($spotter_array,'race_time'); |
|
| 10 | - if ($showDuration === false) $showDuration = $Common->multiKeyExists($spotter_array,'duration'); |
|
| 9 | + $showDuration = $Common->multiKeyExists($spotter_array, 'race_time'); |
|
| 10 | + if ($showDuration === false) $showDuration = $Common->multiKeyExists($spotter_array, 'duration'); |
|
| 11 | 11 | } else { |
| 12 | - $showDuration = $Common->multiKeyExists($spotter_array,'duration'); |
|
| 12 | + $showDuration = $Common->multiKeyExists($spotter_array, 'duration'); |
|
| 13 | 13 | } |
| 14 | 14 | if (isset($globalVM) && $globalVM && isset($type) && $type == 'marine') { |
| 15 | - $showDistance = $Common->multiKeyExists($spotter_array,'distance'); |
|
| 15 | + $showDistance = $Common->multiKeyExists($spotter_array, 'distance'); |
|
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | } |
| 179 | 179 | print '<th class="more"></th>'; |
| 180 | 180 | print '</thead>'; |
| 181 | -} else if (strtolower($current_page) == "upcoming"){ |
|
| 181 | +} else if (strtolower($current_page) == "upcoming") { |
|
| 182 | 182 | print '<thead>'; |
| 183 | 183 | if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
| 184 | 184 | if ($_GET['sort'] == "airline_name_asc") |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | */ |
| 234 | 234 | print '</thead>'; |
| 235 | -} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive"){ |
|
| 235 | +} else if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
|
| 236 | 236 | print '<thead>'; |
| 237 | 237 | print '<th class="aircraft_thumbnail"></th>'; |
| 238 | 238 | print '<th class="logo">'._("Airline").'</th>'; |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | print '</thead>'; |
| 270 | 270 | } else { |
| 271 | 271 | |
| 272 | - if ($hide_th_links === true){ |
|
| 272 | + if ($hide_th_links === true) { |
|
| 273 | 273 | print '<thead>'; |
| 274 | 274 | if ($type == 'marine' && isset($globalVM) && $globalVM) { |
| 275 | 275 | print '<th class="rank">'._("Rank").'</th>'; |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | print '<tbody>'."\n"; |
| 590 | -foreach($spotter_array as $spotter_item) |
|
| 590 | +foreach ($spotter_array as $spotter_item) |
|
| 591 | 591 | { |
| 592 | 592 | if (isset($globalTimezone)) |
| 593 | 593 | { |
@@ -622,13 +622,13 @@ discard block |
||
| 622 | 622 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
| 623 | 623 | } |
| 624 | 624 | if (isset($spotter_item['airline_name'])) { |
| 625 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 625 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 626 | 626 | } else { |
| 627 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 627 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '._("Not available").'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 628 | 628 | } |
| 629 | 629 | } else { |
| 630 | 630 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 631 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 631 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 632 | 632 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 633 | 633 | if (isset($spotter_item['airline_name'])) { |
| 634 | 634 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | { |
| 655 | 655 | print '<td class="aircraft_thumbnail">'."\n"; |
| 656 | 656 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 657 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 657 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 658 | 658 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 659 | 659 | if (isset($spotter_item['mmsi']) && $spotter_item['mmsi'] != '') { |
| 660 | 660 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | { |
| 677 | 677 | print '<td class="aircraft_thumbnail">'."\n"; |
| 678 | 678 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 679 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 679 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 680 | 680 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 681 | 681 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 682 | 682 | print '</td>'."\n"; |
@@ -720,7 +720,7 @@ discard block |
||
| 720 | 720 | print '</td>'."\n"; |
| 721 | 721 | } |
| 722 | 722 | } |
| 723 | - } elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){ |
|
| 723 | + } elseif (strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed") { |
|
| 724 | 724 | if ($type == 'aircraft') { |
| 725 | 725 | if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) { |
| 726 | 726 | $spotter_item['squawk'] = '-'; |
@@ -737,17 +737,17 @@ discard block |
||
| 737 | 737 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
| 738 | 738 | } |
| 739 | 739 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
| 740 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 740 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 741 | 741 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
| 742 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 742 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 743 | 743 | } elseif (!isset($spotter_item['aircraft_name']) && !isset($spotter_item['airline_name'])) { |
| 744 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 744 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 745 | 745 | } else { |
| 746 | - print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 746 | + print '<a href="'.$image_src.'"><img src="'.preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']).'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '.$spotter_item['airline_name'].'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 747 | 747 | } |
| 748 | 748 | } else { |
| 749 | 749 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 750 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 750 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 751 | 751 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 752 | 752 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
| 753 | 753 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | { |
| 788 | 788 | print '<td class="aircraft_thumbnail">'."\n"; |
| 789 | 789 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 790 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 790 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 791 | 791 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 792 | 792 | if (isset($spotter_item['mmsi']) && $spotter_item['mmsi'] != '') { |
| 793 | 793 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n"; |
@@ -811,7 +811,7 @@ discard block |
||
| 811 | 811 | { |
| 812 | 812 | print '<td class="aircraft_thumbnail">'."\n"; |
| 813 | 813 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 814 | - $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
|
| 814 | + $image_thumbnail = preg_replace("/^http:/i", "https:", $spotter_item['image_thumbnail']); |
|
| 815 | 815 | } else $image_thumbnail = $spotter_item['image_thumbnail']; |
| 816 | 816 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 817 | 817 | print '</td>'."\n"; |
@@ -920,7 +920,7 @@ discard block |
||
| 920 | 920 | print '</td>'."\n"; |
| 921 | 921 | } |
| 922 | 922 | // Aircraft type |
| 923 | - if(strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive"){ |
|
| 923 | + if (strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive") { |
|
| 924 | 924 | print '<td class="type">'."\n"; |
| 925 | 925 | if ($type == 'aircraft') { |
| 926 | 926 | if (!isset($spotter_item['aircraft_type']) && isset($spotter_item['aircraft_name'])) { |
@@ -929,7 +929,7 @@ discard block |
||
| 929 | 929 | //print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'._("Not available").'</a></span>'."\n"; |
| 930 | 930 | print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a></span>'."\n"; |
| 931 | 931 | } else { |
| 932 | - $aircraft_names = explode('/',$spotter_item['aircraft_name']); |
|
| 932 | + $aircraft_names = explode('/', $spotter_item['aircraft_name']); |
|
| 933 | 933 | if (count($aircraft_names) == 1) print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</a></span>'."\n"; |
| 934 | 934 | else print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].'</a></span>'."\n"; |
| 935 | 935 | } |
@@ -973,22 +973,22 @@ discard block |
||
| 973 | 973 | } |
| 974 | 974 | if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) { |
| 975 | 975 | if ($spotter_item['departure_airport_time'] > 2460) { |
| 976 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
| 977 | - } else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 976 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
| 977 | + } else $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
| 978 | 978 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 979 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
| 979 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
| 980 | 980 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
| 981 | 981 | print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n"; |
| 982 | 982 | } elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') { |
| 983 | 983 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 984 | - $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
|
| 984 | + $real_departure_airport_time = date('H:m', $spotter_item['real_departure_airport_time']); |
|
| 985 | 985 | } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
| 986 | 986 | print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n"; |
| 987 | 987 | } elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
| 988 | 988 | if ($spotter_item['departure_airport_time'] > 2460) { |
| 989 | - $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
|
| 989 | + $departure_airport_time = date('H:m', $spotter_item['departure_airport_time']); |
|
| 990 | 990 | } else { |
| 991 | - $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 991 | + $departure_airport_time = substr($spotter_item['departure_airport_time'], 0, -2).':'.substr($spotter_item['departure_airport_time'], -2); |
|
| 992 | 992 | } |
| 993 | 993 | print '<br /><span class="airport_time">'.$departure_airport_time.'</span>'."\n"; |
| 994 | 994 | } |
@@ -1003,7 +1003,7 @@ discard block |
||
| 1003 | 1003 | $latitude = $spotter_item['latitude']; |
| 1004 | 1004 | $longitude = $spotter_item['longitude']; |
| 1005 | 1005 | } |
| 1006 | - $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude); |
|
| 1006 | + $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'], $latitude, $longitude); |
|
| 1007 | 1007 | } else $distance = ''; |
| 1008 | 1008 | if ($distance != '') { |
| 1009 | 1009 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -1034,7 +1034,7 @@ discard block |
||
| 1034 | 1034 | if (!isset($Spotter)) $Spotter = new Spotter(); |
| 1035 | 1035 | $arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['real_arrival_airport']); |
| 1036 | 1036 | if (isset($arrival_airport_info[0])) { |
| 1037 | - print '<br /><span class="nomobile">' . _("Real:") . ' <a href="' . $globalURL . '/airport/' . $spotter_item['real_arrival_airport'] . '">' . $arrival_airport_info[0]['city'] . ',' . $arrival_airport_info[0]['country'] . ' (' . $spotter_item['real_arrival_airport'] . ')</a></span>' . "\n"; |
|
| 1037 | + print '<br /><span class="nomobile">'._("Real:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$arrival_airport_info[0]['city'].','.$arrival_airport_info[0]['country'].' ('.$spotter_item['real_arrival_airport'].')</a></span>'."\n"; |
|
| 1038 | 1038 | } |
| 1039 | 1039 | print '<span class="mobile">'._("Scheduled:").' <a href="'.$globalURL.'/airport/'.$spotter_item['real_arrival_airport'].'">'.$spotter_item['real_arrival_airport'].'</a></span>'."\n"; |
| 1040 | 1040 | if (isset($arrival_airport_info[0])) { |
@@ -1050,20 +1050,20 @@ discard block |
||
| 1050 | 1050 | } |
| 1051 | 1051 | if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) { |
| 1052 | 1052 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 1053 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
| 1053 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
| 1054 | 1054 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
| 1055 | 1055 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 1056 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
| 1056 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
| 1057 | 1057 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
| 1058 | 1058 | print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n"; |
| 1059 | 1059 | } elseif (isset($spotter_item['real_arrival_airport_time'])) { |
| 1060 | 1060 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 1061 | - $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
|
| 1061 | + $real_arrival_airport_time = date('H:m', $spotter_item['real_arrival_airport_time']); |
|
| 1062 | 1062 | } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
| 1063 | 1063 | print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n"; |
| 1064 | 1064 | } elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
| 1065 | 1065 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 1066 | - $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
|
| 1066 | + $arrival_airport_time = date('H:m', $spotter_item['arrival_airport_time']); |
|
| 1067 | 1067 | } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
| 1068 | 1068 | print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n"; |
| 1069 | 1069 | } |
@@ -1076,7 +1076,7 @@ discard block |
||
| 1076 | 1076 | $latitude = $spotter_item['latitude']; |
| 1077 | 1077 | $longitude = $spotter_item['longitude']; |
| 1078 | 1078 | } |
| 1079 | - $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude); |
|
| 1079 | + $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'], $latitude, $longitude); |
|
| 1080 | 1080 | } else $distance = ''; |
| 1081 | 1081 | if ($distance != '') { |
| 1082 | 1082 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
@@ -1138,19 +1138,19 @@ discard block |
||
| 1138 | 1138 | print '<span class="mobile">-</span>'."\n"; |
| 1139 | 1139 | } else { |
| 1140 | 1140 | if ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
| 1141 | - print '<span class="nomobile">'.round($spotter_item['distance'],2).' km</span>'."\n"; |
|
| 1142 | - print '<span class="mobile">'.round($spotter_item['distance'],2).' km</span><br />'."\n"; |
|
| 1141 | + print '<span class="nomobile">'.round($spotter_item['distance'], 2).' km</span>'."\n"; |
|
| 1142 | + print '<span class="mobile">'.round($spotter_item['distance'], 2).' km</span><br />'."\n"; |
|
| 1143 | 1143 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
| 1144 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.621371,2).' mi</span>'."\n"; |
|
| 1145 | - print '<span class="mobile">'.round($spotter_item['distance']*0.621371,2).' mi</span><br />'."\n"; |
|
| 1144 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span>'."\n"; |
|
| 1145 | + print '<span class="mobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span><br />'."\n"; |
|
| 1146 | 1146 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
| 1147 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.539957,2).' nm</span>'."\n"; |
|
| 1148 | - print '<span class="mobile">'.round($spotter_item['distance']*0.539957,2).' nm</span><br />'."\n"; |
|
| 1147 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span>'."\n"; |
|
| 1148 | + print '<span class="mobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span><br />'."\n"; |
|
| 1149 | 1149 | } |
| 1150 | 1150 | } |
| 1151 | 1151 | print '</td>'."\n"; |
| 1152 | 1152 | } |
| 1153 | - if(strtolower($current_page) != "upcoming"){ |
|
| 1153 | + if (strtolower($current_page) != "upcoming") { |
|
| 1154 | 1154 | if ($type == 'aircraft') { |
| 1155 | 1155 | //if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS)) { |
| 1156 | 1156 | if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
@@ -1195,14 +1195,14 @@ discard block |
||
| 1195 | 1195 | if (isset($spotter_item['distance'])) { |
| 1196 | 1196 | print '<td class="distance">'; |
| 1197 | 1197 | if ((!isset($_COOKIE['unitdistance']) && ((isset($globalUnitDistance) && $globalUnitDistance == 'km') || !isset($globalUnitDistance))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
| 1198 | - print '<span class="nomobile">'.round($spotter_item['distance'],2).' km</span>'."\n"; |
|
| 1199 | - print '<span class="mobile">'.round($spotter_item['distance'],2).' km</span><br />'."\n"; |
|
| 1198 | + print '<span class="nomobile">'.round($spotter_item['distance'], 2).' km</span>'."\n"; |
|
| 1199 | + print '<span class="mobile">'.round($spotter_item['distance'], 2).' km</span><br />'."\n"; |
|
| 1200 | 1200 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
| 1201 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.621371,2).' mi</span>'."\n"; |
|
| 1202 | - print '<span class="mobile">'.round($spotter_item['distance']*0.621371,2).' mi</span><br />'."\n"; |
|
| 1201 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span>'."\n"; |
|
| 1202 | + print '<span class="mobile">'.round($spotter_item['distance']*0.621371, 2).' mi</span><br />'."\n"; |
|
| 1203 | 1203 | } elseif ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
| 1204 | - print '<span class="nomobile">'.round($spotter_item['distance']*0.539957,2).' nm</span>'."\n"; |
|
| 1205 | - print '<span class="mobile">'.round($spotter_item['distance']*0.539957,2).' nm</span><br />'."\n"; |
|
| 1204 | + print '<span class="nomobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span>'."\n"; |
|
| 1205 | + print '<span class="mobile">'.round($spotter_item['distance']*0.539957, 2).' nm</span><br />'."\n"; |
|
| 1206 | 1206 | } |
| 1207 | 1207 | print '</td>'."\n"; |
| 1208 | 1208 | } else { |
@@ -1233,7 +1233,7 @@ discard block |
||
| 1233 | 1233 | |
| 1234 | 1234 | if ($showRouteStop) { |
| 1235 | 1235 | // Route stop |
| 1236 | - if(strtolower($current_page) != "upcoming"){ |
|
| 1236 | + if (strtolower($current_page) != "upcoming") { |
|
| 1237 | 1237 | print '<td class="route_stop">'."\n"; |
| 1238 | 1238 | if (!isset($spotter_item['route_stop']) || $spotter_item['route_stop'] == '' || $spotter_item['route_stop'] == 'NULL') { |
| 1239 | 1239 | print '<span class="nomobile">-</span>'."\n"; |
@@ -1256,19 +1256,19 @@ discard block |
||
| 1256 | 1256 | print '<td class="duration">'."\n"; |
| 1257 | 1257 | if (isset($spotter_item['race_time'])) { |
| 1258 | 1258 | if ($spotter_item['race_time'] > 86400) { |
| 1259 | - print '<span class="nomobile">'.gmdate("z\d. H\h. i\m. s\s.",$spotter_item['race_time']).'</span>'."\n"; |
|
| 1260 | - print '<span class="mobile">'.gmdate("z\d. H\h. i\m. s\s.",$spotter_item['race_time']).'</span>'."\n"; |
|
| 1259 | + print '<span class="nomobile">'.gmdate("z\d. H\h. i\m. s\s.", $spotter_item['race_time']).'</span>'."\n"; |
|
| 1260 | + print '<span class="mobile">'.gmdate("z\d. H\h. i\m. s\s.", $spotter_item['race_time']).'</span>'."\n"; |
|
| 1261 | 1261 | } else { |
| 1262 | - print '<span class="nomobile">'.gmdate("H\h. i\m. s\s.",$spotter_item['race_time']).'</span>'."\n"; |
|
| 1263 | - print '<span class="mobile">'.gmdate("H\h. i\m. s\s.",$spotter_item['race_time']).'</span>'."\n"; |
|
| 1262 | + print '<span class="nomobile">'.gmdate("H\h. i\m. s\s.", $spotter_item['race_time']).'</span>'."\n"; |
|
| 1263 | + print '<span class="mobile">'.gmdate("H\h. i\m. s\s.", $spotter_item['race_time']).'</span>'."\n"; |
|
| 1264 | 1264 | } |
| 1265 | 1265 | } elseif (isset($spotter_item['duration'])) { |
| 1266 | 1266 | if ($spotter_item['duration'] > 86400) { |
| 1267 | - print '<span class="nomobile">'.gmdate('z\d. H\h. i\m. s\s.',$spotter_item['duration']).'</span>'."\n"; |
|
| 1268 | - print '<span class="mobile">'.gmdate('z\d. H\h. i\m. s\s.',$spotter_item['duration']).'</span>'."\n"; |
|
| 1267 | + print '<span class="nomobile">'.gmdate('z\d. H\h. i\m. s\s.', $spotter_item['duration']).'</span>'."\n"; |
|
| 1268 | + print '<span class="mobile">'.gmdate('z\d. H\h. i\m. s\s.', $spotter_item['duration']).'</span>'."\n"; |
|
| 1269 | 1269 | } else { |
| 1270 | - print '<span class="nomobile">'.gmdate('H\h. i\m. s\s.',$spotter_item['duration']).'</span>'."\n"; |
|
| 1271 | - print '<span class="mobile">'.gmdate('H\h. i\m. s\s.',$spotter_item['duration']).'</span>'."\n"; |
|
| 1270 | + print '<span class="nomobile">'.gmdate('H\h. i\m. s\s.', $spotter_item['duration']).'</span>'."\n"; |
|
| 1271 | + print '<span class="mobile">'.gmdate('H\h. i\m. s\s.', $spotter_item['duration']).'</span>'."\n"; |
|
| 1272 | 1272 | } |
| 1273 | 1273 | } else { |
| 1274 | 1274 | print '<span class="nomobile">-</span>'."\n"; |
@@ -1276,11 +1276,11 @@ discard block |
||
| 1276 | 1276 | } |
| 1277 | 1277 | print '</td>'."\n"; |
| 1278 | 1278 | } else { |
| 1279 | - if(strtolower($current_page) != "upcoming"){ |
|
| 1279 | + if (strtolower($current_page) != "upcoming") { |
|
| 1280 | 1280 | print '<td class="duration">'."\n"; |
| 1281 | 1281 | if (isset($spotter_item['duration'])) { |
| 1282 | - print '<span class="nomobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n"; |
|
| 1283 | - print '<span class="mobile">'.gmdate('H:i:s',$spotter_item['duration']).'</span>'."\n"; |
|
| 1282 | + print '<span class="nomobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n"; |
|
| 1283 | + print '<span class="mobile">'.gmdate('H:i:s', $spotter_item['duration']).'</span>'."\n"; |
|
| 1284 | 1284 | } else { |
| 1285 | 1285 | print '<span class="nomobile">-</span>'."\n"; |
| 1286 | 1286 | print '<span class="mobile">-</span>'."\n"; |
@@ -1294,7 +1294,7 @@ discard block |
||
| 1294 | 1294 | if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive") { |
| 1295 | 1295 | if (isset($spotter_item['decode']) && $spotter_item['decode'] != '') { |
| 1296 | 1296 | print '<td class="message"><p>'."\n"; |
| 1297 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 1297 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 1298 | 1298 | print '</p><p class="decode">'; |
| 1299 | 1299 | $decode_array = json_decode($spotter_item['decode']); |
| 1300 | 1300 | foreach ($decode_array as $key => $value) { |
@@ -1304,7 +1304,7 @@ discard block |
||
| 1304 | 1304 | print '</td>'."\n"; |
| 1305 | 1305 | } else { |
| 1306 | 1306 | print '<td class="message">'."\n"; |
| 1307 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 1307 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 1308 | 1308 | print '</td>'."\n"; |
| 1309 | 1309 | } |
| 1310 | 1310 | } |
@@ -1329,7 +1329,7 @@ discard block |
||
| 1329 | 1329 | } |
| 1330 | 1330 | print '</td>'."\n"; |
| 1331 | 1331 | print '<td class="message">'."\n"; |
| 1332 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 1332 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 1333 | 1333 | print '</td>'."\n"; |
| 1334 | 1334 | } |
| 1335 | 1335 | if (strtolower($current_page) == "incident-latest" || strtolower($current_page) == "incident-detailed") { |
@@ -1355,7 +1355,7 @@ discard block |
||
| 1355 | 1355 | print '</td>'."\n"; |
| 1356 | 1356 | */ |
| 1357 | 1357 | print '<td class="message">'."\n"; |
| 1358 | - print str_replace(array("\r\n", "\n", "\r"),'<br />',$spotter_item['message']); |
|
| 1358 | + print str_replace(array("\r\n", "\n", "\r"), '<br />', $spotter_item['message']); |
|
| 1359 | 1359 | print '</td>'."\n"; |
| 1360 | 1360 | } |
| 1361 | 1361 | |
@@ -7,8 +7,10 @@ discard block |
||
| 7 | 7 | $showRouteStop = $Common->multiKeyExists($spotter_array,'route_stop'); |
| 8 | 8 | if (isset($globalVM) && $globalVM && isset($type) && $type == 'marine') { |
| 9 | 9 | $showDuration = $Common->multiKeyExists($spotter_array,'race_time'); |
| 10 | - if ($showDuration === false) $showDuration = $Common->multiKeyExists($spotter_array,'duration'); |
|
| 11 | -} else { |
|
| 10 | + if ($showDuration === false) { |
|
| 11 | + $showDuration = $Common->multiKeyExists($spotter_array,'duration'); |
|
| 12 | + } |
|
| 13 | + } else { |
|
| 12 | 14 | $showDuration = $Common->multiKeyExists($spotter_array,'duration'); |
| 13 | 15 | } |
| 14 | 16 | if (isset($globalVM) && $globalVM && isset($type) && $type == 'marine') { |
@@ -16,7 +18,9 @@ discard block |
||
| 16 | 18 | } |
| 17 | 19 | |
| 18 | 20 | |
| 19 | -if (!isset($type)) $type = 'aircraft'; |
|
| 21 | +if (!isset($type)) { |
|
| 22 | + $type = 'aircraft'; |
|
| 23 | +} |
|
| 20 | 24 | |
| 21 | 25 | if (!isset($_GET['sort'])) |
| 22 | 26 | { |
@@ -592,7 +596,9 @@ discard block |
||
| 592 | 596 | if (isset($globalTimezone)) |
| 593 | 597 | { |
| 594 | 598 | date_default_timezone_set($globalTimezone); |
| 595 | - } else date_default_timezone_set('UTC'); |
|
| 599 | + } else { |
|
| 600 | + date_default_timezone_set('UTC'); |
|
| 601 | + } |
|
| 596 | 602 | if ($showSpecial === true) |
| 597 | 603 | { |
| 598 | 604 | print '<tr class="special">'."\n"; |
@@ -607,7 +613,9 @@ discard block |
||
| 607 | 613 | print '<tr class="active">'; |
| 608 | 614 | } elseif (isset($spotter_item['spotted_registration'])) { |
| 609 | 615 | print '<tr class="info">'; |
| 610 | - } else print '<tr>'; |
|
| 616 | + } else { |
|
| 617 | + print '<tr>'; |
|
| 618 | + } |
|
| 611 | 619 | } |
| 612 | 620 | if (strtolower($current_page) == "acars-latest" || strtolower($current_page) == "acars-archive" || strtolower($current_page) == "currently" || strtolower($current_page) == "accident-latest" || strtolower($current_page) == "incident-latest" || strtolower($current_page) == "accident-detailed" || strtolower($current_page) == "incident-detailed") { |
| 613 | 621 | if ($type == 'aircraft') { |
@@ -615,8 +623,9 @@ discard block |
||
| 615 | 623 | { |
| 616 | 624 | print '<td class="aircraft_thumbnail">'."\n"; |
| 617 | 625 | if ($spotter_item['image_source'] == 'planespotters') { |
| 618 | - if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website']; |
|
| 619 | - else { |
|
| 626 | + if ($spotter_item['image_source_website'] != '') { |
|
| 627 | + $image_src = $spotter_item['image_source_website']; |
|
| 628 | + } else { |
|
| 620 | 629 | $planespotter_url_array = explode("_", $spotter_item['image']); |
| 621 | 630 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
| 622 | 631 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
@@ -629,7 +638,9 @@ discard block |
||
| 629 | 638 | } else { |
| 630 | 639 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 631 | 640 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 632 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 641 | + } else { |
|
| 642 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 643 | + } |
|
| 633 | 644 | if (isset($spotter_item['airline_name'])) { |
| 634 | 645 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" alt="'.$spotter_item['registration'].' - '.$spotter_item['airline_name'].'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Airline:").' '.$spotter_item['airline_name'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 635 | 646 | } else { |
@@ -655,7 +666,9 @@ discard block |
||
| 655 | 666 | print '<td class="aircraft_thumbnail">'."\n"; |
| 656 | 667 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 657 | 668 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 658 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 669 | + } else { |
|
| 670 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 671 | + } |
|
| 659 | 672 | if (isset($spotter_item['mmsi']) && $spotter_item['mmsi'] != '') { |
| 660 | 673 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 661 | 674 | } else { |
@@ -677,7 +690,9 @@ discard block |
||
| 677 | 690 | print '<td class="aircraft_thumbnail">'."\n"; |
| 678 | 691 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 679 | 692 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 680 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 693 | + } else { |
|
| 694 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 695 | + } |
|
| 681 | 696 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 682 | 697 | print '</td>'."\n"; |
| 683 | 698 | } else { |
@@ -730,8 +745,9 @@ discard block |
||
| 730 | 745 | print '<td class="aircraft_thumbnail">'."\n"; |
| 731 | 746 | //print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$spotter_item['image_thumbnail'].'" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>'; |
| 732 | 747 | if ($spotter_item['image_source'] == 'planespotters') { |
| 733 | - if ($spotter_item['image_source_website'] != '') $image_src = $spotter_item['image_source_website']; |
|
| 734 | - else { |
|
| 748 | + if ($spotter_item['image_source_website'] != '') { |
|
| 749 | + $image_src = $spotter_item['image_source_website']; |
|
| 750 | + } else { |
|
| 735 | 751 | $planespotter_url_array = explode("_", $spotter_array[0]['image']); |
| 736 | 752 | $planespotter_id = str_replace(".jpg", "", $planespotter_url_array[1]); |
| 737 | 753 | $image_src = 'https://www.planespotters.net/Aviation_Photos/photo.show?id='.$planespotter_id; |
@@ -748,7 +764,9 @@ discard block |
||
| 748 | 764 | } else { |
| 749 | 765 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 750 | 766 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 751 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 767 | + } else { |
|
| 768 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 769 | + } |
|
| 752 | 770 | if (!isset($spotter_item['airline_name']) && isset($spotter_item['aircraft_name'])) { |
| 753 | 771 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '.$spotter_item['aircraft_name'].' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 754 | 772 | } elseif (!isset($spotter_item['aircraft_name']) && isset($spotter_item['airline_name'])) { |
@@ -788,13 +806,19 @@ discard block |
||
| 788 | 806 | print '<td class="aircraft_thumbnail">'."\n"; |
| 789 | 807 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 790 | 808 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 791 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 809 | + } else { |
|
| 810 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 811 | + } |
|
| 792 | 812 | if (isset($spotter_item['mmsi']) && $spotter_item['mmsi'] != '') { |
| 793 | 813 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['mmsi'].'" alt="'.$spotter_item['mmsi'].'" data-content="'._("MMSI:").' '.$spotter_item['mmsi'].'" data-html="true" width="100px" />'."\n"; |
| 794 | - if ($spotter_item['image_copyright'] != '') print '<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 814 | + if ($spotter_item['image_copyright'] != '') { |
|
| 815 | + print '<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 816 | + } |
|
| 795 | 817 | } else { |
| 796 | 818 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['ident'].'" data-content="'._("Ident:").' '.$spotter_item['ident'].'" data-html="true" width="100px" />'."\n"; |
| 797 | - if ($spotter_item['image_copyright'] != '') print '<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 819 | + if ($spotter_item['image_copyright'] != '') { |
|
| 820 | + print '<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
|
| 821 | + } |
|
| 798 | 822 | } |
| 799 | 823 | print '</td>'."\n"; |
| 800 | 824 | } else { |
@@ -812,7 +836,9 @@ discard block |
||
| 812 | 836 | print '<td class="aircraft_thumbnail">'."\n"; |
| 813 | 837 | if ($spotter_item['image_source'] == 'wikimedia' || $spotter_item['image_source'] == 'devianart' || $spotter_item['image_source'] == 'flickr') { |
| 814 | 838 | $image_thumbnail = preg_replace("/^http:/i","https:",$spotter_item['image_thumbnail']); |
| 815 | - } else $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 839 | + } else { |
|
| 840 | + $image_thumbnail = $spotter_item['image_thumbnail']; |
|
| 841 | + } |
|
| 816 | 842 | print '<img src="'.$image_thumbnail.'" class="img-rounded" data-toggle="popover" title="'.$spotter_item['ident'].'" alt="'.$spotter_item['type'].'" data-content="'._("Type:").' '.$spotter_item['type'].'" data-html="true" width="100px" />'."\n".'<div class="thumbnail-copyright">© '.$spotter_item['image_copyright'].'</div>'; |
| 817 | 843 | print '</td>'."\n"; |
| 818 | 844 | } else { |
@@ -930,8 +956,11 @@ discard block |
||
| 930 | 956 | print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a></span>'."\n"; |
| 931 | 957 | } else { |
| 932 | 958 | $aircraft_names = explode('/',$spotter_item['aircraft_name']); |
| 933 | - if (count($aircraft_names) == 1) print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</a></span>'."\n"; |
|
| 934 | - else print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].'</a></span>'."\n"; |
|
| 959 | + if (count($aircraft_names) == 1) { |
|
| 960 | + print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_manufacturer'].' '.$spotter_item['aircraft_name'].'</a></span>'."\n"; |
|
| 961 | + } else { |
|
| 962 | + print '<span class="nomobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'" title="'.$spotter_item['aircraft_name'].'">'.$spotter_item['aircraft_manufacturer'].' '.$aircraft_names[0].'</a></span>'."\n"; |
|
| 963 | + } |
|
| 935 | 964 | } |
| 936 | 965 | print '<span class="mobile"><a href="'.$globalURL.'/aircraft/'.$spotter_item['aircraft_type'].'">'.$spotter_item['aircraft_type'].'</a></span>'."\n"; |
| 937 | 966 | } elseif ($type == 'marine') { |
@@ -974,15 +1003,21 @@ discard block |
||
| 974 | 1003 | if (isset($spotter_item['departure_airport_time']) && isset($spotter_item['real_departure_airport_time'])) { |
| 975 | 1004 | if ($spotter_item['departure_airport_time'] > 2460) { |
| 976 | 1005 | $departure_airport_time = date('H:m',$spotter_item['departure_airport_time']); |
| 977 | - } else $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 1006 | + } else { |
|
| 1007 | + $departure_airport_time = substr($spotter_item['departure_airport_time'],0,-2).':'.substr($spotter_item['departure_airport_time'],-2); |
|
| 1008 | + } |
|
| 978 | 1009 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 979 | 1010 | $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
| 980 | - } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
| 1011 | + } else { |
|
| 1012 | + $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
| 1013 | + } |
|
| 981 | 1014 | print '<br /><span class="airport_time">'.$departure_airport_time.' ('.$real_departure_airport_time.')</span>'."\n"; |
| 982 | 1015 | } elseif (isset($spotter_item['real_departure_airport_time']) && $spotter_item['real_departure_airport_time'] != 'NULL') { |
| 983 | 1016 | if ($spotter_item['real_departure_airport_time'] > 2460) { |
| 984 | 1017 | $real_departure_airport_time = date('H:m',$spotter_item['real_departure_airport_time']); |
| 985 | - } else $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
| 1018 | + } else { |
|
| 1019 | + $real_departure_airport_time = $spotter_item['real_departure_airport_time']; |
|
| 1020 | + } |
|
| 986 | 1021 | print '<br /><span class="airport_time">'.$real_departure_airport_time.'</span>'."\n"; |
| 987 | 1022 | } elseif (isset($spotter_item['departure_airport_time']) && $spotter_item['departure_airport_time'] != 'NULL') { |
| 988 | 1023 | if ($spotter_item['departure_airport_time'] > 2460) { |
@@ -1004,7 +1039,9 @@ discard block |
||
| 1004 | 1039 | $longitude = $spotter_item['longitude']; |
| 1005 | 1040 | } |
| 1006 | 1041 | $distance = $Spotter->getAirportDistance($spotter_item['departure_airport'],$latitude,$longitude); |
| 1007 | - } else $distance = ''; |
|
| 1042 | + } else { |
|
| 1043 | + $distance = ''; |
|
| 1044 | + } |
|
| 1008 | 1045 | if ($distance != '') { |
| 1009 | 1046 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
| 1010 | 1047 | echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |
@@ -1031,7 +1068,9 @@ discard block |
||
| 1031 | 1068 | } else { |
| 1032 | 1069 | if (isset($spotter_item['real_arrival_airport']) && $spotter_item['real_arrival_airport'] != $spotter_item['arrival_airport']) { |
| 1033 | 1070 | print '<span class="nomobile">Scheduled : <a href="'.$globalURL.'/airport/'.$spotter_item['arrival_airport'].'">'.$spotter_item['arrival_airport_city'].', '.$spotter_item['arrival_airport_country'].' ('.$spotter_item['arrival_airport'].')</a></span>'."\n"; |
| 1034 | - if (!isset($Spotter)) $Spotter = new Spotter(); |
|
| 1071 | + if (!isset($Spotter)) { |
|
| 1072 | + $Spotter = new Spotter(); |
|
| 1073 | + } |
|
| 1035 | 1074 | $arrival_airport_info = $Spotter->getAllAirportInfo($spotter_item['real_arrival_airport']); |
| 1036 | 1075 | if (isset($arrival_airport_info[0])) { |
| 1037 | 1076 | print '<br /><span class="nomobile">' . _("Real:") . ' <a href="' . $globalURL . '/airport/' . $spotter_item['real_arrival_airport'] . '">' . $arrival_airport_info[0]['city'] . ',' . $arrival_airport_info[0]['country'] . ' (' . $spotter_item['real_arrival_airport'] . ')</a></span>' . "\n"; |
@@ -1051,20 +1090,28 @@ discard block |
||
| 1051 | 1090 | if (isset($spotter_item['arrival_airport_time']) && isset($spotter_item['real_arrival_airport_time'])) { |
| 1052 | 1091 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 1053 | 1092 | $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
| 1054 | - } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
| 1093 | + } else { |
|
| 1094 | + $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
| 1095 | + } |
|
| 1055 | 1096 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 1056 | 1097 | $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
| 1057 | - } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
| 1098 | + } else { |
|
| 1099 | + $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
| 1100 | + } |
|
| 1058 | 1101 | print '<br /><span class="airport_time">'.$spotter_item['arrival_airport_time'].' ('.$spotter_item['real_arrival_airport_time'].')</span>'."\n"; |
| 1059 | 1102 | } elseif (isset($spotter_item['real_arrival_airport_time'])) { |
| 1060 | 1103 | if ($spotter_item['real_arrival_airport_time'] > 2460) { |
| 1061 | 1104 | $real_arrival_airport_time = date('H:m',$spotter_item['real_arrival_airport_time']); |
| 1062 | - } else $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
| 1105 | + } else { |
|
| 1106 | + $real_arrival_airport_time = $spotter_item['real_arrival_airport_time']; |
|
| 1107 | + } |
|
| 1063 | 1108 | print '<br /><span class="airport_time">'.$real_arrival_airport_time.'</span>'."\n"; |
| 1064 | 1109 | } elseif (isset($spotter_item['arrival_airport_time']) && $spotter_item['arrival_airport_time'] != 'NULL') { |
| 1065 | 1110 | if ($spotter_item['arrival_airport_time'] > 2460) { |
| 1066 | 1111 | $arrival_airport_time = date('H:m',$spotter_item['arrival_airport_time']); |
| 1067 | - } else $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
| 1112 | + } else { |
|
| 1113 | + $arrival_airport_time = $spotter_item['arrival_airport_time']; |
|
| 1114 | + } |
|
| 1068 | 1115 | print '<br /><span class="airport_time">'.$arrival_airport_time.'</span>'."\n"; |
| 1069 | 1116 | } |
| 1070 | 1117 | if (!isset($spotter_item['real_arrival_airport']) && $spotter_item['arrival_airport'] != 'NA') { |
@@ -1077,7 +1124,9 @@ discard block |
||
| 1077 | 1124 | $longitude = $spotter_item['longitude']; |
| 1078 | 1125 | } |
| 1079 | 1126 | $distance = $Spotter->getAirportDistance($spotter_item['arrival_airport'],$latitude,$longitude); |
| 1080 | - } else $distance = ''; |
|
| 1127 | + } else { |
|
| 1128 | + $distance = ''; |
|
| 1129 | + } |
|
| 1081 | 1130 | if ($distance != '') { |
| 1082 | 1131 | if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
| 1083 | 1132 | echo '<br/><i>'.round($distance*0.539957).' nm</i>'; |
@@ -20,13 +20,13 @@ discard block |
||
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Get SQL query part for filter used |
|
| 25 | - * @param array $filter the filter |
|
| 26 | - * @param bool $where |
|
| 27 | - * @param bool $and |
|
| 28 | - * @return string the SQL part |
|
| 29 | - */ |
|
| 23 | + /** |
|
| 24 | + * Get SQL query part for filter used |
|
| 25 | + * @param array $filter the filter |
|
| 26 | + * @param bool $where |
|
| 27 | + * @param bool $and |
|
| 28 | + * @return string the SQL part |
|
| 29 | + */ |
|
| 30 | 30 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 31 | 31 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 32 | 32 | $filters = array(); |
@@ -105,14 +105,14 @@ discard block |
||
| 105 | 105 | return $filter_query; |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Gets all the spotter information based on the latest data entry |
|
| 110 | - * |
|
| 111 | - * @param string $limit |
|
| 112 | - * @param string $sort |
|
| 113 | - * @param array $filter |
|
| 114 | - * @return array the spotter information |
|
| 115 | - */ |
|
| 108 | + /** |
|
| 109 | + * Gets all the spotter information based on the latest data entry |
|
| 110 | + * |
|
| 111 | + * @param string $limit |
|
| 112 | + * @param string $sort |
|
| 113 | + * @param array $filter |
|
| 114 | + * @return array the spotter information |
|
| 115 | + */ |
|
| 116 | 116 | public function getLiveMarineData($limit = '', $sort = '', $filter = array()) |
| 117 | 117 | { |
| 118 | 118 | global $globalDBdriver, $globalLiveInterval; |
@@ -154,12 +154,12 @@ discard block |
||
| 154 | 154 | return $spotter_array; |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - /** |
|
| 158 | - * Gets Minimal Live Spotter data |
|
| 159 | - * |
|
| 160 | - * @param array $filter |
|
| 161 | - * @return array the spotter information |
|
| 162 | - */ |
|
| 157 | + /** |
|
| 158 | + * Gets Minimal Live Spotter data |
|
| 159 | + * |
|
| 160 | + * @param array $filter |
|
| 161 | + * @return array the spotter information |
|
| 162 | + */ |
|
| 163 | 163 | public function getMinLiveMarineData($filter = array()) |
| 164 | 164 | { |
| 165 | 165 | global $globalDBdriver, $globalLiveInterval; |
@@ -188,15 +188,15 @@ discard block |
||
| 188 | 188 | return $spotter_array; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - /** |
|
| 192 | - * Gets Minimal Live Spotter data since xx seconds |
|
| 193 | - * |
|
| 194 | - * @param array $coord |
|
| 195 | - * @param array $filter |
|
| 196 | - * @param bool $limit |
|
| 197 | - * @param string $id |
|
| 198 | - * @return array the spotter information |
|
| 199 | - */ |
|
| 191 | + /** |
|
| 192 | + * Gets Minimal Live Spotter data since xx seconds |
|
| 193 | + * |
|
| 194 | + * @param array $coord |
|
| 195 | + * @param array $filter |
|
| 196 | + * @param bool $limit |
|
| 197 | + * @param string $id |
|
| 198 | + * @return array the spotter information |
|
| 199 | + */ |
|
| 200 | 200 | public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false, $id = '') |
| 201 | 201 | { |
| 202 | 202 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
@@ -275,14 +275,14 @@ discard block |
||
| 275 | 275 | return $spotter_array; |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - /** |
|
| 279 | - * Gets Minimal Live Spotter data since xx seconds |
|
| 280 | - * |
|
| 281 | - * @param string $id |
|
| 282 | - * @param array $filter |
|
| 283 | - * @param bool $limit |
|
| 284 | - * @return array the spotter information |
|
| 285 | - */ |
|
| 278 | + /** |
|
| 279 | + * Gets Minimal Live Spotter data since xx seconds |
|
| 280 | + * |
|
| 281 | + * @param string $id |
|
| 282 | + * @param array $filter |
|
| 283 | + * @param bool $limit |
|
| 284 | + * @return array the spotter information |
|
| 285 | + */ |
|
| 286 | 286 | public function getMinLastLiveMarineDataByID($id = '',$filter = array(), $limit = false) |
| 287 | 287 | { |
| 288 | 288 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
@@ -341,12 +341,12 @@ discard block |
||
| 341 | 341 | return $spotter_array; |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - /** |
|
| 345 | - * Gets number of latest data entry |
|
| 346 | - * |
|
| 347 | - * @param array $filter |
|
| 348 | - * @return String number of entry |
|
| 349 | - */ |
|
| 344 | + /** |
|
| 345 | + * Gets number of latest data entry |
|
| 346 | + * |
|
| 347 | + * @param array $filter |
|
| 348 | + * @return String number of entry |
|
| 349 | + */ |
|
| 350 | 350 | public function getLiveMarineCount($filter = array()) |
| 351 | 351 | { |
| 352 | 352 | global $globalDBdriver, $globalLiveInterval; |
@@ -370,13 +370,13 @@ discard block |
||
| 370 | 370 | return $result['nb']; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | - /** |
|
| 374 | - * Gets all the spotter information based on the latest data entry and coord |
|
| 375 | - * |
|
| 376 | - * @param $coord |
|
| 377 | - * @param array $filter |
|
| 378 | - * @return array the spotter information |
|
| 379 | - */ |
|
| 373 | + /** |
|
| 374 | + * Gets all the spotter information based on the latest data entry and coord |
|
| 375 | + * |
|
| 376 | + * @param $coord |
|
| 377 | + * @param array $filter |
|
| 378 | + * @return array the spotter information |
|
| 379 | + */ |
|
| 380 | 380 | public function getLiveMarineDatabyCoord($coord, $filter = array()) |
| 381 | 381 | { |
| 382 | 382 | global $globalDBdriver, $globalLiveInterval; |
@@ -399,13 +399,13 @@ discard block |
||
| 399 | 399 | return $spotter_array; |
| 400 | 400 | } |
| 401 | 401 | |
| 402 | - /** |
|
| 403 | - * Gets all the spotter information based on the latest data entry and coord |
|
| 404 | - * |
|
| 405 | - * @param $coord |
|
| 406 | - * @param array $filter |
|
| 407 | - * @return array the spotter information |
|
| 408 | - */ |
|
| 402 | + /** |
|
| 403 | + * Gets all the spotter information based on the latest data entry and coord |
|
| 404 | + * |
|
| 405 | + * @param $coord |
|
| 406 | + * @param array $filter |
|
| 407 | + * @return array the spotter information |
|
| 408 | + */ |
|
| 409 | 409 | public function getMinLiveMarineDatabyCoord($coord, $filter = array()) |
| 410 | 410 | { |
| 411 | 411 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
@@ -473,15 +473,15 @@ discard block |
||
| 473 | 473 | return $spotter_array; |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - /** |
|
| 477 | - * Gets all the spotter information based on a user's latitude and longitude |
|
| 478 | - * |
|
| 479 | - * @param $lat |
|
| 480 | - * @param $lng |
|
| 481 | - * @param $radius |
|
| 482 | - * @param $interval |
|
| 483 | - * @return array the spotter information |
|
| 484 | - */ |
|
| 476 | + /** |
|
| 477 | + * Gets all the spotter information based on a user's latitude and longitude |
|
| 478 | + * |
|
| 479 | + * @param $lat |
|
| 480 | + * @param $lng |
|
| 481 | + * @param $radius |
|
| 482 | + * @param $interval |
|
| 483 | + * @return array the spotter information |
|
| 484 | + */ |
|
| 485 | 485 | public function getLatestMarineForLayar($lat, $lng, $radius, $interval) |
| 486 | 486 | { |
| 487 | 487 | $Marine = new Marine($this->db); |
@@ -538,32 +538,32 @@ discard block |
||
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | |
| 541 | - /** |
|
| 542 | - * Gets all the spotter information based on a particular callsign |
|
| 543 | - * |
|
| 544 | - * @param $ident |
|
| 545 | - * @return array the spotter information |
|
| 546 | - */ |
|
| 541 | + /** |
|
| 542 | + * Gets all the spotter information based on a particular callsign |
|
| 543 | + * |
|
| 544 | + * @param $ident |
|
| 545 | + * @return array the spotter information |
|
| 546 | + */ |
|
| 547 | 547 | public function getLastLiveMarineDataByIdent($ident) |
| 548 | 548 | { |
| 549 | 549 | $Marine = new Marine($this->db); |
| 550 | 550 | date_default_timezone_set('UTC'); |
| 551 | 551 | |
| 552 | 552 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 553 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 553 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 554 | 554 | |
| 555 | 555 | $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true); |
| 556 | 556 | |
| 557 | 557 | return $spotter_array; |
| 558 | 558 | } |
| 559 | 559 | |
| 560 | - /** |
|
| 561 | - * Gets all the spotter information based on a particular callsign |
|
| 562 | - * |
|
| 563 | - * @param $ident |
|
| 564 | - * @param $date |
|
| 565 | - * @return array the spotter information |
|
| 566 | - */ |
|
| 560 | + /** |
|
| 561 | + * Gets all the spotter information based on a particular callsign |
|
| 562 | + * |
|
| 563 | + * @param $ident |
|
| 564 | + * @param $date |
|
| 565 | + * @return array the spotter information |
|
| 566 | + */ |
|
| 567 | 567 | public function getDateLiveMarineDataByIdent($ident,$date) |
| 568 | 568 | { |
| 569 | 569 | $Marine = new Marine($this->db); |
@@ -575,13 +575,13 @@ discard block |
||
| 575 | 575 | return $spotter_array; |
| 576 | 576 | } |
| 577 | 577 | |
| 578 | - /** |
|
| 579 | - * Gets all the spotter information based on a particular MMSI |
|
| 580 | - * |
|
| 581 | - * @param $mmsi |
|
| 582 | - * @param $date |
|
| 583 | - * @return array the spotter information |
|
| 584 | - */ |
|
| 578 | + /** |
|
| 579 | + * Gets all the spotter information based on a particular MMSI |
|
| 580 | + * |
|
| 581 | + * @param $mmsi |
|
| 582 | + * @param $date |
|
| 583 | + * @return array the spotter information |
|
| 584 | + */ |
|
| 585 | 585 | public function getDateLiveMarineDataByMMSI($mmsi,$date) |
| 586 | 586 | { |
| 587 | 587 | $Marine = new Marine($this->db); |
@@ -593,53 +593,53 @@ discard block |
||
| 593 | 593 | return $spotter_array; |
| 594 | 594 | } |
| 595 | 595 | |
| 596 | - /** |
|
| 597 | - * Gets last spotter information based on a particular callsign |
|
| 598 | - * |
|
| 599 | - * @param $id |
|
| 600 | - * @return array the spotter information |
|
| 601 | - */ |
|
| 596 | + /** |
|
| 597 | + * Gets last spotter information based on a particular callsign |
|
| 598 | + * |
|
| 599 | + * @param $id |
|
| 600 | + * @return array the spotter information |
|
| 601 | + */ |
|
| 602 | 602 | public function getLastLiveMarineDataById($id) |
| 603 | 603 | { |
| 604 | 604 | $Marine = new Marine($this->db); |
| 605 | 605 | date_default_timezone_set('UTC'); |
| 606 | 606 | |
| 607 | 607 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 608 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 608 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 609 | 609 | |
| 610 | 610 | $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true); |
| 611 | 611 | |
| 612 | 612 | return $spotter_array; |
| 613 | 613 | } |
| 614 | 614 | |
| 615 | - /** |
|
| 616 | - * Gets last spotter information based on a particular callsign |
|
| 617 | - * |
|
| 618 | - * @param $id |
|
| 619 | - * @param $date |
|
| 620 | - * @return array the spotter information |
|
| 621 | - */ |
|
| 615 | + /** |
|
| 616 | + * Gets last spotter information based on a particular callsign |
|
| 617 | + * |
|
| 618 | + * @param $id |
|
| 619 | + * @param $date |
|
| 620 | + * @return array the spotter information |
|
| 621 | + */ |
|
| 622 | 622 | public function getDateLiveMarineDataById($id,$date) |
| 623 | 623 | { |
| 624 | 624 | $Marine = new Marine($this->db); |
| 625 | 625 | date_default_timezone_set('UTC'); |
| 626 | 626 | |
| 627 | 627 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 628 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 629 | - $date = date('c',$date); |
|
| 628 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 629 | + $date = date('c',$date); |
|
| 630 | 630 | $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
| 631 | 631 | |
| 632 | 632 | return $spotter_array; |
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | |
| 636 | - /** |
|
| 637 | - * Gets all the spotter information based on a particular id |
|
| 638 | - * |
|
| 639 | - * @param $id |
|
| 640 | - * @param bool $liveinterval |
|
| 641 | - * @return array the spotter information |
|
| 642 | - */ |
|
| 636 | + /** |
|
| 637 | + * Gets all the spotter information based on a particular id |
|
| 638 | + * |
|
| 639 | + * @param $id |
|
| 640 | + * @param bool $liveinterval |
|
| 641 | + * @return array the spotter information |
|
| 642 | + */ |
|
| 643 | 643 | public function getAllLiveMarineDataById($id,$liveinterval = false) |
| 644 | 644 | { |
| 645 | 645 | global $globalDBdriver, $globalLiveInterval; |
@@ -667,18 +667,18 @@ discard block |
||
| 667 | 667 | return $spotter_array; |
| 668 | 668 | } |
| 669 | 669 | |
| 670 | - /** |
|
| 671 | - * Gets all the spotter information based on a particular ident |
|
| 672 | - * |
|
| 673 | - * @param $ident |
|
| 674 | - * @return array the spotter information |
|
| 675 | - */ |
|
| 670 | + /** |
|
| 671 | + * Gets all the spotter information based on a particular ident |
|
| 672 | + * |
|
| 673 | + * @param $ident |
|
| 674 | + * @return array the spotter information |
|
| 675 | + */ |
|
| 676 | 676 | public function getAllLiveMarineDataByIdent($ident) |
| 677 | 677 | { |
| 678 | 678 | date_default_timezone_set('UTC'); |
| 679 | 679 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 680 | 680 | $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
| 681 | - try { |
|
| 681 | + try { |
|
| 682 | 682 | |
| 683 | 683 | $sth = $this->db->prepare($query); |
| 684 | 684 | $sth->execute(array(':ident' => $ident)); |
@@ -692,23 +692,23 @@ discard block |
||
| 692 | 692 | |
| 693 | 693 | |
| 694 | 694 | /** |
| 695 | - * Deletes all info in the table |
|
| 696 | - * |
|
| 697 | - * @return String success or false |
|
| 698 | - * |
|
| 699 | - */ |
|
| 695 | + * Deletes all info in the table |
|
| 696 | + * |
|
| 697 | + * @return String success or false |
|
| 698 | + * |
|
| 699 | + */ |
|
| 700 | 700 | public function deleteLiveMarineData() |
| 701 | 701 | { |
| 702 | 702 | global $globalDBdriver; |
| 703 | 703 | if ($globalDBdriver == 'mysql') { |
| 704 | 704 | //$query = "DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= marine_live.date"; |
| 705 | 705 | $query = 'DELETE FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 12 HOUR) >= marine_live.date'; |
| 706 | - //$query = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)"; |
|
| 706 | + //$query = "DELETE FROM marine_live WHERE marine_live.id IN (SELECT marine_live.id FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= marine_live.date)"; |
|
| 707 | 707 | } else { |
| 708 | 708 | $query = "DELETE FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '12 HOURS' >= marine_live.date"; |
| 709 | 709 | } |
| 710 | 710 | |
| 711 | - try { |
|
| 711 | + try { |
|
| 712 | 712 | |
| 713 | 713 | $sth = $this->db->prepare($query); |
| 714 | 714 | $sth->execute(); |
@@ -720,18 +720,18 @@ discard block |
||
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | /** |
| 723 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 724 | - * |
|
| 725 | - * @return String success or false |
|
| 726 | - * |
|
| 727 | - */ |
|
| 723 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
| 724 | + * |
|
| 725 | + * @return String success or false |
|
| 726 | + * |
|
| 727 | + */ |
|
| 728 | 728 | public function deleteLiveMarineDataNotUpdated() |
| 729 | 729 | { |
| 730 | 730 | global $globalDBdriver, $globalDebug; |
| 731 | 731 | if ($globalDBdriver == 'mysql') { |
| 732 | 732 | //$query = 'SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < marine_live.date) LIMIT 800 OFFSET 0'; |
| 733 | - $query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
| 734 | - try { |
|
| 733 | + $query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
| 734 | + try { |
|
| 735 | 735 | |
| 736 | 736 | $sth = $this->db->prepare($query); |
| 737 | 737 | $sth->execute(); |
@@ -739,8 +739,8 @@ discard block |
||
| 739 | 739 | return "error"; |
| 740 | 740 | } |
| 741 | 741 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
| 742 | - $i = 0; |
|
| 743 | - $j =0; |
|
| 742 | + $i = 0; |
|
| 743 | + $j =0; |
|
| 744 | 744 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 745 | 745 | foreach($all as $row) |
| 746 | 746 | { |
@@ -748,20 +748,20 @@ discard block |
||
| 748 | 748 | $j++; |
| 749 | 749 | if ($j == 30) { |
| 750 | 750 | if ($globalDebug) echo "."; |
| 751 | - try { |
|
| 751 | + try { |
|
| 752 | 752 | |
| 753 | 753 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 754 | 754 | $sth->execute(); |
| 755 | 755 | } catch(PDOException $e) { |
| 756 | 756 | return "error"; |
| 757 | 757 | } |
| 758 | - $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
|
| 759 | - $j = 0; |
|
| 758 | + $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
|
| 759 | + $j = 0; |
|
| 760 | 760 | } |
| 761 | 761 | $query_delete .= "'".$row['fammarine_id']."',"; |
| 762 | 762 | } |
| 763 | 763 | if ($i > 0) { |
| 764 | - try { |
|
| 764 | + try { |
|
| 765 | 765 | |
| 766 | 766 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
| 767 | 767 | $sth->execute(); |
@@ -772,9 +772,9 @@ discard block |
||
| 772 | 772 | return "success"; |
| 773 | 773 | } elseif ($globalDBdriver == 'pgsql') { |
| 774 | 774 | //$query = "SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= marine_live.date AND marine_live.fammarine_id NOT IN (SELECT fammarine_id FROM marine_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < marine_live.date) LIMIT 800 OFFSET 0"; |
| 775 | - //$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
| 776 | - $query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
| 777 | - try { |
|
| 775 | + //$query = "SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
| 776 | + $query = "DELETE FROM marine_live WHERE fammarine_id IN (SELECT marine_live.fammarine_id FROM marine_live INNER JOIN (SELECT fammarine_id,MAX(date) as max_date FROM marine_live GROUP BY fammarine_id) s ON s.fammarine_id = marine_live.fammarine_id AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
| 777 | + try { |
|
| 778 | 778 | |
| 779 | 779 | $sth = $this->db->prepare($query); |
| 780 | 780 | $sth->execute(); |
@@ -818,18 +818,18 @@ discard block |
||
| 818 | 818 | return 'error'; |
| 819 | 819 | } |
| 820 | 820 | |
| 821 | - /** |
|
| 822 | - * Deletes all info in the table for an ident |
|
| 823 | - * |
|
| 824 | - * @param $ident |
|
| 825 | - * @return String success or false |
|
| 826 | - */ |
|
| 821 | + /** |
|
| 822 | + * Deletes all info in the table for an ident |
|
| 823 | + * |
|
| 824 | + * @param $ident |
|
| 825 | + * @return String success or false |
|
| 826 | + */ |
|
| 827 | 827 | public function deleteLiveMarineDataByIdent($ident) |
| 828 | 828 | { |
| 829 | 829 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 830 | 830 | $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
| 831 | 831 | |
| 832 | - try { |
|
| 832 | + try { |
|
| 833 | 833 | |
| 834 | 834 | $sth = $this->db->prepare($query); |
| 835 | 835 | $sth->execute(array(':ident' => $ident)); |
@@ -840,18 +840,18 @@ discard block |
||
| 840 | 840 | return "success"; |
| 841 | 841 | } |
| 842 | 842 | |
| 843 | - /** |
|
| 844 | - * Deletes all info in the table for an id |
|
| 845 | - * |
|
| 846 | - * @param $id |
|
| 847 | - * @return String success or false |
|
| 848 | - */ |
|
| 843 | + /** |
|
| 844 | + * Deletes all info in the table for an id |
|
| 845 | + * |
|
| 846 | + * @param $id |
|
| 847 | + * @return String success or false |
|
| 848 | + */ |
|
| 849 | 849 | public function deleteLiveMarineDataById($id) |
| 850 | 850 | { |
| 851 | 851 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 852 | 852 | $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
| 853 | 853 | |
| 854 | - try { |
|
| 854 | + try { |
|
| 855 | 855 | |
| 856 | 856 | $sth = $this->db->prepare($query); |
| 857 | 857 | $sth->execute(array(':id' => $id)); |
@@ -864,11 +864,11 @@ discard block |
||
| 864 | 864 | |
| 865 | 865 | |
| 866 | 866 | /** |
| 867 | - * Gets the marine races |
|
| 868 | - * |
|
| 869 | - * @return array all races |
|
| 870 | - * |
|
| 871 | - */ |
|
| 867 | + * Gets the marine races |
|
| 868 | + * |
|
| 869 | + * @return array all races |
|
| 870 | + * |
|
| 871 | + */ |
|
| 872 | 872 | public function getAllRaces() |
| 873 | 873 | { |
| 874 | 874 | $query = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name'; |
@@ -877,12 +877,12 @@ discard block |
||
| 877 | 877 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
| 878 | 878 | } |
| 879 | 879 | |
| 880 | - /** |
|
| 881 | - * Gets the aircraft ident within the last hour |
|
| 882 | - * |
|
| 883 | - * @param $ident |
|
| 884 | - * @return String the ident |
|
| 885 | - */ |
|
| 880 | + /** |
|
| 881 | + * Gets the aircraft ident within the last hour |
|
| 882 | + * |
|
| 883 | + * @param $ident |
|
| 884 | + * @return String the ident |
|
| 885 | + */ |
|
| 886 | 886 | public function getIdentFromLastHour($ident) |
| 887 | 887 | { |
| 888 | 888 | global $globalDBdriver; |
@@ -908,14 +908,14 @@ discard block |
||
| 908 | 908 | $ident_result = $row['ident']; |
| 909 | 909 | } |
| 910 | 910 | return $ident_result; |
| 911 | - } |
|
| 912 | - |
|
| 913 | - /** |
|
| 914 | - * Check recent aircraft |
|
| 915 | - * |
|
| 916 | - * @param $ident |
|
| 917 | - * @return String the ident |
|
| 918 | - */ |
|
| 911 | + } |
|
| 912 | + |
|
| 913 | + /** |
|
| 914 | + * Check recent aircraft |
|
| 915 | + * |
|
| 916 | + * @param $ident |
|
| 917 | + * @return String the ident |
|
| 918 | + */ |
|
| 919 | 919 | public function checkIdentRecent($ident) |
| 920 | 920 | { |
| 921 | 921 | global $globalDBdriver; |
@@ -941,14 +941,14 @@ discard block |
||
| 941 | 941 | $ident_result = $row['fammarine_id']; |
| 942 | 942 | } |
| 943 | 943 | return $ident_result; |
| 944 | - } |
|
| 945 | - |
|
| 946 | - /** |
|
| 947 | - * Check recent aircraft by id |
|
| 948 | - * |
|
| 949 | - * @param $id |
|
| 950 | - * @return String the ident |
|
| 951 | - */ |
|
| 944 | + } |
|
| 945 | + |
|
| 946 | + /** |
|
| 947 | + * Check recent aircraft by id |
|
| 948 | + * |
|
| 949 | + * @param $id |
|
| 950 | + * @return String the ident |
|
| 951 | + */ |
|
| 952 | 952 | public function checkIdRecent($id) |
| 953 | 953 | { |
| 954 | 954 | global $globalDBdriver; |
@@ -974,14 +974,14 @@ discard block |
||
| 974 | 974 | $ident_result = $row['fammarine_id']; |
| 975 | 975 | } |
| 976 | 976 | return $ident_result; |
| 977 | - } |
|
| 978 | - |
|
| 979 | - /** |
|
| 980 | - * Check recent aircraft by mmsi |
|
| 981 | - * |
|
| 982 | - * @param $mmsi |
|
| 983 | - * @return String the ident |
|
| 984 | - */ |
|
| 977 | + } |
|
| 978 | + |
|
| 979 | + /** |
|
| 980 | + * Check recent aircraft by mmsi |
|
| 981 | + * |
|
| 982 | + * @param $mmsi |
|
| 983 | + * @return String the ident |
|
| 984 | + */ |
|
| 985 | 985 | public function checkMMSIRecent($mmsi) |
| 986 | 986 | { |
| 987 | 987 | global $globalDBdriver; |
@@ -1007,41 +1007,41 @@ discard block |
||
| 1007 | 1007 | $ident_result = $row['fammarine_id']; |
| 1008 | 1008 | } |
| 1009 | 1009 | return $ident_result; |
| 1010 | - } |
|
| 1011 | - |
|
| 1012 | - /** |
|
| 1013 | - * Adds a new spotter data |
|
| 1014 | - * |
|
| 1015 | - * @param String $fammarine_id the ID from flightaware |
|
| 1016 | - * @param String $ident the flight ident |
|
| 1017 | - * @param string $latitude |
|
| 1018 | - * @param string $longitude |
|
| 1019 | - * @param string $heading |
|
| 1020 | - * @param string $groundspeed |
|
| 1021 | - * @param string $date |
|
| 1022 | - * @param bool $putinarchive |
|
| 1023 | - * @param string $mmsi |
|
| 1024 | - * @param string $type |
|
| 1025 | - * @param string $typeid |
|
| 1026 | - * @param string $imo |
|
| 1027 | - * @param string $callsign |
|
| 1028 | - * @param string $arrival_code |
|
| 1029 | - * @param string $arrival_date |
|
| 1030 | - * @param string $status |
|
| 1031 | - * @param string $statusid |
|
| 1032 | - * @param bool $noarchive |
|
| 1033 | - * @param string $format_source |
|
| 1034 | - * @param string $source_name |
|
| 1035 | - * @param string $over_country |
|
| 1036 | - * @param string $captain_id |
|
| 1037 | - * @param string $captain_name |
|
| 1038 | - * @param string $race_id |
|
| 1039 | - * @param string $race_name |
|
| 1040 | - * @param string $distance |
|
| 1041 | - * @param string $race_rank |
|
| 1042 | - * @param string $race_time |
|
| 1043 | - * @return String success or false |
|
| 1044 | - */ |
|
| 1010 | + } |
|
| 1011 | + |
|
| 1012 | + /** |
|
| 1013 | + * Adds a new spotter data |
|
| 1014 | + * |
|
| 1015 | + * @param String $fammarine_id the ID from flightaware |
|
| 1016 | + * @param String $ident the flight ident |
|
| 1017 | + * @param string $latitude |
|
| 1018 | + * @param string $longitude |
|
| 1019 | + * @param string $heading |
|
| 1020 | + * @param string $groundspeed |
|
| 1021 | + * @param string $date |
|
| 1022 | + * @param bool $putinarchive |
|
| 1023 | + * @param string $mmsi |
|
| 1024 | + * @param string $type |
|
| 1025 | + * @param string $typeid |
|
| 1026 | + * @param string $imo |
|
| 1027 | + * @param string $callsign |
|
| 1028 | + * @param string $arrival_code |
|
| 1029 | + * @param string $arrival_date |
|
| 1030 | + * @param string $status |
|
| 1031 | + * @param string $statusid |
|
| 1032 | + * @param bool $noarchive |
|
| 1033 | + * @param string $format_source |
|
| 1034 | + * @param string $source_name |
|
| 1035 | + * @param string $over_country |
|
| 1036 | + * @param string $captain_id |
|
| 1037 | + * @param string $captain_name |
|
| 1038 | + * @param string $race_id |
|
| 1039 | + * @param string $race_name |
|
| 1040 | + * @param string $distance |
|
| 1041 | + * @param string $race_rank |
|
| 1042 | + * @param string $race_time |
|
| 1043 | + * @return String success or false |
|
| 1044 | + */ |
|
| 1045 | 1045 | public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '',$captain_id = '',$captain_name = '',$race_id = '', $race_name = '', $distance = '', $race_rank = '', $race_time = '') |
| 1046 | 1046 | { |
| 1047 | 1047 | global $globalArchive, $globalDebug; |
@@ -1123,10 +1123,10 @@ discard block |
||
| 1123 | 1123 | if ($statusid == '') $statusid = NULL; |
| 1124 | 1124 | if ($distance == '') $distance = NULL; |
| 1125 | 1125 | |
| 1126 | - //if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 1127 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1128 | - if ($arrival_date == '') $arrival_date = NULL; |
|
| 1129 | - $query = ''; |
|
| 1126 | + //if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
| 1127 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1128 | + if ($arrival_date == '') $arrival_date = NULL; |
|
| 1129 | + $query = ''; |
|
| 1130 | 1130 | if ($globalArchive) { |
| 1131 | 1131 | if ($globalDebug) echo '-- Delete previous data -- '; |
| 1132 | 1132 | $query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;'; |
@@ -27,33 +27,33 @@ discard block |
||
| 27 | 27 | * @param bool $and |
| 28 | 28 | * @return string the SQL part |
| 29 | 29 | */ |
| 30 | - public function getFilter($filter = array(),$where = false,$and = false) { |
|
| 30 | + public function getFilter($filter = array(), $where = false, $and = false) { |
|
| 31 | 31 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
| 32 | 32 | $filters = array(); |
| 33 | 33 | if (is_array($globalStatsFilters) && isset($globalStatsFilters[$globalFilterName])) { |
| 34 | 34 | if (isset($globalStatsFilters[$globalFilterName][0]['source'])) { |
| 35 | 35 | $filters = $globalStatsFilters[$globalFilterName]; |
| 36 | 36 | } else { |
| 37 | - $filter = array_merge($filter,$globalStatsFilters[$globalFilterName]); |
|
| 37 | + $filter = array_merge($filter, $globalStatsFilters[$globalFilterName]); |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | 40 | if (isset($filter[0]['source'])) { |
| 41 | - $filters = array_merge($filters,$filter); |
|
| 41 | + $filters = array_merge($filters, $filter); |
|
| 42 | 42 | } |
| 43 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 43 | + if (is_array($globalFilter)) $filter = array_merge($filter, $globalFilter); |
|
| 44 | 44 | $filter_query_join = ''; |
| 45 | 45 | $filter_query_where = ''; |
| 46 | - foreach($filters as $flt) { |
|
| 46 | + foreach ($filters as $flt) { |
|
| 47 | 47 | if (isset($flt['idents']) && !empty($flt['idents'])) { |
| 48 | 48 | if (isset($flt['source'])) { |
| 49 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."') AND marine_output.format_source IN ('".implode("','",$flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
| 49 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."') AND marine_output.format_source IN ('".implode("','", $flt['source'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
| 50 | 50 | } else { |
| 51 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','",$flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
| 51 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output WHERE marine_output.ident IN ('".implode("','", $flt['idents'])."')) spid ON spid.fammarine_id = marine_live.fammarine_id"; |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | } |
| 55 | 55 | if (isset($filter['source']) && !empty($filter['source'])) { |
| 56 | - $filter_query_where .= " AND format_source IN ('".implode("','",$filter['source'])."')"; |
|
| 56 | + $filter_query_where .= " AND format_source IN ('".implode("','", $filter['source'])."')"; |
|
| 57 | 57 | } |
| 58 | 58 | if (isset($filter['ident']) && !empty($filter['ident'])) { |
| 59 | 59 | $filter_query_where .= " AND ident = '".$filter['ident']."'"; |
@@ -91,15 +91,15 @@ discard block |
||
| 91 | 91 | $filter_query_date .= " AND EXTRACT(DAY FROM marine_output.date) = '".$filter['day']."'"; |
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | - $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/',' WHERE',$filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
| 94 | + $filter_query_join .= " INNER JOIN (SELECT fammarine_id FROM marine_output".preg_replace('/^ AND/', ' WHERE', $filter_query_date).") sd ON sd.fammarine_id = marine_live.fammarine_id"; |
|
| 95 | 95 | } |
| 96 | 96 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 97 | - $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
|
| 97 | + $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','", $filter['source_aprs'])."')"; |
|
| 98 | 98 | } |
| 99 | 99 | if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
| 100 | 100 | elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
| 101 | 101 | if ($filter_query_where != '') { |
| 102 | - $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
|
| 102 | + $filter_query_where = preg_replace('/^ AND/', ' WHERE', $filter_query_where); |
|
| 103 | 103 | } |
| 104 | 104 | $filter_query = $filter_query_join.$filter_query_where; |
| 105 | 105 | return $filter_query; |
@@ -124,8 +124,8 @@ discard block |
||
| 124 | 124 | if ($limit != '') |
| 125 | 125 | { |
| 126 | 126 | $limit_array = explode(',', $limit); |
| 127 | - $limit_array[0] = filter_var($limit_array[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 128 | - $limit_array[1] = filter_var($limit_array[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 127 | + $limit_array[0] = filter_var($limit_array[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 128 | + $limit_array[1] = filter_var($limit_array[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 129 | 129 | if ($limit_array[0] >= 0 && $limit_array[1] >= 0) |
| 130 | 130 | { |
| 131 | 131 | $limit_query = ' LIMIT '.$limit_array[1].' OFFSET '.$limit_array[0]; |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
| 141 | 141 | } |
| 142 | 142 | } |
| 143 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
| 143 | + if ($orderby_query == '') $orderby_query = ' ORDER BY date DESC'; |
|
| 144 | 144 | |
| 145 | 145 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 146 | 146 | if ($globalDBdriver == 'mysql') { |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | } else { |
| 150 | 150 | $query = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate".$filter_query.$orderby_query; |
| 151 | 151 | } |
| 152 | - $spotter_array = $Marine->getDataFromDB($query.$limit_query,array(),'',true); |
|
| 152 | + $spotter_array = $Marine->getDataFromDB($query.$limit_query, array(), '', true); |
|
| 153 | 153 | |
| 154 | 154 | return $spotter_array; |
| 155 | 155 | } |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | global $globalDBdriver, $globalLiveInterval; |
| 166 | 166 | date_default_timezone_set('UTC'); |
| 167 | 167 | |
| 168 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 168 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 169 | 169 | |
| 170 | 170 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 171 | 171 | if ($globalDBdriver == 'mysql') { |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | try { |
| 180 | 180 | $sth = $this->db->prepare($query); |
| 181 | 181 | $sth->execute(); |
| 182 | - } catch(PDOException $e) { |
|
| 182 | + } catch (PDOException $e) { |
|
| 183 | 183 | echo $e->getMessage(); |
| 184 | 184 | die; |
| 185 | 185 | } |
@@ -197,26 +197,26 @@ discard block |
||
| 197 | 197 | * @param string $id |
| 198 | 198 | * @return array the spotter information |
| 199 | 199 | */ |
| 200 | - public function getMinLastLiveMarineData($coord = array(),$filter = array(), $limit = false, $id = '') |
|
| 200 | + public function getMinLastLiveMarineData($coord = array(), $filter = array(), $limit = false, $id = '') |
|
| 201 | 201 | { |
| 202 | 202 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
| 203 | 203 | date_default_timezone_set('UTC'); |
| 204 | 204 | $usecoord = false; |
| 205 | 205 | if (is_array($coord) && !empty($coord)) { |
| 206 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 207 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 208 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 209 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 206 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 207 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 208 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 209 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 210 | 210 | $usecoord = true; |
| 211 | 211 | } |
| 212 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
| 213 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 212 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 213 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 214 | 214 | |
| 215 | 215 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 216 | 216 | if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
| 217 | 217 | if ($globalDBdriver == 'mysql') { |
| 218 | 218 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 219 | - $query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
|
| 219 | + $query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
|
| 220 | 220 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
| 221 | 221 | if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
| 222 | 222 | if ($id != '') $query .= "OR marine_archive.fammarine_id = :id "; |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | ORDER BY fammarine_id, date"; |
| 231 | 231 | if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
| 232 | 232 | } else { |
| 233 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 233 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 234 | 234 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date "; |
| 235 | 235 | if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
| 236 | 236 | if ($id != '') $query .= "OR marine_live.fammarine_id = :id "; |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | } |
| 241 | 241 | } else { |
| 242 | 242 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 243 | - $query = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
|
| 243 | + $query = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
|
| 244 | 244 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
| 245 | 245 | if ($usecoord) $query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
| 246 | 246 | if ($id != '') $query .= "OR marine_archive.fammarine_id = :id "; |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | try { |
| 268 | 268 | $sth = $this->db->prepare($query); |
| 269 | 269 | $sth->execute($query_values); |
| 270 | - } catch(PDOException $e) { |
|
| 270 | + } catch (PDOException $e) { |
|
| 271 | 271 | echo $e->getMessage(); |
| 272 | 272 | die; |
| 273 | 273 | } |
@@ -283,12 +283,12 @@ discard block |
||
| 283 | 283 | * @param bool $limit |
| 284 | 284 | * @return array the spotter information |
| 285 | 285 | */ |
| 286 | - public function getMinLastLiveMarineDataByID($id = '',$filter = array(), $limit = false) |
|
| 286 | + public function getMinLastLiveMarineDataByID($id = '', $filter = array(), $limit = false) |
|
| 287 | 287 | { |
| 288 | 288 | global $globalDBdriver, $globalLiveInterval, $globalMap3DMarinesLimit, $globalArchive; |
| 289 | 289 | date_default_timezone_set('UTC'); |
| 290 | - $id = filter_var($id,FILTER_SANITIZE_STRING); |
|
| 291 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 290 | + $id = filter_var($id, FILTER_SANITIZE_STRING); |
|
| 291 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 292 | 292 | |
| 293 | 293 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 294 | 294 | if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | try { |
| 334 | 334 | $sth = $this->db->prepare($query); |
| 335 | 335 | $sth->execute($query_values); |
| 336 | - } catch(PDOException $e) { |
|
| 336 | + } catch (PDOException $e) { |
|
| 337 | 337 | echo $e->getMessage(); |
| 338 | 338 | die; |
| 339 | 339 | } |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | public function getLiveMarineCount($filter = array()) |
| 351 | 351 | { |
| 352 | 352 | global $globalDBdriver, $globalLiveInterval; |
| 353 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 353 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 354 | 354 | |
| 355 | 355 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 356 | 356 | if ($globalDBdriver == 'mysql') { |
@@ -361,7 +361,7 @@ discard block |
||
| 361 | 361 | try { |
| 362 | 362 | $sth = $this->db->prepare($query); |
| 363 | 363 | $sth->execute(); |
| 364 | - } catch(PDOException $e) { |
|
| 364 | + } catch (PDOException $e) { |
|
| 365 | 365 | echo $e->getMessage(); |
| 366 | 366 | die; |
| 367 | 367 | } |
@@ -385,10 +385,10 @@ discard block |
||
| 385 | 385 | $filter_query = $this->getFilter($filter); |
| 386 | 386 | |
| 387 | 387 | if (is_array($coord)) { |
| 388 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 389 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 390 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 391 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 388 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 389 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 390 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 391 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 392 | 392 | } else return array(); |
| 393 | 393 | if ($globalDBdriver == 'mysql') { |
| 394 | 394 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id ORDER BY date DESC'.$filter_query; |
@@ -411,13 +411,13 @@ discard block |
||
| 411 | 411 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 412 | 412 | $Marine = new Marine($this->db); |
| 413 | 413 | if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
| 414 | - $filter_query = $this->getFilter($filter,true,true); |
|
| 414 | + $filter_query = $this->getFilter($filter, true, true); |
|
| 415 | 415 | |
| 416 | 416 | if (is_array($coord)) { |
| 417 | - $minlong = filter_var($coord[0],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 418 | - $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 419 | - $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 420 | - $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 417 | + $minlong = filter_var($coord[0], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 418 | + $minlat = filter_var($coord[1], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 419 | + $maxlong = filter_var($coord[2], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 420 | + $maxlat = filter_var($coord[3], FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 421 | 421 | } else return array(); |
| 422 | 422 | /* |
| 423 | 423 | if ($globalDBdriver == 'mysql') { |
@@ -432,13 +432,13 @@ discard block |
||
| 432 | 432 | */ |
| 433 | 433 | if ($globalDBdriver == 'mysql') { |
| 434 | 434 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 435 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 435 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 436 | 436 | FROM marine_live |
| 437 | 437 | '.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= marine_live.date |
| 438 | 438 | AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' |
| 439 | 439 | AND marine_live.latitude <> 0 AND marine_live.longitude <> 0 ORDER BY race_rank,date DESC'; |
| 440 | 440 | } else { |
| 441 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 441 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 442 | 442 | FROM marine_live |
| 443 | 443 | INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate |
| 444 | 444 | FROM marine_live l |
@@ -450,14 +450,14 @@ discard block |
||
| 450 | 450 | } |
| 451 | 451 | } else { |
| 452 | 452 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 453 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 453 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 454 | 454 | FROM marine_live |
| 455 | 455 | ".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date |
| 456 | 456 | AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." |
| 457 | 457 | AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." |
| 458 | 458 | AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' ORDER BY race_rank, date DESC"; |
| 459 | 459 | } else { |
| 460 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 460 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
|
| 461 | 461 | FROM marine_live |
| 462 | 462 | INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate |
| 463 | 463 | FROM marine_live l |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | if ($interval == '1m') |
| 518 | 518 | { |
| 519 | 519 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
| 520 | - } else if ($interval == '15m'){ |
|
| 520 | + } else if ($interval == '15m') { |
|
| 521 | 521 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= marine_live.date '; |
| 522 | 522 | } |
| 523 | 523 | } |
@@ -525,14 +525,14 @@ discard block |
||
| 525 | 525 | $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= marine_live.date '; |
| 526 | 526 | } |
| 527 | 527 | |
| 528 | - $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
| 528 | + $query = "SELECT marine_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM marine_live |
|
| 529 | 529 | WHERE marine_live.latitude <> '' |
| 530 | 530 | AND marine_live.longitude <> '' |
| 531 | 531 | ".$additional_query." |
| 532 | 532 | HAVING distance < :radius |
| 533 | 533 | ORDER BY distance"; |
| 534 | 534 | |
| 535 | - $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
| 535 | + $spotter_array = $Marine->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng, ':radius' => $radius)); |
|
| 536 | 536 | |
| 537 | 537 | return $spotter_array; |
| 538 | 538 | } |
@@ -550,9 +550,9 @@ discard block |
||
| 550 | 550 | date_default_timezone_set('UTC'); |
| 551 | 551 | |
| 552 | 552 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 553 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 553 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 554 | 554 | |
| 555 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident),'',true); |
|
| 555 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident), '', true); |
|
| 556 | 556 | |
| 557 | 557 | return $spotter_array; |
| 558 | 558 | } |
@@ -564,14 +564,14 @@ discard block |
||
| 564 | 564 | * @param $date |
| 565 | 565 | * @return array the spotter information |
| 566 | 566 | */ |
| 567 | - public function getDateLiveMarineDataByIdent($ident,$date) |
|
| 567 | + public function getDateLiveMarineDataByIdent($ident, $date) |
|
| 568 | 568 | { |
| 569 | 569 | $Marine = new Marine($this->db); |
| 570 | 570 | date_default_timezone_set('UTC'); |
| 571 | 571 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 572 | 572 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
| 573 | - $date = date('c',$date); |
|
| 574 | - $spotter_array = $Marine->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
|
| 573 | + $date = date('c', $date); |
|
| 574 | + $spotter_array = $Marine->getDataFromDB($query, array(':ident' => $ident, ':date' => $date)); |
|
| 575 | 575 | return $spotter_array; |
| 576 | 576 | } |
| 577 | 577 | |
@@ -582,14 +582,14 @@ discard block |
||
| 582 | 582 | * @param $date |
| 583 | 583 | * @return array the spotter information |
| 584 | 584 | */ |
| 585 | - public function getDateLiveMarineDataByMMSI($mmsi,$date) |
|
| 585 | + public function getDateLiveMarineDataByMMSI($mmsi, $date) |
|
| 586 | 586 | { |
| 587 | 587 | $Marine = new Marine($this->db); |
| 588 | 588 | date_default_timezone_set('UTC'); |
| 589 | 589 | $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
| 590 | 590 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.mmsi = :mmsi AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
| 591 | - $date = date('c',$date); |
|
| 592 | - $spotter_array = $Marine->getDataFromDB($query,array(':mmsi' => $mmsi,':date' => $date)); |
|
| 591 | + $date = date('c', $date); |
|
| 592 | + $spotter_array = $Marine->getDataFromDB($query, array(':mmsi' => $mmsi, ':date' => $date)); |
|
| 593 | 593 | return $spotter_array; |
| 594 | 594 | } |
| 595 | 595 | |
@@ -605,9 +605,9 @@ discard block |
||
| 605 | 605 | date_default_timezone_set('UTC'); |
| 606 | 606 | |
| 607 | 607 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 608 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 608 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 609 | 609 | |
| 610 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id),'',true); |
|
| 610 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id), '', true); |
|
| 611 | 611 | |
| 612 | 612 | return $spotter_array; |
| 613 | 613 | } |
@@ -619,15 +619,15 @@ discard block |
||
| 619 | 619 | * @param $date |
| 620 | 620 | * @return array the spotter information |
| 621 | 621 | */ |
| 622 | - public function getDateLiveMarineDataById($id,$date) |
|
| 622 | + public function getDateLiveMarineDataById($id, $date) |
|
| 623 | 623 | { |
| 624 | 624 | $Marine = new Marine($this->db); |
| 625 | 625 | date_default_timezone_set('UTC'); |
| 626 | 626 | |
| 627 | 627 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 628 | - $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 629 | - $date = date('c',$date); |
|
| 630 | - $spotter_array = $Marine->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
|
| 628 | + $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE l.fammarine_id = :id AND l.date <= :date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate ORDER BY marine_live.date DESC'; |
|
| 629 | + $date = date('c', $date); |
|
| 630 | + $spotter_array = $Marine->getDataFromDB($query, array(':id' => $id, ':date' => $date), '', true); |
|
| 631 | 631 | |
| 632 | 632 | return $spotter_array; |
| 633 | 633 | } |
@@ -640,7 +640,7 @@ discard block |
||
| 640 | 640 | * @param bool $liveinterval |
| 641 | 641 | * @return array the spotter information |
| 642 | 642 | */ |
| 643 | - public function getAllLiveMarineDataById($id,$liveinterval = false) |
|
| 643 | + public function getAllLiveMarineDataById($id, $liveinterval = false) |
|
| 644 | 644 | { |
| 645 | 645 | global $globalDBdriver, $globalLiveInterval; |
| 646 | 646 | date_default_timezone_set('UTC'); |
@@ -659,7 +659,7 @@ discard block |
||
| 659 | 659 | try { |
| 660 | 660 | $sth = $this->db->prepare($query); |
| 661 | 661 | $sth->execute(array(':id' => $id)); |
| 662 | - } catch(PDOException $e) { |
|
| 662 | + } catch (PDOException $e) { |
|
| 663 | 663 | echo $e->getMessage(); |
| 664 | 664 | die; |
| 665 | 665 | } |
@@ -677,12 +677,12 @@ discard block |
||
| 677 | 677 | { |
| 678 | 678 | date_default_timezone_set('UTC'); |
| 679 | 679 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 680 | - $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
| 680 | + $query = self::$global_query.' WHERE marine_live.ident = :ident'; |
|
| 681 | 681 | try { |
| 682 | 682 | |
| 683 | 683 | $sth = $this->db->prepare($query); |
| 684 | 684 | $sth->execute(array(':ident' => $ident)); |
| 685 | - } catch(PDOException $e) { |
|
| 685 | + } catch (PDOException $e) { |
|
| 686 | 686 | echo $e->getMessage(); |
| 687 | 687 | die; |
| 688 | 688 | } |
@@ -712,7 +712,7 @@ discard block |
||
| 712 | 712 | |
| 713 | 713 | $sth = $this->db->prepare($query); |
| 714 | 714 | $sth->execute(); |
| 715 | - } catch(PDOException $e) { |
|
| 715 | + } catch (PDOException $e) { |
|
| 716 | 716 | return "error"; |
| 717 | 717 | } |
| 718 | 718 | |
@@ -735,14 +735,14 @@ discard block |
||
| 735 | 735 | |
| 736 | 736 | $sth = $this->db->prepare($query); |
| 737 | 737 | $sth->execute(); |
| 738 | - } catch(PDOException $e) { |
|
| 738 | + } catch (PDOException $e) { |
|
| 739 | 739 | return "error"; |
| 740 | 740 | } |
| 741 | 741 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
| 742 | 742 | $i = 0; |
| 743 | - $j =0; |
|
| 743 | + $j = 0; |
|
| 744 | 744 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
| 745 | - foreach($all as $row) |
|
| 745 | + foreach ($all as $row) |
|
| 746 | 746 | { |
| 747 | 747 | $i++; |
| 748 | 748 | $j++; |
@@ -750,9 +750,9 @@ discard block |
||
| 750 | 750 | if ($globalDebug) echo "."; |
| 751 | 751 | try { |
| 752 | 752 | |
| 753 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 753 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 754 | 754 | $sth->execute(); |
| 755 | - } catch(PDOException $e) { |
|
| 755 | + } catch (PDOException $e) { |
|
| 756 | 756 | return "error"; |
| 757 | 757 | } |
| 758 | 758 | $query_delete = 'DELETE FROM marine_live WHERE fammarine_id IN ('; |
@@ -763,9 +763,9 @@ discard block |
||
| 763 | 763 | if ($i > 0) { |
| 764 | 764 | try { |
| 765 | 765 | |
| 766 | - $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
|
| 766 | + $sth = $this->db->prepare(substr($query_delete, 0, -1).")"); |
|
| 767 | 767 | $sth->execute(); |
| 768 | - } catch(PDOException $e) { |
|
| 768 | + } catch (PDOException $e) { |
|
| 769 | 769 | return "error"; |
| 770 | 770 | } |
| 771 | 771 | } |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | |
| 779 | 779 | $sth = $this->db->prepare($query); |
| 780 | 780 | $sth->execute(); |
| 781 | - } catch(PDOException $e) { |
|
| 781 | + } catch (PDOException $e) { |
|
| 782 | 782 | return "error"; |
| 783 | 783 | } |
| 784 | 784 | /* $query_delete = "DELETE FROM marine_live WHERE fammarine_id IN ("; |
@@ -827,13 +827,13 @@ discard block |
||
| 827 | 827 | public function deleteLiveMarineDataByIdent($ident) |
| 828 | 828 | { |
| 829 | 829 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
| 830 | - $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
| 830 | + $query = 'DELETE FROM marine_live WHERE ident = :ident'; |
|
| 831 | 831 | |
| 832 | 832 | try { |
| 833 | 833 | |
| 834 | 834 | $sth = $this->db->prepare($query); |
| 835 | 835 | $sth->execute(array(':ident' => $ident)); |
| 836 | - } catch(PDOException $e) { |
|
| 836 | + } catch (PDOException $e) { |
|
| 837 | 837 | return "error"; |
| 838 | 838 | } |
| 839 | 839 | |
@@ -849,13 +849,13 @@ discard block |
||
| 849 | 849 | public function deleteLiveMarineDataById($id) |
| 850 | 850 | { |
| 851 | 851 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
| 852 | - $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
| 852 | + $query = 'DELETE FROM marine_live WHERE fammarine_id = :id'; |
|
| 853 | 853 | |
| 854 | 854 | try { |
| 855 | 855 | |
| 856 | 856 | $sth = $this->db->prepare($query); |
| 857 | 857 | $sth->execute(array(':id' => $id)); |
| 858 | - } catch(PDOException $e) { |
|
| 858 | + } catch (PDOException $e) { |
|
| 859 | 859 | return "error"; |
| 860 | 860 | } |
| 861 | 861 | |
@@ -871,7 +871,7 @@ discard block |
||
| 871 | 871 | */ |
| 872 | 872 | public function getAllRaces() |
| 873 | 873 | { |
| 874 | - $query = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name'; |
|
| 874 | + $query = 'SELECT DISTINCT marine_live.race_id, marine_live.race_name FROM marine_live ORDER BY marine_live.race_name'; |
|
| 875 | 875 | $sth = $this->db->prepare($query); |
| 876 | 876 | $sth->execute(); |
| 877 | 877 | return $sth->fetchAll(PDO::FETCH_ASSOC); |
@@ -887,13 +887,13 @@ discard block |
||
| 887 | 887 | { |
| 888 | 888 | global $globalDBdriver; |
| 889 | 889 | if ($globalDBdriver == 'mysql') { |
| 890 | - $query = 'SELECT marine_live.ident FROM marine_live |
|
| 890 | + $query = 'SELECT marine_live.ident FROM marine_live |
|
| 891 | 891 | WHERE marine_live.ident = :ident |
| 892 | 892 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) |
| 893 | 893 | AND marine_live.date < UTC_TIMESTAMP()'; |
| 894 | 894 | $query_data = array(':ident' => $ident); |
| 895 | 895 | } else { |
| 896 | - $query = "SELECT marine_live.ident FROM marine_live |
|
| 896 | + $query = "SELECT marine_live.ident FROM marine_live |
|
| 897 | 897 | WHERE marine_live.ident = :ident |
| 898 | 898 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 899 | 899 | AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -902,8 +902,8 @@ discard block |
||
| 902 | 902 | |
| 903 | 903 | $sth = $this->db->prepare($query); |
| 904 | 904 | $sth->execute($query_data); |
| 905 | - $ident_result=''; |
|
| 906 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 905 | + $ident_result = ''; |
|
| 906 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 907 | 907 | { |
| 908 | 908 | $ident_result = $row['ident']; |
| 909 | 909 | } |
@@ -920,13 +920,13 @@ discard block |
||
| 920 | 920 | { |
| 921 | 921 | global $globalDBdriver; |
| 922 | 922 | if ($globalDBdriver == 'mysql') { |
| 923 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 923 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 924 | 924 | WHERE marine_live.ident = :ident |
| 925 | 925 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE)'; |
| 926 | 926 | // AND marine_live.date < UTC_TIMESTAMP()"; |
| 927 | 927 | $query_data = array(':ident' => $ident); |
| 928 | 928 | } else { |
| 929 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 929 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 930 | 930 | WHERE marine_live.ident = :ident |
| 931 | 931 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '30 MINUTES'"; |
| 932 | 932 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -935,8 +935,8 @@ discard block |
||
| 935 | 935 | |
| 936 | 936 | $sth = $this->db->prepare($query); |
| 937 | 937 | $sth->execute($query_data); |
| 938 | - $ident_result=''; |
|
| 939 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 938 | + $ident_result = ''; |
|
| 939 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 940 | 940 | { |
| 941 | 941 | $ident_result = $row['fammarine_id']; |
| 942 | 942 | } |
@@ -953,13 +953,13 @@ discard block |
||
| 953 | 953 | { |
| 954 | 954 | global $globalDBdriver; |
| 955 | 955 | if ($globalDBdriver == 'mysql') { |
| 956 | - $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 956 | + $query = 'SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 957 | 957 | WHERE marine_live.fammarine_id = :id |
| 958 | 958 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 959 | 959 | // AND marine_live.date < UTC_TIMESTAMP()"; |
| 960 | 960 | $query_data = array(':id' => $id); |
| 961 | 961 | } else { |
| 962 | - $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 962 | + $query = "SELECT marine_live.ident, marine_live.fammarine_id FROM marine_live |
|
| 963 | 963 | WHERE marine_live.fammarine_id = :id |
| 964 | 964 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 965 | 965 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -968,8 +968,8 @@ discard block |
||
| 968 | 968 | |
| 969 | 969 | $sth = $this->db->prepare($query); |
| 970 | 970 | $sth->execute($query_data); |
| 971 | - $ident_result=''; |
|
| 972 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 971 | + $ident_result = ''; |
|
| 972 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 973 | 973 | { |
| 974 | 974 | $ident_result = $row['fammarine_id']; |
| 975 | 975 | } |
@@ -986,13 +986,13 @@ discard block |
||
| 986 | 986 | { |
| 987 | 987 | global $globalDBdriver; |
| 988 | 988 | if ($globalDBdriver == 'mysql') { |
| 989 | - $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
| 989 | + $query = 'SELECT marine_live.fammarine_id FROM marine_live |
|
| 990 | 990 | WHERE marine_live.mmsi = :mmsi |
| 991 | 991 | AND marine_live.date >= DATE_SUB(UTC_TIMESTAMP(),INTERVAL 10 HOUR)'; |
| 992 | 992 | // AND marine_live.date < UTC_TIMESTAMP()"; |
| 993 | 993 | $query_data = array(':mmsi' => $mmsi); |
| 994 | 994 | } else { |
| 995 | - $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
| 995 | + $query = "SELECT marine_live.fammarine_id FROM marine_live |
|
| 996 | 996 | WHERE marine_live.mmsi = :mmsi |
| 997 | 997 | AND marine_live.date >= now() AT TIME ZONE 'UTC' - INTERVAL '10 HOUR'"; |
| 998 | 998 | // AND marine_live.date < now() AT TIME ZONE 'UTC'"; |
@@ -1001,8 +1001,8 @@ discard block |
||
| 1001 | 1001 | |
| 1002 | 1002 | $sth = $this->db->prepare($query); |
| 1003 | 1003 | $sth->execute($query_data); |
| 1004 | - $ident_result=''; |
|
| 1005 | - while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1004 | + $ident_result = ''; |
|
| 1005 | + while ($row = $sth->fetch(PDO::FETCH_ASSOC)) |
|
| 1006 | 1006 | { |
| 1007 | 1007 | $ident_result = $row['fammarine_id']; |
| 1008 | 1008 | } |
@@ -1042,7 +1042,7 @@ discard block |
||
| 1042 | 1042 | * @param string $race_time |
| 1043 | 1043 | * @return String success or false |
| 1044 | 1044 | */ |
| 1045 | - public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '',$type = '',$typeid = '',$imo = '', $callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '',$captain_id = '',$captain_name = '',$race_id = '', $race_name = '', $distance = '', $race_rank = '', $race_time = '') |
|
| 1045 | + public function addLiveMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $mmsi = '', $type = '', $typeid = '', $imo = '', $callsign = '', $arrival_code = '', $arrival_date = '', $status = '', $statusid = '', $noarchive = false, $format_source = '', $source_name = '', $over_country = '', $captain_id = '', $captain_name = '', $race_id = '', $race_name = '', $distance = '', $race_rank = '', $race_time = '') |
|
| 1046 | 1046 | { |
| 1047 | 1047 | global $globalArchive, $globalDebug; |
| 1048 | 1048 | $Common = new Common(); |
@@ -1094,39 +1094,39 @@ discard block |
||
| 1094 | 1094 | if ($date == '') $date = date("Y-m-d H:i:s", time()); |
| 1095 | 1095 | |
| 1096 | 1096 | |
| 1097 | - $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
|
| 1098 | - $ident = filter_var($ident,FILTER_SANITIZE_STRING); |
|
| 1099 | - $latitude = filter_var($latitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1100 | - $longitude = filter_var($longitude,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1101 | - $distance = filter_var($distance,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1102 | - $heading = filter_var($heading,FILTER_SANITIZE_NUMBER_INT); |
|
| 1103 | - $groundspeed = filter_var($groundspeed,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1104 | - $format_source = filter_var($format_source,FILTER_SANITIZE_STRING); |
|
| 1105 | - $source_name = filter_var($source_name,FILTER_SANITIZE_STRING); |
|
| 1106 | - $over_country = filter_var($over_country,FILTER_SANITIZE_STRING); |
|
| 1107 | - $type = filter_var($type,FILTER_SANITIZE_STRING); |
|
| 1108 | - $typeid = filter_var($typeid,FILTER_SANITIZE_NUMBER_INT); |
|
| 1109 | - $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
|
| 1110 | - $status = filter_var($status,FILTER_SANITIZE_STRING); |
|
| 1111 | - $statusid = filter_var($statusid,FILTER_SANITIZE_NUMBER_INT); |
|
| 1112 | - $imo = filter_var($imo,FILTER_SANITIZE_STRING); |
|
| 1113 | - $callsign = filter_var($callsign,FILTER_SANITIZE_STRING); |
|
| 1114 | - $arrival_code = filter_var($arrival_code,FILTER_SANITIZE_STRING); |
|
| 1115 | - $arrival_date = filter_var($arrival_date,FILTER_SANITIZE_STRING); |
|
| 1116 | - $captain_id = filter_var($captain_id,FILTER_SANITIZE_STRING); |
|
| 1117 | - $captain_name = filter_var($captain_name,FILTER_SANITIZE_STRING); |
|
| 1118 | - $race_id = filter_var($race_id,FILTER_SANITIZE_STRING); |
|
| 1119 | - $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
|
| 1120 | - $race_rank = filter_var($race_rank,FILTER_SANITIZE_NUMBER_INT); |
|
| 1097 | + $fammarine_id = filter_var($fammarine_id, FILTER_SANITIZE_STRING); |
|
| 1098 | + $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
|
| 1099 | + $latitude = filter_var($latitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1100 | + $longitude = filter_var($longitude, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1101 | + $distance = filter_var($distance, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1102 | + $heading = filter_var($heading, FILTER_SANITIZE_NUMBER_INT); |
|
| 1103 | + $groundspeed = filter_var($groundspeed, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1104 | + $format_source = filter_var($format_source, FILTER_SANITIZE_STRING); |
|
| 1105 | + $source_name = filter_var($source_name, FILTER_SANITIZE_STRING); |
|
| 1106 | + $over_country = filter_var($over_country, FILTER_SANITIZE_STRING); |
|
| 1107 | + $type = filter_var($type, FILTER_SANITIZE_STRING); |
|
| 1108 | + $typeid = filter_var($typeid, FILTER_SANITIZE_NUMBER_INT); |
|
| 1109 | + $mmsi = filter_var($mmsi, FILTER_SANITIZE_NUMBER_INT); |
|
| 1110 | + $status = filter_var($status, FILTER_SANITIZE_STRING); |
|
| 1111 | + $statusid = filter_var($statusid, FILTER_SANITIZE_NUMBER_INT); |
|
| 1112 | + $imo = filter_var($imo, FILTER_SANITIZE_STRING); |
|
| 1113 | + $callsign = filter_var($callsign, FILTER_SANITIZE_STRING); |
|
| 1114 | + $arrival_code = filter_var($arrival_code, FILTER_SANITIZE_STRING); |
|
| 1115 | + $arrival_date = filter_var($arrival_date, FILTER_SANITIZE_STRING); |
|
| 1116 | + $captain_id = filter_var($captain_id, FILTER_SANITIZE_STRING); |
|
| 1117 | + $captain_name = filter_var($captain_name, FILTER_SANITIZE_STRING); |
|
| 1118 | + $race_id = filter_var($race_id, FILTER_SANITIZE_STRING); |
|
| 1119 | + $race_name = filter_var($race_name, FILTER_SANITIZE_STRING); |
|
| 1120 | + $race_rank = filter_var($race_rank, FILTER_SANITIZE_NUMBER_INT); |
|
| 1121 | 1121 | if ($race_rank == '') $race_rank = NULL; |
| 1122 | - $race_time = filter_var($race_time,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
|
| 1122 | + $race_time = filter_var($race_time, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); |
|
| 1123 | 1123 | if ($race_time == '') $race_time = NULL; |
| 1124 | 1124 | if ($typeid == '') $typeid = NULL; |
| 1125 | 1125 | if ($statusid == '') $statusid = NULL; |
| 1126 | 1126 | if ($distance == '') $distance = NULL; |
| 1127 | 1127 | |
| 1128 | 1128 | //if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
| 1129 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1129 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 1130 | 1130 | if ($arrival_date == '') $arrival_date = NULL; |
| 1131 | 1131 | $query = ''; |
| 1132 | 1132 | if ($globalArchive) { |
@@ -1135,19 +1135,19 @@ discard block |
||
| 1135 | 1135 | } |
| 1136 | 1136 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name,distance,race_rank,race_time) |
| 1137 | 1137 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:mmsi,:type,:typeid,:status,:statusid,:imo,:arrival_port_name,:arrival_port_date,:captain_id,:captain_name,:race_id,:race_name,:distance,:race_rank,:race_time)'; |
| 1138 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident,':latitude' => $latitude,':longitude' => $longitude,':heading' => $heading,':groundspeed' => $groundspeed,':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country,':mmsi' => $mmsi,':type' => $type,':typeid' => $typeid,':status' => $status,':statusid' => $statusid,':imo' => $imo,':arrival_port_name' => $arrival_code,':arrival_port_date' => $arrival_date,':captain_id' => $captain_id,':captain_name' => $captain_name,':race_id' => $race_id,':race_name' => $race_name,':distance' => $distance,':race_time' => $race_time,':race_rank' => $race_rank); |
|
| 1138 | + $query_values = array(':fammarine_id' => $fammarine_id, ':ident' => $ident, ':latitude' => $latitude, ':longitude' => $longitude, ':heading' => $heading, ':groundspeed' => $groundspeed, ':date' => $date, ':format_source' => $format_source, ':source_name' => $source_name, ':over_country' => $over_country, ':mmsi' => $mmsi, ':type' => $type, ':typeid' => $typeid, ':status' => $status, ':statusid' => $statusid, ':imo' => $imo, ':arrival_port_name' => $arrival_code, ':arrival_port_date' => $arrival_date, ':captain_id' => $captain_id, ':captain_name' => $captain_name, ':race_id' => $race_id, ':race_name' => $race_name, ':distance' => $distance, ':race_time' => $race_time, ':race_rank' => $race_rank); |
|
| 1139 | 1139 | try { |
| 1140 | 1140 | $sth = $this->db->prepare($query); |
| 1141 | 1141 | $sth->execute($query_values); |
| 1142 | 1142 | $sth->closeCursor(); |
| 1143 | - } catch(PDOException $e) { |
|
| 1143 | + } catch (PDOException $e) { |
|
| 1144 | 1144 | return "error : ".$e->getMessage(); |
| 1145 | 1145 | } |
| 1146 | 1146 | |
| 1147 | 1147 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 1148 | 1148 | if ($globalDebug) echo '(Add to Marine archive : '; |
| 1149 | 1149 | $MarineArchive = new MarineArchive($this->db); |
| 1150 | - $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country,$captain_id,$captain_name,$race_id,$race_name,$distance,$race_rank,$race_time); |
|
| 1150 | + $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi, $type, $typeid, $imo, $callsign, $arrival_code, $arrival_date, $status, $statusid, $noarchive, $format_source, $source_name, $over_country, $captain_id, $captain_name, $race_id, $race_name, $distance, $race_rank, $race_time); |
|
| 1151 | 1151 | if ($globalDebug) echo $result.')'; |
| 1152 | 1152 | } |
| 1153 | 1153 | return "success"; |
@@ -1155,7 +1155,7 @@ discard block |
||
| 1155 | 1155 | |
| 1156 | 1156 | public function getOrderBy() |
| 1157 | 1157 | { |
| 1158 | - $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"),"manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"),"airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
| 1158 | + $orderby = array("aircraft_asc" => array("key" => "aircraft_asc", "value" => "Aircraft Type - ASC", "sql" => "ORDER BY marine_live.aircraft_icao ASC"), "aircraft_desc" => array("key" => "aircraft_desc", "value" => "Aircraft Type - DESC", "sql" => "ORDER BY marine_live.aircraft_icao DESC"), "manufacturer_asc" => array("key" => "manufacturer_asc", "value" => "Aircraft Manufacturer - ASC", "sql" => "ORDER BY marine_live.aircraft_manufacturer ASC"), "manufacturer_desc" => array("key" => "manufacturer_desc", "value" => "Aircraft Manufacturer - DESC", "sql" => "ORDER BY marine_live.aircraft_manufacturer DESC"), "airline_name_asc" => array("key" => "airline_name_asc", "value" => "Airline Name - ASC", "sql" => "ORDER BY marine_live.airline_name ASC"), "airline_name_desc" => array("key" => "airline_name_desc", "value" => "Airline Name - DESC", "sql" => "ORDER BY marine_live.airline_name DESC"), "ident_asc" => array("key" => "ident_asc", "value" => "Ident - ASC", "sql" => "ORDER BY marine_live.ident ASC"), "ident_desc" => array("key" => "ident_desc", "value" => "Ident - DESC", "sql" => "ORDER BY marine_live.ident DESC"), "airport_departure_asc" => array("key" => "airport_departure_asc", "value" => "Departure Airport - ASC", "sql" => "ORDER BY marine_live.departure_airport_city ASC"), "airport_departure_desc" => array("key" => "airport_departure_desc", "value" => "Departure Airport - DESC", "sql" => "ORDER BY marine_live.departure_airport_city DESC"), "airport_arrival_asc" => array("key" => "airport_arrival_asc", "value" => "Arrival Airport - ASC", "sql" => "ORDER BY marine_live.arrival_airport_city ASC"), "airport_arrival_desc" => array("key" => "airport_arrival_desc", "value" => "Arrival Airport - DESC", "sql" => "ORDER BY marine_live.arrival_airport_city DESC"), "date_asc" => array("key" => "date_asc", "value" => "Date - ASC", "sql" => "ORDER BY marine_live.date ASC"), "date_desc" => array("key" => "date_desc", "value" => "Date - DESC", "sql" => "ORDER BY marine_live.date DESC")); |
|
| 1159 | 1159 | return $orderby; |
| 1160 | 1160 | } |
| 1161 | 1161 | |
@@ -16,7 +16,9 @@ discard block |
||
| 16 | 16 | public function __construct($dbc = null) { |
| 17 | 17 | $Connection = new Connection($dbc); |
| 18 | 18 | $this->db = $Connection->db(); |
| 19 | - if ($this->db === null) die('Error: No DB connection. (MarineLive)'); |
|
| 19 | + if ($this->db === null) { |
|
| 20 | + die('Error: No DB connection. (MarineLive)'); |
|
| 21 | + } |
|
| 20 | 22 | } |
| 21 | 23 | |
| 22 | 24 | |
@@ -40,7 +42,9 @@ discard block |
||
| 40 | 42 | if (isset($filter[0]['source'])) { |
| 41 | 43 | $filters = array_merge($filters,$filter); |
| 42 | 44 | } |
| 43 | - if (is_array($globalFilter)) $filter = array_merge($filter,$globalFilter); |
|
| 45 | + if (is_array($globalFilter)) { |
|
| 46 | + $filter = array_merge($filter,$globalFilter); |
|
| 47 | + } |
|
| 44 | 48 | $filter_query_join = ''; |
| 45 | 49 | $filter_query_where = ''; |
| 46 | 50 | foreach($filters as $flt) { |
@@ -96,8 +100,11 @@ discard block |
||
| 96 | 100 | if (isset($filter['source_aprs']) && !empty($filter['source_aprs'])) { |
| 97 | 101 | $filter_query_where .= " AND format_source = 'aprs' AND source_name IN ('".implode("','",$filter['source_aprs'])."')"; |
| 98 | 102 | } |
| 99 | - if ($filter_query_where == '' && $where) $filter_query_where = ' WHERE'; |
|
| 100 | - elseif ($filter_query_where != '' && $and) $filter_query_where .= ' AND'; |
|
| 103 | + if ($filter_query_where == '' && $where) { |
|
| 104 | + $filter_query_where = ' WHERE'; |
|
| 105 | + } elseif ($filter_query_where != '' && $and) { |
|
| 106 | + $filter_query_where .= ' AND'; |
|
| 107 | + } |
|
| 101 | 108 | if ($filter_query_where != '') { |
| 102 | 109 | $filter_query_where = preg_replace('/^ AND/',' WHERE',$filter_query_where); |
| 103 | 110 | } |
@@ -140,9 +147,13 @@ discard block |
||
| 140 | 147 | $orderby_query = ' '.$search_orderby_array[$sort]['sql']; |
| 141 | 148 | } |
| 142 | 149 | } |
| 143 | - if ($orderby_query == '') $orderby_query= ' ORDER BY date DESC'; |
|
| 150 | + if ($orderby_query == '') { |
|
| 151 | + $orderby_query= ' ORDER BY date DESC'; |
|
| 152 | + } |
|
| 144 | 153 | |
| 145 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 154 | + if (!isset($globalLiveInterval)) { |
|
| 155 | + $globalLiveInterval = '200'; |
|
| 156 | + } |
|
| 146 | 157 | if ($globalDBdriver == 'mysql') { |
| 147 | 158 | //$query = "SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate"; |
| 148 | 159 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query.$orderby_query; |
@@ -167,7 +178,9 @@ discard block |
||
| 167 | 178 | |
| 168 | 179 | $filter_query = $this->getFilter($filter,true,true); |
| 169 | 180 | |
| 170 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 181 | + if (!isset($globalLiveInterval)) { |
|
| 182 | + $globalLiveInterval = '200'; |
|
| 183 | + } |
|
| 171 | 184 | if ($globalDBdriver == 'mysql') { |
| 172 | 185 | $query = 'SELECT marine_live.mmsi, marine_live.ident, marine_live.type,marine_live.fammarine_id, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 173 | 186 | FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate'.$filter_query." marine_live.latitude <> 0 AND marine_live.longitude <> 0 ORDER BY marine_live.race_rank"; |
@@ -212,58 +225,96 @@ discard block |
||
| 212 | 225 | $id = filter_var($id,FILTER_SANITIZE_STRING); |
| 213 | 226 | $filter_query = $this->getFilter($filter,true,true); |
| 214 | 227 | |
| 215 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 216 | - if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
|
| 228 | + if (!isset($globalLiveInterval)) { |
|
| 229 | + $globalLiveInterval = '200'; |
|
| 230 | + } |
|
| 231 | + if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') { |
|
| 232 | + $globalMap3DMarinesLimit = '300'; |
|
| 233 | + } |
|
| 217 | 234 | if ($globalDBdriver == 'mysql') { |
| 218 | 235 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 219 | 236 | $query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
| 220 | 237 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
| 221 | - if ($usecoord) $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 222 | - if ($id != '') $query .= "OR marine_archive.fammarine_id = :id "; |
|
| 238 | + if ($usecoord) { |
|
| 239 | + $query .= "AND marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 240 | + } |
|
| 241 | + if ($id != '') { |
|
| 242 | + $query .= "OR marine_archive.fammarine_id = :id "; |
|
| 243 | + } |
|
| 223 | 244 | $query .= "UNION |
| 224 | 245 | SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 225 | 246 | FROM marine_live".$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date"; |
| 226 | - if ($usecoord) $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 227 | - if ($id != '') $query .= "OR marine_live.fammarine_id = :id "; |
|
| 247 | + if ($usecoord) { |
|
| 248 | + $query .= " AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong; |
|
| 249 | + } |
|
| 250 | + if ($id != '') { |
|
| 251 | + $query .= "OR marine_live.fammarine_id = :id "; |
|
| 252 | + } |
|
| 228 | 253 | $query .= ") AS marine |
| 229 | 254 | WHERE latitude <> '0' AND longitude <> '0' |
| 230 | 255 | ORDER BY fammarine_id, date"; |
| 231 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 256 | + if ($limit) { |
|
| 257 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 258 | + } |
|
| 232 | 259 | } else { |
| 233 | 260 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 234 | 261 | FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= marine_live.date "; |
| 235 | - if ($usecoord) $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 236 | - if ($id != '') $query .= "OR marine_live.fammarine_id = :id "; |
|
| 262 | + if ($usecoord) { |
|
| 263 | + $query .= "AND marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong." "; |
|
| 264 | + } |
|
| 265 | + if ($id != '') { |
|
| 266 | + $query .= "OR marine_live.fammarine_id = :id "; |
|
| 267 | + } |
|
| 237 | 268 | $query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 238 | 269 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 239 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 270 | + if ($limit) { |
|
| 271 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 272 | + } |
|
| 240 | 273 | } |
| 241 | 274 | } else { |
| 242 | 275 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 243 | 276 | $query = "SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id, marine_archive.type_id, marine_archive.type,marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
| 244 | 277 | FROM marine_archive INNER JOIN (SELECT fammarine_id FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date) l ON l.fammarine_id = marine_archive.fammarine_id "; |
| 245 | - if ($usecoord) $query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 246 | - if ($id != '') $query .= "OR marine_archive.fammarine_id = :id "; |
|
| 278 | + if ($usecoord) { |
|
| 279 | + $query .= "AND (marine_archive.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_archive.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 280 | + } |
|
| 281 | + if ($id != '') { |
|
| 282 | + $query .= "OR marine_archive.fammarine_id = :id "; |
|
| 283 | + } |
|
| 247 | 284 | $query .= "UNION |
| 248 | 285 | SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 249 | 286 | FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date"; |
| 250 | - if ($usecoord) $query .= " AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 251 | - if ($id != '') $query .= " OR marine_live.fammarine_id = :id"; |
|
| 287 | + if ($usecoord) { |
|
| 288 | + $query .= " AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.")"; |
|
| 289 | + } |
|
| 290 | + if ($id != '') { |
|
| 291 | + $query .= " OR marine_live.fammarine_id = :id"; |
|
| 292 | + } |
|
| 252 | 293 | $query .= ") AS marine WHERE latitude <> '0' AND longitude <> '0' "; |
| 253 | 294 | $query .= "ORDER BY fammarine_id, date"; |
| 254 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 295 | + if ($limit) { |
|
| 296 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 297 | + } |
|
| 255 | 298 | } else { |
| 256 | 299 | $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 257 | 300 | FROM marine_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= marine_live.date "; |
| 258 | - if ($usecoord) $query .= "AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 259 | - if ($id != '') $query .= "OR marine_live.fammarine_id = :id "; |
|
| 301 | + if ($usecoord) { |
|
| 302 | + $query .= "AND (marine_live.latitude BETWEEN ".$minlat." AND ".$maxlat." AND marine_live.longitude BETWEEN ".$minlong." AND ".$maxlong.") "; |
|
| 303 | + } |
|
| 304 | + if ($id != '') { |
|
| 305 | + $query .= "OR marine_live.fammarine_id = :id "; |
|
| 306 | + } |
|
| 260 | 307 | $query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 261 | 308 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 262 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 309 | + if ($limit) { |
|
| 310 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 311 | + } |
|
| 263 | 312 | } |
| 264 | 313 | } |
| 265 | 314 | $query_values = array(); |
| 266 | - if ($id != '') $query_values = array(':id' => $id); |
|
| 315 | + if ($id != '') { |
|
| 316 | + $query_values = array(':id' => $id); |
|
| 317 | + } |
|
| 267 | 318 | try { |
| 268 | 319 | $sth = $this->db->prepare($query); |
| 269 | 320 | $sth->execute($query_values); |
@@ -290,8 +341,12 @@ discard block |
||
| 290 | 341 | $id = filter_var($id,FILTER_SANITIZE_STRING); |
| 291 | 342 | $filter_query = $this->getFilter($filter,true,true); |
| 292 | 343 | |
| 293 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 294 | - if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') $globalMap3DMarinesLimit = '300'; |
|
| 344 | + if (!isset($globalLiveInterval)) { |
|
| 345 | + $globalLiveInterval = '200'; |
|
| 346 | + } |
|
| 347 | + if (!isset($globalMap3DMarinesLimit) || $globalMap3DMarinesLimit == '') { |
|
| 348 | + $globalMap3DMarinesLimit = '300'; |
|
| 349 | + } |
|
| 295 | 350 | if ($globalDBdriver == 'mysql') { |
| 296 | 351 | if (isset($globalArchive) && $globalArchive === TRUE) { |
| 297 | 352 | $query = 'SELECT * FROM (SELECT marine_archive.ident, marine_archive.fammarine_id,marine_archive.type_id,marine_archive.type, marine_archive.latitude, marine_archive.longitude, marine_archive.heading, marine_archive.ground_speed, marine_archive.date, marine_archive.format_source, marine_archive.captain_name, marine_archive.race_id, marine_archive.race_rank, marine_archive.race_name |
@@ -302,13 +357,17 @@ discard block |
||
| 302 | 357 | $query .= ") AS marine |
| 303 | 358 | WHERE latitude <> '0' AND longitude <> '0' |
| 304 | 359 | ORDER BY fammarine_id, date"; |
| 305 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 360 | + if ($limit) { |
|
| 361 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 362 | + } |
|
| 306 | 363 | } else { |
| 307 | 364 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 308 | 365 | FROM marine_live'.$filter_query.' marine_live.fammarine_id = :id '; |
| 309 | 366 | $query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 310 | 367 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 311 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 368 | + if ($limit) { |
|
| 369 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 370 | + } |
|
| 312 | 371 | } |
| 313 | 372 | } else { |
| 314 | 373 | if (isset($globalArchive) && $globalArchive === TRUE) { |
@@ -320,13 +379,17 @@ discard block |
||
| 320 | 379 | $query .= ") AS marine |
| 321 | 380 | WHERE latitude <> '0' AND longitude <> '0' |
| 322 | 381 | ORDER BY fammarine_id, date"; |
| 323 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 382 | + if ($limit) { |
|
| 383 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 384 | + } |
|
| 324 | 385 | } else { |
| 325 | 386 | $query = "SELECT marine_live.ident, marine_live.fammarine_id, marine_live.type_id, marine_live.type,marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source, marine_live.captain_name, marine_live.race_id, marine_live.race_rank, marine_live.race_name |
| 326 | 387 | FROM marine_live".$filter_query." marine_live.fammarine_id = :id "; |
| 327 | 388 | $query .= "AND marine_live.latitude <> '0' AND marine_live.longitude <> '0' |
| 328 | 389 | ORDER BY marine_live.fammarine_id, marine_live.date"; |
| 329 | - if ($limit) $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 390 | + if ($limit) { |
|
| 391 | + $query .= " LIMIT ".$globalMap3DMarinesLimit; |
|
| 392 | + } |
|
| 330 | 393 | } |
| 331 | 394 | } |
| 332 | 395 | $query_values = array(':id' => $id); |
@@ -352,7 +415,9 @@ discard block |
||
| 352 | 415 | global $globalDBdriver, $globalLiveInterval; |
| 353 | 416 | $filter_query = $this->getFilter($filter,true,true); |
| 354 | 417 | |
| 355 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 418 | + if (!isset($globalLiveInterval)) { |
|
| 419 | + $globalLiveInterval = '200'; |
|
| 420 | + } |
|
| 356 | 421 | if ($globalDBdriver == 'mysql') { |
| 357 | 422 | $query = 'SELECT COUNT(DISTINCT marine_live.fammarine_id) as nb FROM marine_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
| 358 | 423 | } else { |
@@ -381,7 +446,9 @@ discard block |
||
| 381 | 446 | { |
| 382 | 447 | global $globalDBdriver, $globalLiveInterval; |
| 383 | 448 | $Marine = new Marine($this->db); |
| 384 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 449 | + if (!isset($globalLiveInterval)) { |
|
| 450 | + $globalLiveInterval = '200'; |
|
| 451 | + } |
|
| 385 | 452 | $filter_query = $this->getFilter($filter); |
| 386 | 453 | |
| 387 | 454 | if (is_array($coord)) { |
@@ -389,7 +456,9 @@ discard block |
||
| 389 | 456 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 390 | 457 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 391 | 458 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 392 | - } else return array(); |
|
| 459 | + } else { |
|
| 460 | + return array(); |
|
| 461 | + } |
|
| 393 | 462 | if ($globalDBdriver == 'mysql') { |
| 394 | 463 | $query = 'SELECT marine_live.* FROM marine_live INNER JOIN (SELECT l.fammarine_id, max(l.date) as maxdate FROM marine_live l WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= l.date GROUP BY l.fammarine_id) s on marine_live.fammarine_id = s.fammarine_id AND marine_live.date = s.maxdate AND marine_live.latitude BETWEEN '.$minlat.' AND '.$maxlat.' AND marine_live.longitude BETWEEN '.$minlong.' AND '.$maxlong.' GROUP BY marine_live.fammarine_id ORDER BY date DESC'.$filter_query; |
| 395 | 464 | } else { |
@@ -410,7 +479,9 @@ discard block |
||
| 410 | 479 | { |
| 411 | 480 | global $globalDBdriver, $globalLiveInterval, $globalArchive; |
| 412 | 481 | $Marine = new Marine($this->db); |
| 413 | - if (!isset($globalLiveInterval)) $globalLiveInterval = '200'; |
|
| 482 | + if (!isset($globalLiveInterval)) { |
|
| 483 | + $globalLiveInterval = '200'; |
|
| 484 | + } |
|
| 414 | 485 | $filter_query = $this->getFilter($filter,true,true); |
| 415 | 486 | |
| 416 | 487 | if (is_array($coord)) { |
@@ -418,7 +489,9 @@ discard block |
||
| 418 | 489 | $minlat = filter_var($coord[1],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 419 | 490 | $maxlong = filter_var($coord[2],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 420 | 491 | $maxlat = filter_var($coord[3],FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 421 | - } else return array(); |
|
| 492 | + } else { |
|
| 493 | + return array(); |
|
| 494 | + } |
|
| 422 | 495 | /* |
| 423 | 496 | if ($globalDBdriver == 'mysql') { |
| 424 | 497 | $query = 'SELECT marine_live.ident, marine_live.fammarine_id,marine_live.type, marine_live.latitude, marine_live.longitude, marine_live.heading, marine_live.ground_speed, marine_live.date, marine_live.format_source |
@@ -648,11 +721,15 @@ discard block |
||
| 648 | 721 | //$query = self::$global_query.' WHERE marine_live.fammarine_id = :id ORDER BY date'; |
| 649 | 722 | if ($globalDBdriver == 'mysql') { |
| 650 | 723 | $query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id'; |
| 651 | - if ($liveinterval) $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 724 | + if ($liveinterval) { |
|
| 725 | + $query .= ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval.' SECOND) <= date'; |
|
| 726 | + } |
|
| 652 | 727 | $query .= ' ORDER BY date'; |
| 653 | 728 | } else { |
| 654 | 729 | $query = 'SELECT marine_live.* FROM marine_live WHERE marine_live.fammarine_id = :id'; |
| 655 | - if ($liveinterval) $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 730 | + if ($liveinterval) { |
|
| 731 | + $query .= " AND CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= date"; |
|
| 732 | + } |
|
| 656 | 733 | $query .= ' ORDER BY date'; |
| 657 | 734 | } |
| 658 | 735 | |
@@ -747,7 +824,9 @@ discard block |
||
| 747 | 824 | $i++; |
| 748 | 825 | $j++; |
| 749 | 826 | if ($j == 30) { |
| 750 | - if ($globalDebug) echo "."; |
|
| 827 | + if ($globalDebug) { |
|
| 828 | + echo "."; |
|
| 829 | + } |
|
| 751 | 830 | try { |
| 752 | 831 | |
| 753 | 832 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
@@ -1064,7 +1143,9 @@ discard block |
||
| 1064 | 1143 | { |
| 1065 | 1144 | return false; |
| 1066 | 1145 | } |
| 1067 | - } else return ''; |
|
| 1146 | + } else { |
|
| 1147 | + return ''; |
|
| 1148 | + } |
|
| 1068 | 1149 | |
| 1069 | 1150 | if ($longitude != '') |
| 1070 | 1151 | { |
@@ -1072,7 +1153,9 @@ discard block |
||
| 1072 | 1153 | { |
| 1073 | 1154 | return false; |
| 1074 | 1155 | } |
| 1075 | - } else return ''; |
|
| 1156 | + } else { |
|
| 1157 | + return ''; |
|
| 1158 | + } |
|
| 1076 | 1159 | |
| 1077 | 1160 | |
| 1078 | 1161 | if ($heading != '') |
@@ -1081,7 +1164,9 @@ discard block |
||
| 1081 | 1164 | { |
| 1082 | 1165 | return false; |
| 1083 | 1166 | } |
| 1084 | - } else $heading = 0; |
|
| 1167 | + } else { |
|
| 1168 | + $heading = 0; |
|
| 1169 | + } |
|
| 1085 | 1170 | |
| 1086 | 1171 | if ($groundspeed != '') |
| 1087 | 1172 | { |
@@ -1089,9 +1174,13 @@ discard block |
||
| 1089 | 1174 | { |
| 1090 | 1175 | return false; |
| 1091 | 1176 | } |
| 1092 | - } else $groundspeed = 0; |
|
| 1177 | + } else { |
|
| 1178 | + $groundspeed = 0; |
|
| 1179 | + } |
|
| 1093 | 1180 | date_default_timezone_set('UTC'); |
| 1094 | - if ($date == '') $date = date("Y-m-d H:i:s", time()); |
|
| 1181 | + if ($date == '') { |
|
| 1182 | + $date = date("Y-m-d H:i:s", time()); |
|
| 1183 | + } |
|
| 1095 | 1184 | |
| 1096 | 1185 | |
| 1097 | 1186 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -1118,19 +1207,35 @@ discard block |
||
| 1118 | 1207 | $race_id = filter_var($race_id,FILTER_SANITIZE_STRING); |
| 1119 | 1208 | $race_name = filter_var($race_name,FILTER_SANITIZE_STRING); |
| 1120 | 1209 | $race_rank = filter_var($race_rank,FILTER_SANITIZE_NUMBER_INT); |
| 1121 | - if ($race_rank == '') $race_rank = NULL; |
|
| 1210 | + if ($race_rank == '') { |
|
| 1211 | + $race_rank = NULL; |
|
| 1212 | + } |
|
| 1122 | 1213 | $race_time = filter_var($race_time,FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION); |
| 1123 | - if ($race_time == '') $race_time = NULL; |
|
| 1124 | - if ($typeid == '') $typeid = NULL; |
|
| 1125 | - if ($statusid == '') $statusid = NULL; |
|
| 1126 | - if ($distance == '') $distance = NULL; |
|
| 1214 | + if ($race_time == '') { |
|
| 1215 | + $race_time = NULL; |
|
| 1216 | + } |
|
| 1217 | + if ($typeid == '') { |
|
| 1218 | + $typeid = NULL; |
|
| 1219 | + } |
|
| 1220 | + if ($statusid == '') { |
|
| 1221 | + $statusid = NULL; |
|
| 1222 | + } |
|
| 1223 | + if ($distance == '') { |
|
| 1224 | + $distance = NULL; |
|
| 1225 | + } |
|
| 1127 | 1226 | |
| 1128 | 1227 | //if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
| 1129 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
| 1130 | - if ($arrival_date == '') $arrival_date = NULL; |
|
| 1228 | + if ($heading == '' || $Common->isInteger($heading) === false ) { |
|
| 1229 | + $heading = 0; |
|
| 1230 | + } |
|
| 1231 | + if ($arrival_date == '') { |
|
| 1232 | + $arrival_date = NULL; |
|
| 1233 | + } |
|
| 1131 | 1234 | $query = ''; |
| 1132 | 1235 | if ($globalArchive) { |
| 1133 | - if ($globalDebug) echo '-- Delete previous data -- '; |
|
| 1236 | + if ($globalDebug) { |
|
| 1237 | + echo '-- Delete previous data -- '; |
|
| 1238 | + } |
|
| 1134 | 1239 | $query .= 'DELETE FROM marine_live WHERE fammarine_id = :fammarine_id;'; |
| 1135 | 1240 | } |
| 1136 | 1241 | $query .= 'INSERT INTO marine_live (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, over_country, mmsi, type,type_id,status,status_id,imo,arrival_port_name,arrival_port_date,captain_id,captain_name,race_id,race_name,distance,race_rank,race_time) |
@@ -1145,10 +1250,14 @@ discard block |
||
| 1145 | 1250 | } |
| 1146 | 1251 | |
| 1147 | 1252 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
| 1148 | - if ($globalDebug) echo '(Add to Marine archive : '; |
|
| 1253 | + if ($globalDebug) { |
|
| 1254 | + echo '(Add to Marine archive : '; |
|
| 1255 | + } |
|
| 1149 | 1256 | $MarineArchive = new MarineArchive($this->db); |
| 1150 | 1257 | $result = $MarineArchive->addMarineArchiveData($fammarine_id, $ident, $latitude, $longitude, $heading, $groundspeed, $date, $putinarchive, $mmsi,$type,$typeid,$imo, $callsign,$arrival_code,$arrival_date,$status,$statusid,$noarchive,$format_source, $source_name, $over_country,$captain_id,$captain_name,$race_id,$race_name,$distance,$race_rank,$race_time); |
| 1151 | - if ($globalDebug) echo $result.')'; |
|
| 1258 | + if ($globalDebug) { |
|
| 1259 | + echo $result.')'; |
|
| 1260 | + } |
|
| 1152 | 1261 | } |
| 1153 | 1262 | return "success"; |
| 1154 | 1263 | } |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | require_once('require/class.Language.php'); |
| 5 | 5 | require_once('require/class.Satellite.php'); |
| 6 | 6 | |
| 7 | -$trackident = filter_input(INPUT_GET,'trackid',FILTER_SANITIZE_STRING); |
|
| 7 | +$trackident = filter_input(INPUT_GET, 'trackid', FILTER_SANITIZE_STRING); |
|
| 8 | 8 | if ($trackident != '') { |
| 9 | 9 | require_once('require/class.SpotterLive.php'); |
| 10 | 10 | $SpotterLive = new SpotterLive(); |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | $spotterid = $Spotter->getSpotterIDBasedOnFlightAwareID($trackident); |
| 15 | 15 | header('Location: '.$globalURL.'/flightid/'.$spotterid); |
| 16 | 16 | } else { |
| 17 | - setcookie('MapTrack',$resulttrackident[0]['flightaware_id']); |
|
| 17 | + setcookie('MapTrack', $resulttrackident[0]['flightaware_id']); |
|
| 18 | 18 | } |
| 19 | 19 | /* |
| 20 | 20 | } else { |
@@ -23,9 +23,9 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | -$raceid = filter_input(INPUT_GET,'raceid',FILTER_SANITIZE_NUMBER_INT); |
|
| 26 | +$raceid = filter_input(INPUT_GET, 'raceid', FILTER_SANITIZE_NUMBER_INT); |
|
| 27 | 27 | if ($raceid != '') { |
| 28 | - setcookie('filter_race',$raceid); |
|
| 28 | + setcookie('filter_race', $raceid); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | $title = _("Home"); |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | <div class="form-group"> |
| 261 | 261 | <label><?php echo _("From:"); ?></label> |
| 262 | 262 | <div class='input-group date' id='datetimepicker1'> |
| 263 | - <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required /> |
|
| 263 | + <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i", $_COOKIE['archive_begin']).' UTC'; ?>" required /> |
|
| 264 | 264 | <span class="input-group-addon"> |
| 265 | 265 | <span class="glyphicon glyphicon-calendar"></span> |
| 266 | 266 | </span> |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | <div class="form-group"> |
| 270 | 270 | <label><?php echo _("To:"); ?></label> |
| 271 | 271 | <div class='input-group date' id='datetimepicker2'> |
| 272 | - <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" /> |
|
| 272 | + <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i", $_COOKIE['archive_end']).' UTC'; ?>" /> |
|
| 273 | 273 | <span class="input-group-addon"> |
| 274 | 274 | <span class="glyphicon glyphicon-calendar"></span> |
| 275 | 275 | </span> |
@@ -439,9 +439,9 @@ discard block |
||
| 439 | 439 | <select class="selectpicker" onchange="terrainType(this);"> |
| 440 | 440 | <option value="world"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'world') print ' selected'; ?>>world terrain</option> |
| 441 | 441 | <option value="stk"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
| 442 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
| 443 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
| 444 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
| 442 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected'; ?>>ellipsoid</option> |
|
| 443 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected'; ?>>vr terrain</option> |
|
| 444 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected'; ?>>ArticDEM</option> |
|
| 445 | 445 | </select> |
| 446 | 446 | </li> |
| 447 | 447 | <?php |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li> |
| 512 | 512 | <?php |
| 513 | 513 | } |
| 514 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
| 514 | + if (time() > mktime(0, 0, 0, 12, 1, date("Y")) && time() < mktime(0, 0, 0, 12, 31, date("Y"))) { |
|
| 515 | 515 | ?> |
| 516 | 516 | <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li> |
| 517 | 517 | <?php |
@@ -707,10 +707,10 @@ discard block |
||
| 707 | 707 | $Spotter = new Spotter(); |
| 708 | 708 | $allairlinenames = $Spotter->getAllAirlineNames(); |
| 709 | 709 | } |
| 710 | - foreach($allairlinenames as $airline) { |
|
| 710 | + foreach ($allairlinenames as $airline) { |
|
| 711 | 711 | $airline_name = $airline['airline_name']; |
| 712 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
| 713 | - if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
|
| 712 | + if (strlen($airline_name) > 30) $airline_name = substr($airline_name, 0, 30).'...'; |
|
| 713 | + if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'], explode(',', $_COOKIE['filter_Airlines']))) { |
|
| 714 | 714 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
| 715 | 715 | } else { |
| 716 | 716 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
@@ -729,7 +729,7 @@ discard block |
||
| 729 | 729 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
| 730 | 730 | <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
| 731 | 731 | <?php |
| 732 | - foreach($allalliancenames as $alliance) { |
|
| 732 | + foreach ($allalliancenames as $alliance) { |
|
| 733 | 733 | $alliance_name = $alliance['alliance']; |
| 734 | 734 | if (isset($_COOKIE['filter_alliance']) && $_COOKIE['filter_alliance'] == $alliance_name) { |
| 735 | 735 | echo '<option value="'.$alliance_name.'" selected>'.$alliance_name.'</option>'; |
@@ -765,8 +765,8 @@ discard block |
||
| 765 | 765 | */ |
| 766 | 766 | $Source = new Source(); |
| 767 | 767 | $datasource = $Source->getLocationInfoByType('gs'); |
| 768 | - foreach($datasource as $src) { |
|
| 769 | - if (isset($_COOKIE['filter_Sources']) && in_array($src['name'],explode(',',$_COOKIE['filter_Sources']))) { |
|
| 768 | + foreach ($datasource as $src) { |
|
| 769 | + if (isset($_COOKIE['filter_Sources']) && in_array($src['name'], explode(',', $_COOKIE['filter_Sources']))) { |
|
| 770 | 770 | echo '<option value="'.$src['name'].'" selected>'.$src['name'].'</option>'; |
| 771 | 771 | } else { |
| 772 | 772 | echo '<option value="'.$src['name'].'">'.$src['name'].'</option>'; |
@@ -878,7 +878,7 @@ discard block |
||
| 878 | 878 | else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
| 879 | 879 | else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
| 880 | 880 | |
| 881 | - if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
|
| 881 | + if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'], explode(',', $_COOKIE['sattypes']))) { |
|
| 882 | 882 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
| 883 | 883 | } else { |
| 884 | 884 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | <?php }; if (isset($globalSatellite) && $globalSatellite) { ?><td><div id="ibxsatellite"><h4><?php echo _("Satellites Displayed"); ?></h4><br /><i class="fa fa-spinner fa-pulse fa-fw"></i></div></td><?php } ?> |
| 56 | 56 | </tr></table></div> |
| 57 | 57 | <?php |
| 58 | - if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
| 58 | + if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
|
| 59 | 59 | ?> |
| 60 | 60 | <script type="text/javascript" src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script> |
| 61 | 61 | <script type="text/javascript" src="<?php echo $globalURL; ?>/js/meuusjs.1.0.3.min.js"></script> |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | <script type="text/javascript" src="<?php echo $globalURL; ?>/js/map-marine.3d.js.php"></script> |
| 82 | 82 | <?php |
| 83 | 83 | } |
| 84 | - } |
|
| 84 | + } |
|
| 85 | 85 | ?> |
| 86 | 86 | |
| 87 | 87 | <div id="sidebar" class="sidebar collapsed"> |
@@ -92,13 +92,13 @@ discard block |
||
| 92 | 92 | <li><a href="" onclick="getUserLocation(); return false;" title="<?php echo _("Plot your Location"); ?>"><i class="fa fa-map-marker"></i></a></li> |
| 93 | 93 | <li><a href="" onclick="getCompassDirection(); return false;" title="<?php echo _("Compass Mode"); ?>"><i class="fa fa-compass"></i></a></li> |
| 94 | 94 | <?php |
| 95 | - //if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) { |
|
| 95 | + //if ((isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') || (isset($globalBeta) && $globalBeta === TRUE)) { |
|
| 96 | 96 | if (isset($globalArchive) && $globalArchive == TRUE && (!isset($globalAircraft) || $globalAircraft === TRUE)) { |
| 97 | 97 | ?> |
| 98 | 98 | <li><a href="#archive" role="tab" title="<?php echo _("Archive"); ?>"><i class="fa fa-archive"></i></a></li> |
| 99 | 99 | <?php |
| 100 | 100 | } |
| 101 | - //} |
|
| 101 | + //} |
|
| 102 | 102 | ?> |
| 103 | 103 | <li><a href="#home" role="tab" title="<?php echo _("Layers"); ?>"><i class="fa fa-map"></i></a></li> |
| 104 | 104 | <li><a href="#filters" role="tab" title="<?php echo _("Filters"); ?>"><i class="fa fa-filter"></i></a></li> |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | ?> |
| 113 | 113 | |
| 114 | 114 | <?php |
| 115 | - if (isset($globalMap3D) && $globalMap3D) { |
|
| 115 | + if (isset($globalMap3D) && $globalMap3D) { |
|
| 116 | 116 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
| 117 | 117 | ?> |
| 118 | 118 | <li><a href="" onclick="show3D(); return false;" role="tab" title="3D"><b>3D</b></a></li> |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | <li><a href="" onclick="show2D(); return false;" role="tab" title="2D"><b>2D</b></a></li> |
| 123 | 123 | <?php |
| 124 | 124 | } |
| 125 | - } |
|
| 125 | + } |
|
| 126 | 126 | ?> |
| 127 | 127 | </ul> |
| 128 | 128 | |
@@ -306,15 +306,15 @@ discard block |
||
| 306 | 306 | </div> |
| 307 | 307 | </li> |
| 308 | 308 | <?php |
| 309 | - if (isset($globalDemo) && $globalDemo) { |
|
| 309 | + if (isset($globalDemo) && $globalDemo) { |
|
| 310 | 310 | ?> |
| 311 | 311 | <li><button type="button" class="btn btn-primary disabled"><?php echo _("Show archive"); ?></button> Disabled in Demo mode</li> |
| 312 | 312 | <?php |
| 313 | - } else { |
|
| 313 | + } else { |
|
| 314 | 314 | ?> |
| 315 | 315 | <li><button type="button" onclick="addarchive(begindate,enddate);" class="btn btn-primary"><?php echo _("Show archive"); ?></button></li> |
| 316 | 316 | <?php |
| 317 | - } |
|
| 317 | + } |
|
| 318 | 318 | ?> |
| 319 | 319 | </ul> |
| 320 | 320 | <ul> |
@@ -333,82 +333,82 @@ discard block |
||
| 333 | 333 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
| 334 | 334 | if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
| 335 | 335 | else $MapType = $_COOKIE['MapType']; |
| 336 | - ?> |
|
| 336 | + ?> |
|
| 337 | 337 | <select class="selectpicker" onchange="mapType(this);"> |
| 338 | 338 | <?php |
| 339 | 339 | } else { |
| 340 | 340 | if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider; |
| 341 | 341 | else $MapType = $_COOKIE['MapType3D']; |
| 342 | - ?> |
|
| 342 | + ?> |
|
| 343 | 343 | <select class="selectpicker" onchange="mapType3D(this);"> |
| 344 | 344 | <?php |
| 345 | 345 | } |
| 346 | - ?> |
|
| 346 | + ?> |
|
| 347 | 347 | <?php |
| 348 | 348 | if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
| 349 | - ?> |
|
| 349 | + ?> |
|
| 350 | 350 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
| 351 | 351 | <?php |
| 352 | 352 | } else { |
| 353 | - if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
|
| 354 | - ?> |
|
| 353 | + if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
|
| 354 | + ?> |
|
| 355 | 355 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
| 356 | 356 | <?php |
| 357 | - } |
|
| 358 | - ?> |
|
| 357 | + } |
|
| 358 | + ?> |
|
| 359 | 359 | <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option> |
| 360 | 360 | <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option> |
| 361 | 361 | <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option> |
| 362 | 362 | <?php |
| 363 | - if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
|
| 364 | - ?> |
|
| 363 | + if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
|
| 364 | + ?> |
|
| 365 | 365 | <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
| 366 | 366 | <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
| 367 | 367 | <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
| 368 | 368 | <?php |
| 369 | - } |
|
| 370 | - ?> |
|
| 369 | + } |
|
| 370 | + ?> |
|
| 371 | 371 | <?php |
| 372 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 373 | - ?> |
|
| 372 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 373 | + ?> |
|
| 374 | 374 | <?php |
| 375 | 375 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
| 376 | - ?> |
|
| 376 | + ?> |
|
| 377 | 377 | <option value="Here-Aerial"<?php if ($MapType == 'Here-Aerial') print ' selected'; ?>>Here-Aerial</option> |
| 378 | 378 | <option value="Here-Hybrid"<?php if ($MapType == 'Here-Hybrid') print ' selected'; ?>>Here-Hybrid</option> |
| 379 | 379 | <option value="Here-Road"<?php if ($MapType == 'Here-Road') print ' selected'; ?>>Here-Road</option> |
| 380 | 380 | <?php |
| 381 | 381 | } |
| 382 | - ?> |
|
| 382 | + ?> |
|
| 383 | 383 | <?php |
| 384 | 384 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
| 385 | - ?> |
|
| 385 | + ?> |
|
| 386 | 386 | <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
| 387 | 387 | <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
| 388 | 388 | <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
| 389 | 389 | <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
| 390 | 390 | <?php |
| 391 | 391 | } |
| 392 | - ?> |
|
| 392 | + ?> |
|
| 393 | 393 | <?php |
| 394 | 394 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
| 395 | - ?> |
|
| 395 | + ?> |
|
| 396 | 396 | <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
| 397 | 397 | <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
| 398 | 398 | <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
| 399 | 399 | <?php |
| 400 | 400 | } |
| 401 | - ?> |
|
| 401 | + ?> |
|
| 402 | 402 | <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option> |
| 403 | 403 | <?php |
| 404 | - } |
|
| 405 | - ?> |
|
| 404 | + } |
|
| 405 | + ?> |
|
| 406 | 406 | <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option> |
| 407 | 407 | <?php |
| 408 | - if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
| 408 | + if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
|
| 409 | 409 | if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
| 410 | 410 | else $MapBoxId = $_COOKIE['MapTypeId']; |
| 411 | - ?> |
|
| 411 | + ?> |
|
| 412 | 412 | <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option> |
| 413 | 413 | <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
| 414 | 414 | <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
@@ -423,17 +423,17 @@ discard block |
||
| 423 | 423 | <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
| 424 | 424 | <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
| 425 | 425 | <?php |
| 426 | - } |
|
| 427 | - ?> |
|
| 426 | + } |
|
| 427 | + ?> |
|
| 428 | 428 | <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
| 429 | 429 | <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
| 430 | 430 | <?php |
| 431 | 431 | } |
| 432 | - ?> |
|
| 432 | + ?> |
|
| 433 | 433 | </select> |
| 434 | 434 | </li> |
| 435 | 435 | <?php |
| 436 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) { |
|
| 436 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d' && (!isset($globalMapOffline) || $globalMapOffline === FALSE)) { |
|
| 437 | 437 | ?> |
| 438 | 438 | <li><?php echo _("Type of Terrain:"); ?> |
| 439 | 439 | <select class="selectpicker" onchange="terrainType(this);"> |
@@ -445,18 +445,18 @@ discard block |
||
| 445 | 445 | </select> |
| 446 | 446 | </li> |
| 447 | 447 | <?php |
| 448 | - } |
|
| 448 | + } |
|
| 449 | 449 | ?> |
| 450 | 450 | |
| 451 | 451 | <?php |
| 452 | - if (isset($globalMap3D) && $globalMap3D) { |
|
| 452 | + if (isset($globalMap3D) && $globalMap3D) { |
|
| 453 | 453 | ?> |
| 454 | 454 | <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li> |
| 455 | 455 | <?php |
| 456 | - } |
|
| 456 | + } |
|
| 457 | 457 | ?> |
| 458 | 458 | <?php |
| 459 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
| 459 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
| 460 | 460 | ?> |
| 461 | 461 | <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
| 462 | 462 | |
@@ -479,12 +479,12 @@ discard block |
||
| 479 | 479 | <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
| 480 | 480 | <?php |
| 481 | 481 | } |
| 482 | - } |
|
| 483 | - if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
| 482 | + } |
|
| 483 | + if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
| 484 | 484 | ?> |
| 485 | 485 | <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
| 486 | 486 | <?php |
| 487 | - } |
|
| 487 | + } |
|
| 488 | 488 | ?> |
| 489 | 489 | <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
| 490 | 490 | <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
@@ -503,88 +503,88 @@ discard block |
||
| 503 | 503 | ?> |
| 504 | 504 | <li><div class="checkbox"><label><input type="checkbox" name="truelight" value="1" onclick="clickTrueLight(this)" <?php if ((!isset($_COOKIE['truelight']) && (!isset($globalMapTrueLight) || $globalMapTrueLight)) || (isset($_COOKIE['truelight']) && $_COOKIE['truelight'] == 'true')) print 'checked'; ?> ><?php echo _("Enable globe sun lighting"); ?></label></div></li> |
| 505 | 505 | <?php |
| 506 | - if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 506 | + if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
|
| 507 | 507 | ?> |
| 508 | 508 | <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li> |
| 509 | 509 | <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li> |
| 510 | 510 | <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li> |
| 511 | 511 | <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li> |
| 512 | 512 | <?php |
| 513 | - } |
|
| 514 | - if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
| 513 | + } |
|
| 514 | + if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
|
| 515 | 515 | ?> |
| 516 | 516 | <li><div class="checkbox"><label><input type="checkbox" name="displaysanta" value="1" onclick="clickSanta(this)"><i class="fa fa-snowflake-o" aria-hidden="true"></i> <?php echo _("Show Santa Claus now"); ?> <i class="fa fa-snowflake-o" aria-hidden="true"></i></label></div></li> |
| 517 | 517 | <?php |
| 518 | - } |
|
| 518 | + } |
|
| 519 | 519 | ?> |
| 520 | 520 | <?php |
| 521 | 521 | if (function_exists('array_column')) { |
| 522 | - if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
| 523 | - ?> |
|
| 522 | + if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
|
| 523 | + ?> |
|
| 524 | 524 | <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
| 525 | 525 | <?php |
| 526 | - } |
|
| 526 | + } |
|
| 527 | 527 | } elseif (isset($globalSources)) { |
| 528 | - $dispolar = false; |
|
| 529 | - foreach ($globalSources as $testsource) { |
|
| 530 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
| 531 | - } |
|
| 532 | - if ($dispolar) { |
|
| 533 | - ?> |
|
| 528 | + $dispolar = false; |
|
| 529 | + foreach ($globalSources as $testsource) { |
|
| 530 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
| 531 | + } |
|
| 532 | + if ($dispolar) { |
|
| 533 | + ?> |
|
| 534 | 534 | <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
| 535 | 535 | <?php |
| 536 | - } |
|
| 537 | - } |
|
| 538 | - ?> |
|
| 536 | + } |
|
| 537 | + } |
|
| 538 | + ?> |
|
| 539 | 539 | <?php |
| 540 | - if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
| 540 | + if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
|
| 541 | 541 | ?> |
| 542 | 542 | <?php |
| 543 | 543 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
| 544 | - ?> |
|
| 544 | + ?> |
|
| 545 | 545 | <li><?php echo _("Max number of flights to display in 2D:"); ?> <input type="number" name="2dlimit" value="<?php if (isset($_COOKIE['map_2d_limit'])) print $_COOKIE['map_2d_limit']; elseif (isset($globalMap2DAircraftsLimit)) print $globalMap2DAircraftsLimit; else print 15000; ?>" onchange="map2dlimit(this.value);" /></li> |
| 546 | 546 | <?php |
| 547 | 547 | } |
| 548 | - ?> |
|
| 548 | + ?> |
|
| 549 | 549 | <?php |
| 550 | 550 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
| 551 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
| 552 | - ?> |
|
| 551 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
| 552 | + ?> |
|
| 553 | 553 | <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
| 554 | 554 | <?php |
| 555 | 555 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
| 556 | - ?> |
|
| 556 | + ?> |
|
| 557 | 557 | <li><?php echo _("Aircraft icon color:"); ?> <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(this.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li> |
| 558 | 558 | <?php |
| 559 | 559 | } |
| 560 | - } |
|
| 561 | - } |
|
| 562 | - ?> |
|
| 560 | + } |
|
| 561 | + } |
|
| 562 | + ?> |
|
| 563 | 563 | <?php |
| 564 | 564 | if (isset($globalMarine) && $globalMarine === TRUE) { |
| 565 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
| 566 | - ?> |
|
| 565 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
| 566 | + ?> |
|
| 567 | 567 | <li><?php echo _("Marine icon color:"); ?> |
| 568 | 568 | <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>"> |
| 569 | 569 | </li> |
| 570 | 570 | <?php |
| 571 | - } |
|
| 572 | - } |
|
| 573 | - ?> |
|
| 571 | + } |
|
| 572 | + } |
|
| 573 | + ?> |
|
| 574 | 574 | <?php |
| 575 | 575 | if (isset($globalTracker) && $globalTracker === TRUE) { |
| 576 | - if (extension_loaded('gd') && function_exists('gd_info')) { |
|
| 577 | - ?> |
|
| 576 | + if (extension_loaded('gd') && function_exists('gd_info')) { |
|
| 577 | + ?> |
|
| 578 | 578 | <li><?php echo _("Tracker icon color:"); ?> |
| 579 | 579 | <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>"> |
| 580 | 580 | </li> |
| 581 | 581 | <?php |
| 582 | - } |
|
| 583 | - } |
|
| 584 | - ?> |
|
| 582 | + } |
|
| 583 | + } |
|
| 584 | + ?> |
|
| 585 | 585 | <?php |
| 586 | 586 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
| 587 | - ?> |
|
| 587 | + ?> |
|
| 588 | 588 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
| 589 | 589 | <div class="range"> |
| 590 | 590 | <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>"> |
@@ -593,9 +593,9 @@ discard block |
||
| 593 | 593 | </li> |
| 594 | 594 | <?php |
| 595 | 595 | } |
| 596 | - ?> |
|
| 596 | + ?> |
|
| 597 | 597 | <?php |
| 598 | - } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') { |
|
| 598 | + } elseif (isset($_COOKIE['MapFormat']) || $_COOKIE['MapFOrmat'] == '3d') { |
|
| 599 | 599 | ?> |
| 600 | 600 | <li><?php echo _("Set scaling factor for rendering resolution:"); ?> |
| 601 | 601 | <div class="range"> |
@@ -634,7 +634,7 @@ discard block |
||
| 634 | 634 | </li> |
| 635 | 635 | <?php |
| 636 | 636 | } |
| 637 | - } |
|
| 637 | + } |
|
| 638 | 638 | ?> |
| 639 | 639 | <li><?php echo _("Distance unit:"); ?> |
| 640 | 640 | <select class="selectpicker" onchange="unitdistance(this);"> |
@@ -674,19 +674,19 @@ discard block |
||
| 674 | 674 | <ul> |
| 675 | 675 | <?php |
| 676 | 676 | if (!isset($globalAircraft) || $globalAircraft) { |
| 677 | - ?> |
|
| 677 | + ?> |
|
| 678 | 678 | <?php |
| 679 | 679 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
| 680 | - ?> |
|
| 680 | + ?> |
|
| 681 | 681 | <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
| 682 | 682 | <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
| 683 | 683 | <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
| 684 | 684 | <?php |
| 685 | 685 | } |
| 686 | - ?> |
|
| 686 | + ?> |
|
| 687 | 687 | <?php |
| 688 | 688 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
| 689 | - ?> |
|
| 689 | + ?> |
|
| 690 | 690 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
| 691 | 691 | <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
| 692 | 692 | <?php } ?> |
@@ -696,7 +696,7 @@ discard block |
||
| 696 | 696 | <li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') print 'checked'; ?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li> |
| 697 | 697 | <?php |
| 698 | 698 | } |
| 699 | - ?> |
|
| 699 | + ?> |
|
| 700 | 700 | <li><?php echo _("Display airlines:"); ?> |
| 701 | 701 | <br/> |
| 702 | 702 | <select class="selectpicker" multiple onchange="airlines(this);" id="display_airlines"> |
@@ -716,14 +716,14 @@ discard block |
||
| 716 | 716 | echo '<option value="'.$airline['airline_icao'].'">'.$airline_name.'</option>'; |
| 717 | 717 | } |
| 718 | 718 | } |
| 719 | - ?> |
|
| 719 | + ?> |
|
| 720 | 720 | </select> |
| 721 | 721 | </li> |
| 722 | 722 | <?php |
| 723 | 723 | $Spotter = new Spotter(); |
| 724 | 724 | $allalliancenames = $Spotter->getAllAllianceNames(); |
| 725 | 725 | if (!empty($allalliancenames)) { |
| 726 | - ?> |
|
| 726 | + ?> |
|
| 727 | 727 | <li><?php echo _("Display alliance:"); ?> |
| 728 | 728 | <br/> |
| 729 | 729 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
@@ -737,18 +737,18 @@ discard block |
||
| 737 | 737 | echo '<option value="'.$alliance_name.'">'.$alliance_name.'</option>'; |
| 738 | 738 | } |
| 739 | 739 | } |
| 740 | - ?> |
|
| 740 | + ?> |
|
| 741 | 741 | </select> |
| 742 | 742 | </li> |
| 743 | 743 | <?php |
| 744 | 744 | } |
| 745 | - ?> |
|
| 745 | + ?> |
|
| 746 | 746 | <?php |
| 747 | 747 | } |
| 748 | - ?> |
|
| 748 | + ?> |
|
| 749 | 749 | <?php |
| 750 | 750 | if (isset($globalAPRS) && $globalAPRS) { |
| 751 | - ?> |
|
| 751 | + ?> |
|
| 752 | 752 | <li><?php echo _("Display APRS sources name:"); ?> |
| 753 | 753 | <select class="selectpicker" multiple onchange="sources(this);"> |
| 754 | 754 | <?php |
@@ -772,18 +772,18 @@ discard block |
||
| 772 | 772 | echo '<option value="'.$src['name'].'">'.$src['name'].'</option>'; |
| 773 | 773 | } |
| 774 | 774 | } |
| 775 | - ?> |
|
| 775 | + ?> |
|
| 776 | 776 | </select> |
| 777 | 777 | </li> |
| 778 | 778 | <?php |
| 779 | 779 | } |
| 780 | - ?> |
|
| 780 | + ?> |
|
| 781 | 781 | <?php |
| 782 | 782 | if (!isset($globalAircraft) || $globalAircraft) { |
| 783 | - ?> |
|
| 783 | + ?> |
|
| 784 | 784 | <?php |
| 785 | - if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
|
| 786 | - ?> |
|
| 785 | + if (!(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS)) { |
|
| 786 | + ?> |
|
| 787 | 787 | <li><?php echo _("Display airlines of type:"); ?><br/> |
| 788 | 788 | <select class="selectpicker" onchange="airlinestype(this);"> |
| 789 | 789 | <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
@@ -793,14 +793,14 @@ discard block |
||
| 793 | 793 | </select> |
| 794 | 794 | </li> |
| 795 | 795 | <?php |
| 796 | - } |
|
| 797 | - ?> |
|
| 796 | + } |
|
| 797 | + ?> |
|
| 798 | 798 | <?php |
| 799 | 799 | } |
| 800 | - ?> |
|
| 800 | + ?> |
|
| 801 | 801 | <?php |
| 802 | 802 | if (isset($globalMarine) && $globalMarine) { |
| 803 | - ?> |
|
| 803 | + ?> |
|
| 804 | 804 | <li> |
| 805 | 805 | <?php echo _("Display vessels with MMSI:"); ?> |
| 806 | 806 | <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" /> |
@@ -823,7 +823,7 @@ discard block |
||
| 823 | 823 | print '<option value="'.$race['race_id'].'">'.$race['race_name'].'</option>'; |
| 824 | 824 | } |
| 825 | 825 | } |
| 826 | - ?> |
|
| 826 | + ?> |
|
| 827 | 827 | </select> |
| 828 | 828 | </li> |
| 829 | 829 | |
@@ -831,7 +831,7 @@ discard block |
||
| 831 | 831 | } |
| 832 | 832 | } |
| 833 | 833 | } |
| 834 | - ?> |
|
| 834 | + ?> |
|
| 835 | 835 | <li> |
| 836 | 836 | <?php echo _("Display with ident:"); ?> |
| 837 | 837 | <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | </form> |
| 845 | 845 | </div> |
| 846 | 846 | <?php |
| 847 | - if (isset($globalSatellite) && $globalSatellite) { |
|
| 847 | + if (isset($globalSatellite) && $globalSatellite) { |
|
| 848 | 848 | ?> |
| 849 | 849 | <div class="sidebar-pane" id="satellites"> |
| 850 | 850 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
@@ -884,14 +884,14 @@ discard block |
||
| 884 | 884 | print '<option value="'.$type['tle_type'].'">'.$type_name.'</option>'; |
| 885 | 885 | } |
| 886 | 886 | } |
| 887 | - ?> |
|
| 887 | + ?> |
|
| 888 | 888 | </select> |
| 889 | 889 | </li> |
| 890 | 890 | </ul> |
| 891 | 891 | </form> |
| 892 | 892 | </div> |
| 893 | 893 | <?php |
| 894 | - } |
|
| 894 | + } |
|
| 895 | 895 | ?> |
| 896 | 896 | </div> |
| 897 | 897 | </div> |
@@ -57,7 +57,10 @@ discard block |
||
| 57 | 57 | <?php |
| 58 | 58 | if ((!isset($_COOKIE['MapFormat']) && isset($globalMap3Ddefault) && $globalMap3Ddefault) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d')) { |
| 59 | 59 | ?> |
| 60 | -<script type="text/javascript" src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) print '?tsk='.$tsk; ?>"></script> |
|
| 60 | +<script type="text/javascript" src="<?php echo $globalURL; ?>/js/map.3d.js.php<?php if (isset($tsk)) { |
|
| 61 | + print '?tsk='.$tsk; |
|
| 62 | +} |
|
| 63 | +?>"></script> |
|
| 61 | 64 | <script type="text/javascript" src="<?php echo $globalURL; ?>/js/meuusjs.1.0.3.min.js"></script> |
| 62 | 65 | <script type="text/javascript" src="<?php echo $globalURL; ?>/js/map.3d.weather.js"></script> |
| 63 | 66 | <?php |
@@ -137,10 +140,22 @@ discard block |
||
| 137 | 140 | <h1>Weather</h1> |
| 138 | 141 | <ul> |
| 139 | 142 | |
| 140 | - <li><div class="checkbox"><label><input type="checkbox" name="wind" value="1" onclick="clickWind(this);" <?php if (isset($_COOKIE['weather_wind']) && $_COOKIE['weather_wind'] == 'true') print 'checked'; ?> /><?php echo _("Weather Winds"); ?></label></div></li> |
|
| 141 | - <li><div class="checkbox"><label><input type="checkbox" name="wave" value="1" onclick="clickWave(this);" <?php if (isset($_COOKIE['weather_wave']) && $_COOKIE['weather_wave'] == 'true') print 'checked'; ?> /><?php echo _("Ocean surface currents"); ?></label></div></li> |
|
| 142 | - <li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') print 'checked'; ?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li> |
|
| 143 | - <!-- <li><div class="checkbox"><label><input type="checkbox" name="backwave" value="1" onclick="clickBackWave(this);" <?php if (isset($_COOKIE['weather_backwave']) && $_COOKIE['weather_backwave'] == 'true') print 'checked'; ?> /><?php echo _("Weather Waves height background"); ?></label></div></li> --> |
|
| 143 | + <li><div class="checkbox"><label><input type="checkbox" name="wind" value="1" onclick="clickWind(this);" <?php if (isset($_COOKIE['weather_wind']) && $_COOKIE['weather_wind'] == 'true') { |
|
| 144 | + print 'checked'; |
|
| 145 | +} |
|
| 146 | +?> /><?php echo _("Weather Winds"); ?></label></div></li> |
|
| 147 | + <li><div class="checkbox"><label><input type="checkbox" name="wave" value="1" onclick="clickWave(this);" <?php if (isset($_COOKIE['weather_wave']) && $_COOKIE['weather_wave'] == 'true') { |
|
| 148 | + print 'checked'; |
|
| 149 | +} |
|
| 150 | +?> /><?php echo _("Ocean surface currents"); ?></label></div></li> |
|
| 151 | + <li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') { |
|
| 152 | + print 'checked'; |
|
| 153 | +} |
|
| 154 | +?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li> |
|
| 155 | + <!-- <li><div class="checkbox"><label><input type="checkbox" name="backwave" value="1" onclick="clickBackWave(this);" <?php if (isset($_COOKIE['weather_backwave']) && $_COOKIE['weather_backwave'] == 'true') { |
|
| 156 | + print 'checked'; |
|
| 157 | +} |
|
| 158 | +?> /><?php echo _("Weather Waves height background"); ?></label></div></li> --> |
|
| 144 | 159 | |
| 145 | 160 | <?php |
| 146 | 161 | if (isset($globalOpenWeatherMapKey) && $globalOpenWeatherMapKey != '') { |
@@ -162,12 +177,18 @@ discard block |
||
| 162 | 177 | <?php |
| 163 | 178 | if (isset($globalMETAR) && isset($globalMETARcycle) && $globalMETAR && $globalMETARcycle) { |
| 164 | 179 | ?> |
| 165 | - <li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) print 'checked'; ?> ><?php echo _("Display 3D weather"); ?></label></div></li> |
|
| 180 | + <li><div class="checkbox"><label><input type="checkbox" name="displayweather" value="1" onclick="clickDisplayWeather(this)" <?php if ((isset($_COOKIE['show_Weather']) && $_COOKIE['show_Weather'] == 'true') || (!isset($_COOKIE['show_Weather']) && (isset($globalMapWeather) && $globalMapWeather === TRUE))) { |
|
| 181 | + print 'checked'; |
|
| 182 | +} |
|
| 183 | +?> ><?php echo _("Display 3D weather"); ?></label></div></li> |
|
| 166 | 184 | <!-- <li><div class="checkbox"><label><input type="checkbox" name="displayrain" value="1" onclick="clickDisplayRain(this)" ><?php echo _("Display rain on 3D map"); ?></label></div></li>--> |
| 167 | 185 | <?php |
| 168 | 186 | } |
| 169 | 187 | ?> |
| 170 | - <li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') print 'checked'; ?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li> |
|
| 188 | + <li><div class="checkbox"><label><input type="checkbox" name="fire" value="1" onclick="clickFire(this);" <?php if (isset($_COOKIE['weather_fire']) && $_COOKIE['weather_fire'] == 'true') { |
|
| 189 | + print 'checked'; |
|
| 190 | +} |
|
| 191 | +?> /><?php echo _("NASA Fire Hotspots"); ?></label></div></li> |
|
| 171 | 192 | </ul> |
| 172 | 193 | <?php |
| 173 | 194 | } |
@@ -183,13 +204,22 @@ discard block |
||
| 183 | 204 | <?php |
| 184 | 205 | if (!isset($globalAircraft) || $globalAircraft) { |
| 185 | 206 | ?> |
| 186 | - <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?></label></div></li> |
|
| 187 | - <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?></label></div></li> |
|
| 207 | + <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') { |
|
| 208 | + print 'checked'; |
|
| 209 | +} |
|
| 210 | +?> /><?php echo _("Display waypoints"); ?></label></div></li> |
|
| 211 | + <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') { |
|
| 212 | + print 'checked'; |
|
| 213 | +} |
|
| 214 | +?> /><?php echo _("Display airspace"); ?></label></div></li> |
|
| 188 | 215 | <?php |
| 189 | 216 | } |
| 190 | 217 | if (isset($globalMarine) && $globalMarine) { |
| 191 | 218 | ?> |
| 192 | - <li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li> |
|
| 219 | + <li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') { |
|
| 220 | + print 'checked'; |
|
| 221 | +} |
|
| 222 | +?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li> |
|
| 193 | 223 | <?php |
| 194 | 224 | } |
| 195 | 225 | ?> |
@@ -204,13 +234,22 @@ discard block |
||
| 204 | 234 | <?php |
| 205 | 235 | if (!isset($globalAircraft) || $globalAircraft) { |
| 206 | 236 | ?> |
| 207 | - <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') print 'checked'; ?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li> |
|
| 208 | - <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') print 'checked'; ?> /><?php echo _("Display airspace"); ?> Beta</label></div></li> |
|
| 237 | + <li><div class="checkbox"><label><input type="checkbox" name="waypoints" value="1" onclick="showWaypoints(this);" <?php if (isset($_COOKIE['waypoints']) && $_COOKIE['waypoints'] == 'true') { |
|
| 238 | + print 'checked'; |
|
| 239 | +} |
|
| 240 | +?> /><?php echo _("Display waypoints"); ?> Beta</label></div></li> |
|
| 241 | + <li><div class="checkbox"><label><input type="checkbox" name="airspace" value="1" onclick="showAirspace(this);" <?php if (isset($_COOKIE['airspace']) && $_COOKIE['airspace'] == 'true') { |
|
| 242 | + print 'checked'; |
|
| 243 | +} |
|
| 244 | +?> /><?php echo _("Display airspace"); ?> Beta</label></div></li> |
|
| 209 | 245 | <?php |
| 210 | 246 | } |
| 211 | 247 | if (isset($globalMarine) && $globalMarine) { |
| 212 | 248 | ?> |
| 213 | - <li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') print 'checked'; ?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li> |
|
| 249 | + <li><div class="checkbox"><label><input type="checkbox" name="openseamap" value="1" onclick="clickOpenSeaMap(this);" <?php if (isset($_COOKIE['openseamap']) && $_COOKIE['openseamap'] == 'true') { |
|
| 250 | + print 'checked'; |
|
| 251 | +} |
|
| 252 | +?> /><?php echo _("Display OpenSeaMap"); ?></label></div></li> |
|
| 214 | 253 | <?php |
| 215 | 254 | } |
| 216 | 255 | ?> |
@@ -225,14 +264,32 @@ discard block |
||
| 225 | 264 | <h1>NOTAM</h1> |
| 226 | 265 | <form> |
| 227 | 266 | <ul> |
| 228 | - <li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') print 'checked'; ?> /><?php echo _("Display NOTAM"); ?></label></div></li> |
|
| 267 | + <li><div class="checkbox"><label><input type="checkbox" name="notamcb" value="1" onclick="showNotam(this);" <?php if (isset($_COOKIE['notam']) && $_COOKIE['notam'] == 'true') { |
|
| 268 | + print 'checked'; |
|
| 269 | +} |
|
| 270 | +?> /><?php echo _("Display NOTAM"); ?></label></div></li> |
|
| 229 | 271 | <li><?php echo _("NOTAM scope:"); ?> |
| 230 | 272 | <select class="selectpicker" onchange="notamscope(this);"> |
| 231 | - <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') print ' selected'; ?>>All</option> |
|
| 232 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') print ' selected'; ?>>Airport/Enroute warning</option> |
|
| 233 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') print ' selected'; ?>>Airport warning</option> |
|
| 234 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') print ' selected'; ?>>Navigation warning</option> |
|
| 235 | - <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') print ' selected'; ?>>Enroute warning</option> |
|
| 273 | + <option<?php if (!isset($_COOKIE['notamscope']) || $_COOKIE['notamscope'] == 'All') { |
|
| 274 | + print ' selected'; |
|
| 275 | +} |
|
| 276 | +?>>All</option> |
|
| 277 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport/Enroute warning') { |
|
| 278 | + print ' selected'; |
|
| 279 | +} |
|
| 280 | +?>>Airport/Enroute warning</option> |
|
| 281 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Airport warning') { |
|
| 282 | + print ' selected'; |
|
| 283 | +} |
|
| 284 | +?>>Airport warning</option> |
|
| 285 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Navigation warning') { |
|
| 286 | + print ' selected'; |
|
| 287 | +} |
|
| 288 | +?>>Navigation warning</option> |
|
| 289 | + <option<?php if (isset($_COOKIE['notamscope']) && $_COOKIE['notamscope'] == 'Enroute warning') { |
|
| 290 | + print ' selected'; |
|
| 291 | +} |
|
| 292 | +?>>Enroute warning</option> |
|
| 236 | 293 | </select |
| 237 | 294 | </li> |
| 238 | 295 | </ul> |
@@ -260,7 +317,10 @@ discard block |
||
| 260 | 317 | <div class="form-group"> |
| 261 | 318 | <label><?php echo _("From:"); ?></label> |
| 262 | 319 | <div class='input-group date' id='datetimepicker1'> |
| 263 | - <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; ?>" required /> |
|
| 320 | + <input type='text' id="start_date" name="start_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_begin']) && $_COOKIE['archive_begin'] != '') { |
|
| 321 | + print date("Y-m-d H:i",$_COOKIE['archive_begin']).' UTC'; |
|
| 322 | +} |
|
| 323 | +?>" required /> |
|
| 264 | 324 | <span class="input-group-addon"> |
| 265 | 325 | <span class="glyphicon glyphicon-calendar"></span> |
| 266 | 326 | </span> |
@@ -269,7 +329,10 @@ discard block |
||
| 269 | 329 | <div class="form-group"> |
| 270 | 330 | <label><?php echo _("To:"); ?></label> |
| 271 | 331 | <div class='input-group date' id='datetimepicker2'> |
| 272 | - <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; ?>" /> |
|
| 332 | + <input type='text' id="end_date" name="end_date" class="form-control" autocomplete="off" value="<?php if (isset($_COOKIE['archive_end']) && $_COOKIE['archive_end'] != '') { |
|
| 333 | + print date("Y-m-d H:i",$_COOKIE['archive_end']).' UTC'; |
|
| 334 | +} |
|
| 335 | +?>" /> |
|
| 273 | 336 | <span class="input-group-addon"> |
| 274 | 337 | <span class="glyphicon glyphicon-calendar"></span> |
| 275 | 338 | </span> |
@@ -301,8 +364,20 @@ discard block |
||
| 301 | 364 | </script> |
| 302 | 365 | <li><?php echo _("Playback speed:"); ?> |
| 303 | 366 | <div class="range"> |
| 304 | - <input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) print $_POST['archivespeed']; elseif (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?>"> |
|
| 305 | - <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) print $_COOKIE['archive_speed']; else print '1'; ?></output> |
|
| 367 | + <input type="range" min="0" max="50" step="1" id="archivespeed" name="archivespeed" onChange="archivespeedrange.value=value;" value="<?php if (isset($_POST['archivespeed'])) { |
|
| 368 | + print $_POST['archivespeed']; |
|
| 369 | +} elseif (isset($_COOKIE['archive_speed'])) { |
|
| 370 | + print $_COOKIE['archive_speed']; |
|
| 371 | +} else { |
|
| 372 | + print '1'; |
|
| 373 | +} |
|
| 374 | +?>"> |
|
| 375 | + <output id="archivespeedrange"><?php if (isset($_COOKIE['archive_speed'])) { |
|
| 376 | + print $_COOKIE['archive_speed']; |
|
| 377 | +} else { |
|
| 378 | + print '1'; |
|
| 379 | +} |
|
| 380 | +?></output> |
|
| 306 | 381 | </div> |
| 307 | 382 | </li> |
| 308 | 383 | <?php |
@@ -331,14 +406,20 @@ discard block |
||
| 331 | 406 | <li><?php echo _("Type of Map:"); ?> |
| 332 | 407 | <?php |
| 333 | 408 | if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
| 334 | - if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') $MapType = $globalMapProvider; |
|
| 335 | - else $MapType = $_COOKIE['MapType']; |
|
| 409 | + if (!isset($_COOKIE['MapType']) || $_COOKIE['MapType'] == '') { |
|
| 410 | + $MapType = $globalMapProvider; |
|
| 411 | + } else { |
|
| 412 | + $MapType = $_COOKIE['MapType']; |
|
| 413 | + } |
|
| 336 | 414 | ?> |
| 337 | 415 | <select class="selectpicker" onchange="mapType(this);"> |
| 338 | 416 | <?php |
| 339 | 417 | } else { |
| 340 | - if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') $MapType = $globalMapProvider; |
|
| 341 | - else $MapType = $_COOKIE['MapType3D']; |
|
| 418 | + if (!isset($_COOKIE['MapType3D']) || $_COOKIE['MapType3D'] == '') { |
|
| 419 | + $MapType = $globalMapProvider; |
|
| 420 | + } else { |
|
| 421 | + $MapType = $_COOKIE['MapType3D']; |
|
| 422 | + } |
|
| 342 | 423 | ?> |
| 343 | 424 | <select class="selectpicker" onchange="mapType3D(this);"> |
| 344 | 425 | <?php |
@@ -347,24 +428,48 @@ discard block |
||
| 347 | 428 | <?php |
| 348 | 429 | if (isset($globalMapOffline) && $globalMapOffline === TRUE) { |
| 349 | 430 | ?> |
| 350 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
| 431 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
| 432 | + print ' selected'; |
|
| 433 | +} |
|
| 434 | +?>>Natural Earth (local)</option> |
|
| 351 | 435 | <?php |
| 352 | 436 | } else { |
| 353 | 437 | if (file_exists(dirname(__FILE__).'/js/Cesium/Assets/Textures/NaturalEarthII/tilemapresource.xml')) { |
| 354 | 438 | ?> |
| 355 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth (local)</option> |
|
| 439 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
| 440 | + print ' selected'; |
|
| 441 | +} |
|
| 442 | +?>>Natural Earth (local)</option> |
|
| 356 | 443 | <?php |
| 357 | 444 | } |
| 358 | 445 | ?> |
| 359 | - <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') print ' selected'; ?>>ArcGIS Streetmap</option> |
|
| 360 | - <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') print ' selected'; ?>>ArcGIS Satellite</option> |
|
| 361 | - <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') print ' selected'; ?>>ArcGIS Ocean</option> |
|
| 446 | + <option value="ArcGIS-Streetmap"<?php if ($MapType == 'ArcGIS-Streetmap') { |
|
| 447 | + print ' selected'; |
|
| 448 | +} |
|
| 449 | +?>>ArcGIS Streetmap</option> |
|
| 450 | + <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Satellite') { |
|
| 451 | + print ' selected'; |
|
| 452 | +} |
|
| 453 | +?>>ArcGIS Satellite</option> |
|
| 454 | + <option value="ArcGIS-Satellite"<?php if ($MapType == 'ArcGIS-Ocean') { |
|
| 455 | + print ' selected'; |
|
| 456 | +} |
|
| 457 | +?>>ArcGIS Ocean</option> |
|
| 362 | 458 | <?php |
| 363 | 459 | if (isset($globalBingMapKey) && $globalBingMapKey != '') { |
| 364 | 460 | ?> |
| 365 | - <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') print ' selected'; ?>>Bing-Aerial</option> |
|
| 366 | - <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') print ' selected'; ?>>Bing-Hybrid</option> |
|
| 367 | - <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') print ' selected'; ?>>Bing-Road</option> |
|
| 461 | + <option value="Bing-Aerial"<?php if ($MapType == 'Bing-Aerial') { |
|
| 462 | + print ' selected'; |
|
| 463 | +} |
|
| 464 | +?>>Bing-Aerial</option> |
|
| 465 | + <option value="Bing-Hybrid"<?php if ($MapType == 'Bing-Hybrid') { |
|
| 466 | + print ' selected'; |
|
| 467 | +} |
|
| 468 | +?>>Bing-Hybrid</option> |
|
| 469 | + <option value="Bing-Road"<?php if ($MapType == 'Bing-Road') { |
|
| 470 | + print ' selected'; |
|
| 471 | +} |
|
| 472 | +?>>Bing-Road</option> |
|
| 368 | 473 | <?php |
| 369 | 474 | } |
| 370 | 475 | ?> |
@@ -374,59 +479,143 @@ discard block |
||
| 374 | 479 | <?php |
| 375 | 480 | if (isset($globalHereappId) && $globalHereappId != '' && isset($globalHereappCode) && $globalHereappCode != '') { |
| 376 | 481 | ?> |
| 377 | - <option value="Here-Aerial"<?php if ($MapType == 'Here-Aerial') print ' selected'; ?>>Here-Aerial</option> |
|
| 378 | - <option value="Here-Hybrid"<?php if ($MapType == 'Here-Hybrid') print ' selected'; ?>>Here-Hybrid</option> |
|
| 379 | - <option value="Here-Road"<?php if ($MapType == 'Here-Road') print ' selected'; ?>>Here-Road</option> |
|
| 482 | + <option value="Here-Aerial"<?php if ($MapType == 'Here-Aerial') { |
|
| 483 | + print ' selected'; |
|
| 484 | +} |
|
| 485 | +?>>Here-Aerial</option> |
|
| 486 | + <option value="Here-Hybrid"<?php if ($MapType == 'Here-Hybrid') { |
|
| 487 | + print ' selected'; |
|
| 488 | +} |
|
| 489 | +?>>Here-Hybrid</option> |
|
| 490 | + <option value="Here-Road"<?php if ($MapType == 'Here-Road') { |
|
| 491 | + print ' selected'; |
|
| 492 | +} |
|
| 493 | +?>>Here-Road</option> |
|
| 380 | 494 | <?php |
| 381 | 495 | } |
| 382 | 496 | ?> |
| 383 | 497 | <?php |
| 384 | 498 | if (isset($globalGoogleAPIKey) && $globalGoogleAPIKey != '') { |
| 385 | 499 | ?> |
| 386 | - <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') print ' selected'; ?>>Google Roadmap</option> |
|
| 387 | - <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') print ' selected'; ?>>Google Satellite</option> |
|
| 388 | - <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') print ' selected'; ?>>Google Hybrid</option> |
|
| 389 | - <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') print ' selected'; ?>>Google Terrain</option> |
|
| 500 | + <option value="Google-Roadmap"<?php if ($MapType == 'Google-Roadmap') { |
|
| 501 | + print ' selected'; |
|
| 502 | +} |
|
| 503 | +?>>Google Roadmap</option> |
|
| 504 | + <option value="Google-Satellite"<?php if ($MapType == 'Google-Satellite') { |
|
| 505 | + print ' selected'; |
|
| 506 | +} |
|
| 507 | +?>>Google Satellite</option> |
|
| 508 | + <option value="Google-Hybrid"<?php if ($MapType == 'Google-Hybrid') { |
|
| 509 | + print ' selected'; |
|
| 510 | +} |
|
| 511 | +?>>Google Hybrid</option> |
|
| 512 | + <option value="Google-Terrain"<?php if ($MapType == 'Google-Terrain') { |
|
| 513 | + print ' selected'; |
|
| 514 | +} |
|
| 515 | +?>>Google Terrain</option> |
|
| 390 | 516 | <?php |
| 391 | 517 | } |
| 392 | 518 | ?> |
| 393 | 519 | <?php |
| 394 | 520 | if (isset($globalMapQuestKey) && $globalMapQuestKey != '') { |
| 395 | 521 | ?> |
| 396 | - <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') print ' selected'; ?>>MapQuest-OSM</option> |
|
| 397 | - <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') print ' selected'; ?>>MapQuest-Aerial</option> |
|
| 398 | - <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') print ' selected'; ?>>MapQuest-Hybrid</option> |
|
| 522 | + <option value="MapQuest-OSM"<?php if ($MapType == 'MapQuest-OSM') { |
|
| 523 | + print ' selected'; |
|
| 524 | +} |
|
| 525 | +?>>MapQuest-OSM</option> |
|
| 526 | + <option value="MapQuest-Aerial"<?php if ($MapType == 'MapQuest-Aerial') { |
|
| 527 | + print ' selected'; |
|
| 528 | +} |
|
| 529 | +?>>MapQuest-Aerial</option> |
|
| 530 | + <option value="MapQuest-Hybrid"<?php if ($MapType == 'MapQuest-Hybrid') { |
|
| 531 | + print ' selected'; |
|
| 532 | +} |
|
| 533 | +?>>MapQuest-Hybrid</option> |
|
| 399 | 534 | <?php |
| 400 | 535 | } |
| 401 | 536 | ?> |
| 402 | - <option value="offline"<?php if ($MapType == 'offline') print ' selected'; ?>>Natural Earth</option> |
|
| 537 | + <option value="offline"<?php if ($MapType == 'offline') { |
|
| 538 | + print ' selected'; |
|
| 539 | +} |
|
| 540 | +?>>Natural Earth</option> |
|
| 403 | 541 | <?php |
| 404 | 542 | } |
| 405 | 543 | ?> |
| 406 | - <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') print ' selected'; ?>>National Geographic Street</option> |
|
| 544 | + <option value="NatGeo-Street"<?php if ($MapType == 'NatGeo-Street') { |
|
| 545 | + print ' selected'; |
|
| 546 | +} |
|
| 547 | +?>>National Geographic Street</option> |
|
| 407 | 548 | <?php |
| 408 | 549 | if (isset($globalMapboxToken) && $globalMapboxToken != '') { |
| 409 | - if (!isset($_COOKIE['MapTypeId'])) $MapBoxId = 'default'; |
|
| 410 | - else $MapBoxId = $_COOKIE['MapTypeId']; |
|
| 550 | + if (!isset($_COOKIE['MapTypeId'])) { |
|
| 551 | + $MapBoxId = 'default'; |
|
| 552 | + } else { |
|
| 553 | + $MapBoxId = $_COOKIE['MapTypeId']; |
|
| 554 | + } |
|
| 411 | 555 | ?> |
| 412 | - <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') print ' selected'; ?>>Mapbox GL</option> |
|
| 413 | - <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') print ' selected'; ?>>Mapbox default</option> |
|
| 414 | - <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') print ' selected'; ?>>Mapbox streets</option> |
|
| 415 | - <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') print ' selected'; ?>>Mapbox light</option> |
|
| 416 | - <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') print ' selected'; ?>>Mapbox dark</option> |
|
| 417 | - <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') print ' selected'; ?>>Mapbox satellite</option> |
|
| 418 | - <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') print ' selected'; ?>>Mapbox streets-satellite</option> |
|
| 419 | - <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') print ' selected'; ?>>Mapbox streets-basic</option> |
|
| 420 | - <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') print ' selected'; ?>>Mapbox comic</option> |
|
| 421 | - <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') print ' selected'; ?>>Mapbox outdoors</option> |
|
| 422 | - <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') print ' selected'; ?>>Mapbox pencil</option> |
|
| 423 | - <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') print ' selected'; ?>>Mapbox pirates</option> |
|
| 424 | - <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') print ' selected'; ?>>Mapbox emerald</option> |
|
| 556 | + <option value="MapboxGL"<?php if ($MapType == 'MapboxGL') { |
|
| 557 | + print ' selected'; |
|
| 558 | +} |
|
| 559 | +?>>Mapbox GL</option> |
|
| 560 | + <option value="Mapbox-default"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'default') { |
|
| 561 | + print ' selected'; |
|
| 562 | +} |
|
| 563 | +?>>Mapbox default</option> |
|
| 564 | + <option value="Mapbox-mapbox.streets"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets') { |
|
| 565 | + print ' selected'; |
|
| 566 | +} |
|
| 567 | +?>>Mapbox streets</option> |
|
| 568 | + <option value="Mapbox-mapbox.light"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.light') { |
|
| 569 | + print ' selected'; |
|
| 570 | +} |
|
| 571 | +?>>Mapbox light</option> |
|
| 572 | + <option value="Mapbox-mapbox.dark"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.dark') { |
|
| 573 | + print ' selected'; |
|
| 574 | +} |
|
| 575 | +?>>Mapbox dark</option> |
|
| 576 | + <option value="Mapbox-mapbox.satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.satellite') { |
|
| 577 | + print ' selected'; |
|
| 578 | +} |
|
| 579 | +?>>Mapbox satellite</option> |
|
| 580 | + <option value="Mapbox-mapbox.streets-satellite"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-satellite') { |
|
| 581 | + print ' selected'; |
|
| 582 | +} |
|
| 583 | +?>>Mapbox streets-satellite</option> |
|
| 584 | + <option value="Mapbox-mapbox.streets-basic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.streets-basic') { |
|
| 585 | + print ' selected'; |
|
| 586 | +} |
|
| 587 | +?>>Mapbox streets-basic</option> |
|
| 588 | + <option value="Mapbox-mapbox.comic"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.comic') { |
|
| 589 | + print ' selected'; |
|
| 590 | +} |
|
| 591 | +?>>Mapbox comic</option> |
|
| 592 | + <option value="Mapbox-mapbox.outdoors"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.outdoors') { |
|
| 593 | + print ' selected'; |
|
| 594 | +} |
|
| 595 | +?>>Mapbox outdoors</option> |
|
| 596 | + <option value="Mapbox-mapbox.pencil"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pencil') { |
|
| 597 | + print ' selected'; |
|
| 598 | +} |
|
| 599 | +?>>Mapbox pencil</option> |
|
| 600 | + <option value="Mapbox-mapbox.pirates"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.pirates') { |
|
| 601 | + print ' selected'; |
|
| 602 | +} |
|
| 603 | +?>>Mapbox pirates</option> |
|
| 604 | + <option value="Mapbox-mapbox.emerald"<?php if ($MapType == 'Mapbox' && $MapBoxId == 'mapbox.emerald') { |
|
| 605 | + print ' selected'; |
|
| 606 | +} |
|
| 607 | +?>>Mapbox emerald</option> |
|
| 425 | 608 | <?php |
| 426 | 609 | } |
| 427 | 610 | ?> |
| 428 | - <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') print ' selected'; ?>>OpenStreetMap</option> |
|
| 429 | - <option value="Yandex"<?php if ($MapType == 'Yandex') print ' selected'; ?>>Yandex</option> |
|
| 611 | + <option value="OpenStreetMap"<?php if ($MapType == 'OpenStreetMap') { |
|
| 612 | + print ' selected'; |
|
| 613 | +} |
|
| 614 | +?>>OpenStreetMap</option> |
|
| 615 | + <option value="Yandex"<?php if ($MapType == 'Yandex') { |
|
| 616 | + print ' selected'; |
|
| 617 | +} |
|
| 618 | +?>>Yandex</option> |
|
| 430 | 619 | <?php |
| 431 | 620 | } |
| 432 | 621 | ?> |
@@ -437,11 +626,26 @@ discard block |
||
| 437 | 626 | ?> |
| 438 | 627 | <li><?php echo _("Type of Terrain:"); ?> |
| 439 | 628 | <select class="selectpicker" onchange="terrainType(this);"> |
| 440 | - <option value="world"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'world') print ' selected'; ?>>world terrain</option> |
|
| 441 | - <option value="stk"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'stk') print ' selected'; ?>>stk terrain</option> |
|
| 442 | - <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') print ' selected';?>>ellipsoid</option> |
|
| 443 | - <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') print ' selected';?>>vr terrain</option> |
|
| 444 | - <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') print ' selected';?>>ArticDEM</option> |
|
| 629 | + <option value="world"<?php if (!isset($_COOKIE['MapTerrain']) || $_COOKIE['MapTerrain'] == 'world') { |
|
| 630 | + print ' selected'; |
|
| 631 | +} |
|
| 632 | +?>>world terrain</option> |
|
| 633 | + <option value="stk"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'stk') { |
|
| 634 | + print ' selected'; |
|
| 635 | +} |
|
| 636 | +?>>stk terrain</option> |
|
| 637 | + <option value="ellipsoid"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'ellipsoid') { |
|
| 638 | + print ' selected'; |
|
| 639 | +} |
|
| 640 | +?>>ellipsoid</option> |
|
| 641 | + <option value="vrterrain"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'vrterrain') { |
|
| 642 | + print ' selected'; |
|
| 643 | +} |
|
| 644 | +?>>vr terrain</option> |
|
| 645 | + <option value="articdem"<?php if (isset($_COOKIE['MapTerrain']) && $_COOKIE['MapTerrain'] == 'articdem') { |
|
| 646 | + print ' selected'; |
|
| 647 | +} |
|
| 648 | +?>>ArticDEM</option> |
|
| 445 | 649 | </select> |
| 446 | 650 | </li> |
| 447 | 651 | <?php |
@@ -451,64 +655,124 @@ discard block |
||
| 451 | 655 | <?php |
| 452 | 656 | if (isset($globalMap3D) && $globalMap3D) { |
| 453 | 657 | ?> |
| 454 | - <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') print 'checked'; ?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li> |
|
| 658 | + <li><div class="checkbox"><label><input type="checkbox" name="synchro2d3d" value="1" onclick="clickSyncMap2D3D(this)" <?php if (isset($_COOKIE['Map2D3DSync']) && $_COOKIE['Map2D3DSync'] == 'true') { |
|
| 659 | + print 'checked'; |
|
| 660 | +} |
|
| 661 | +?> ><?php echo _("Use same type of map for 2D & 3D"); ?></label></div></li> |
|
| 455 | 662 | <?php |
| 456 | 663 | } |
| 457 | 664 | ?> |
| 458 | 665 | <?php |
| 459 | 666 | if (!isset($_COOKIE['MapFormat']) || $_COOKIE['MapFormat'] != '3d') { |
| 460 | 667 | ?> |
| 461 | - <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') print 'checked'; ?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
|
| 668 | + <li><div class="checkbox"><label><input type="checkbox" name="display2dbuildings" value="1" onclick="clickDisplay2DBuildings(this)" <?php if (isset($_COOKIE['Map2DBuildings']) && $_COOKIE['Map2DBuildings'] == 'true') { |
|
| 669 | + print 'checked'; |
|
| 670 | +} |
|
| 671 | +?> ><?php echo _("Display 2.5D buidings on map"); ?></label></div></li> |
|
| 462 | 672 | |
| 463 | 673 | <?php |
| 464 | 674 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
| 465 | 675 | ?> |
| 466 | - <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') print 'checked'; ?> ><?php echo _("Display flight info as popup"); ?></label></div></li>--> |
|
| 467 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) print 'checked'; ?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
| 468 | - <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) print 'checked'; ?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
| 469 | - <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) print 'checked'; ?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> |
|
| 470 | - <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
| 676 | + <!--<li><div class="checkbox"><label><input type="checkbox" name="flightpopup" value="1" onclick="clickFlightPopup(this)" <?php if (isset($_COOKIE['flightpopup']) && $_COOKIE['flightpopup'] == 'true') { |
|
| 677 | + print 'checked'; |
|
| 678 | +} |
|
| 679 | +?> ><?php echo _("Display flight info as popup"); ?></label></div></li>--> |
|
| 680 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpath" value="1" onclick="clickFlightPath(this)" <?php if ((isset($_COOKIE['flightpath']) && $_COOKIE['flightpath'] == 'true')) { |
|
| 681 | + print 'checked'; |
|
| 682 | +} |
|
| 683 | +?> ><?php echo _("Display flight path"); ?></label></div></li> |
|
| 684 | + <li><div class="checkbox"><label><input type="checkbox" name="flightroute" value="1" onclick="clickFlightRoute(this)" <?php if ((isset($_COOKIE['MapRoute']) && $_COOKIE['MapRoute'] == 'true') || (!isset($_COOKIE['MapRoute']) && isset($globalMapRoute) && $globalMapRoute)) { |
|
| 685 | + print 'checked'; |
|
| 686 | +} |
|
| 687 | +?> ><?php echo _("Display flight route on click"); ?></label></div></li> |
|
| 688 | + <li><div class="checkbox"><label><input type="checkbox" name="flightremainingroute" value="1" onclick="clickFlightRemainingRoute(this)" <?php if ((isset($_COOKIE['MapRemainingRoute']) && $_COOKIE['MapRemainingRoute'] == 'true') || (!isset($_COOKIE['MapRemainingRoute']) && isset($globalMapRemainingRoute) && $globalMapRemainingRoute)) { |
|
| 689 | + print 'checked'; |
|
| 690 | +} |
|
| 691 | +?> ><?php echo _("Display flight remaining route on click"); ?></label></div></li> |
|
| 692 | + <li><div class="checkbox"><label><input type="checkbox" name="flightestimation" value="1" onclick="clickFlightEstimation(this)" <?php if ((isset($_COOKIE['flightestimation']) && $_COOKIE['flightestimation'] == 'true') || (!isset($_COOKIE['flightestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['flightestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { |
|
| 693 | + print 'checked'; |
|
| 694 | +} |
|
| 695 | +?> ><?php echo _("Planes animate between updates"); ?></label></div></li> |
|
| 471 | 696 | <?php |
| 472 | 697 | } elseif (!isset($globalTracker) || $globalTracker === TRUE) { |
| 473 | 698 | ?> |
| 474 | - <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) print 'checked'; ?> ><?php echo _("Enable map matching"); ?></label></div></li> |
|
| 699 | + <li><div class="checkbox"><label><input type="checkbox" name="mapmatching" value="1" onclick="clickMapMatching(this)" <?php if ((isset($_COOKIE['mapmatching']) && $_COOKIE['mapmatching'] == 'true') || (!isset($_COOKIE['mapmatching']) && isset($globalMapMatching) && $globalMapMatching)) { |
|
| 700 | + print 'checked'; |
|
| 701 | +} |
|
| 702 | +?> ><?php echo _("Enable map matching"); ?></label></div></li> |
|
| 475 | 703 | <?php |
| 476 | 704 | } |
| 477 | 705 | if (isset($globalSatellite) && $globalSatellite === TRUE) { |
| 478 | 706 | ?> |
| 479 | - <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) print 'checked'; ?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
|
| 707 | + <li><div class="checkbox"><label><input type="checkbox" name="satelliteestimation" value="1" onclick="clickSatelliteEstimation(this)" <?php if ((isset($_COOKIE['satelliteestimation']) && $_COOKIE['satelliteestimation'] == 'true') || (!isset($_COOKIE['satelliteestimation']) && !isset($globalMapEstimation)) || (!isset($_COOKIE['satelliteestimation']) && isset($globalMapEstimation) && $globalMapEstimation)) { |
|
| 708 | + print 'checked'; |
|
| 709 | +} |
|
| 710 | +?> ><?php echo _("Satellites animate between updates"); ?></label></div></li> |
|
| 480 | 711 | <?php |
| 481 | 712 | } |
| 482 | 713 | } |
| 483 | 714 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
| 484 | 715 | ?> |
| 485 | - <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) print 'checked'; ?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
| 716 | + <li><div class="checkbox"><label><input type="checkbox" name="displayairports" value="1" onclick="clickDisplayAirports(this)" <?php if (isset($_COOKIE['displayairports']) && $_COOKIE['displayairports'] == 'true' || !isset($_COOKIE['displayairports'])) { |
|
| 717 | + print 'checked'; |
|
| 718 | +} |
|
| 719 | +?> ><?php echo _("Display airports on map"); ?></label></div></li> |
|
| 486 | 720 | <?php |
| 487 | 721 | } |
| 488 | 722 | ?> |
| 489 | - <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) print 'checked'; ?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
|
| 490 | - <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) print 'checked'; ?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
|
| 491 | - <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) print 'checked'; ?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
|
| 723 | + <li><div class="checkbox"><label><input type="checkbox" name="displaygroundstation" value="1" onclick="clickDisplayGroundStation(this)" <?php if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
| 724 | + print 'checked'; |
|
| 725 | +} |
|
| 726 | +?> ><?php echo _("Display ground station on map"); ?></label></div></li> |
|
| 727 | + <li><div class="checkbox"><label><input type="checkbox" name="displayweatherstation" value="1" onclick="clickDisplayWeatherStation(this)" <?php if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
| 728 | + print 'checked'; |
|
| 729 | +} |
|
| 730 | +?> ><?php echo _("Display weather station on map"); ?></label></div></li> |
|
| 731 | + <li><div class="checkbox"><label><input type="checkbox" name="displaylightning" value="1" onclick="clickDisplayLightning(this)" <?php if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
| 732 | + print 'checked'; |
|
| 733 | +} |
|
| 734 | +?> ><?php echo _("Display lightning on map"); ?></label></div></li> |
|
| 492 | 735 | <?php |
| 493 | 736 | if (isset($globalFires) && $globalFires) { |
| 494 | 737 | ?> |
| 495 | - <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) print 'checked'; ?> ><?php echo _("Display fires on map"); ?></label></div></li> |
|
| 738 | + <li><div class="checkbox"><label><input type="checkbox" name="displayfires" value="1" onclick="clickDisplayFires(this)" <?php if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
| 739 | + print 'checked'; |
|
| 740 | +} |
|
| 741 | +?> ><?php echo _("Display fires on map"); ?></label></div></li> |
|
| 496 | 742 | <?php |
| 497 | 743 | } |
| 498 | 744 | if (isset($globalMap3D) && $globalMap3D) { |
| 499 | 745 | ?> |
| 500 | - <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) print 'checked'; ?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li> |
|
| 746 | + <li><div class="checkbox"><label><input type="checkbox" name="singlemodel" value="1" onclick="clickSingleModel(this)" <?php if ((isset($_COOKIE['singlemodel']) && $_COOKIE['singlemodel'] == 'true') || (!isset($_COOKIE['singlemodel']) && isset($globalMap3DSelected) && $globalMap3DSelected)) { |
|
| 747 | + print 'checked'; |
|
| 748 | +} |
|
| 749 | +?> ><?php echo _("Only display selected flight on 3D mode"); ?></label></div></li> |
|
| 501 | 750 | <?php |
| 502 | 751 | } |
| 503 | 752 | ?> |
| 504 | - <li><div class="checkbox"><label><input type="checkbox" name="truelight" value="1" onclick="clickTrueLight(this)" <?php if ((!isset($_COOKIE['truelight']) && (!isset($globalMapTrueLight) || $globalMapTrueLight)) || (isset($_COOKIE['truelight']) && $_COOKIE['truelight'] == 'true')) print 'checked'; ?> ><?php echo _("Enable globe sun lighting"); ?></label></div></li> |
|
| 753 | + <li><div class="checkbox"><label><input type="checkbox" name="truelight" value="1" onclick="clickTrueLight(this)" <?php if ((!isset($_COOKIE['truelight']) && (!isset($globalMapTrueLight) || $globalMapTrueLight)) || (isset($_COOKIE['truelight']) && $_COOKIE['truelight'] == 'true')) { |
|
| 754 | + print 'checked'; |
|
| 755 | +} |
|
| 756 | +?> ><?php echo _("Enable globe sun lighting"); ?></label></div></li> |
|
| 505 | 757 | <?php |
| 506 | 758 | if (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] == '3d') { |
| 507 | 759 | ?> |
| 508 | - <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) print 'checked'; ?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
| 509 | - <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) print 'checked'; ?> ><?php echo _("Use shadows"); ?></label></div></li> |
|
| 510 | - <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) print 'checked'; ?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li> |
|
| 511 | - <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) print 'checked'; ?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li> |
|
| 760 | + <li><div class="checkbox"><label><input type="checkbox" name="displayminimap" value="1" onclick="clickDisplayMinimap(this)" <?php if (!isset($_COOKIE['displayminimap']) || (isset($_COOKIE['displayminimap']) && $_COOKIE['displayminimap'] == 'true')) { |
|
| 761 | + print 'checked'; |
|
| 762 | +} |
|
| 763 | +?> ><?php echo _("Show mini-map"); ?></label></div></li> |
|
| 764 | + <li><div class="checkbox"><label><input type="checkbox" name="shadows" value="1" onclick="clickShadows(this)" <?php if ((!isset($_COOKIE['map3dnoshadows']) && (!isset($globalMap3DShadows) || $globalMap3DShadows)) || (isset($_COOKIE['map3dnoshadows']) && $_COOKIE['map3dnoshadows'] == 'false')) { |
|
| 765 | + print 'checked'; |
|
| 766 | +} |
|
| 767 | +?> ><?php echo _("Use shadows"); ?></label></div></li> |
|
| 768 | + <li><div class="checkbox"><label><input type="checkbox" name="one3dmodel" value="1" onclick="useOne3Dmodel(this)" <?php if ((isset($_COOKIE['one3dmodel']) && $_COOKIE['one3dmodel'] == 'true') || (!isset($_COOKIE['one3dmodel']) && isset($globalMap3DOneModel) && $globalMap3DOneModel)) { |
|
| 769 | + print 'checked'; |
|
| 770 | +} |
|
| 771 | +?> ><?php echo _("Use same 3D model for all aircraft (use fewer resources)"); ?></label></div></li> |
|
| 772 | + <li><div class="checkbox"><label><input type="checkbox" name="updaterealtime" value="1" onclick="clickUpdateRealtime(this)" <?php if ((isset($_COOKIE['updaterealtime']) && $_COOKIE['updaterealtime'] == 'true') || !isset($_COOKIE['updaterealtime'])) { |
|
| 773 | + print 'checked'; |
|
| 774 | +} |
|
| 775 | +?> ><?php echo _("Display realtime data in infobox"); ?></label></div></li> |
|
| 512 | 776 | <?php |
| 513 | 777 | } |
| 514 | 778 | if (time() > mktime(0,0,0,12,1,date("Y")) && time() < mktime(0,0,0,12,31,date("Y"))) { |
@@ -521,17 +785,25 @@ discard block |
||
| 521 | 785 | if (function_exists('array_column')) { |
| 522 | 786 | if (array_search(TRUE, array_column($globalSources, 'sourcestats')) !== FALSE) { |
| 523 | 787 | ?> |
| 524 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 788 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
| 789 | + print 'checked'; |
|
| 790 | +} |
|
| 791 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 525 | 792 | <?php |
| 526 | 793 | } |
| 527 | 794 | } elseif (isset($globalSources)) { |
| 528 | 795 | $dispolar = false; |
| 529 | 796 | foreach ($globalSources as $testsource) { |
| 530 | - if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) $dispolar = true; |
|
| 797 | + if (isset($globalSources['sourcestats']) && $globalSources['sourcestats'] !== FALSE) { |
|
| 798 | + $dispolar = true; |
|
| 799 | + } |
|
| 531 | 800 | } |
| 532 | 801 | if ($dispolar) { |
| 533 | 802 | ?> |
| 534 | - <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) print 'checked'; ?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 803 | + <li><div class="checkbox"><label><input type="checkbox" name="flightpolar" value="1" onclick="clickPolar(this)" <?php if ((isset($_COOKIE['polar']) && $_COOKIE['polar'] == 'true')) { |
|
| 804 | + print 'checked'; |
|
| 805 | +} |
|
| 806 | +?> ><?php echo _("Display polar on map"); ?></label></div></li> |
|
| 535 | 807 | <?php |
| 536 | 808 | } |
| 537 | 809 | } |
@@ -542,7 +814,14 @@ discard block |
||
| 542 | 814 | <?php |
| 543 | 815 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
| 544 | 816 | ?> |
| 545 | - <li><?php echo _("Max number of flights to display in 2D:"); ?> <input type="number" name="2dlimit" value="<?php if (isset($_COOKIE['map_2d_limit'])) print $_COOKIE['map_2d_limit']; elseif (isset($globalMap2DAircraftsLimit)) print $globalMap2DAircraftsLimit; else print 15000; ?>" onchange="map2dlimit(this.value);" /></li> |
|
| 817 | + <li><?php echo _("Max number of flights to display in 2D:"); ?> <input type="number" name="2dlimit" value="<?php if (isset($_COOKIE['map_2d_limit'])) { |
|
| 818 | + print $_COOKIE['map_2d_limit']; |
|
| 819 | +} elseif (isset($globalMap2DAircraftsLimit)) { |
|
| 820 | + print $globalMap2DAircraftsLimit; |
|
| 821 | +} else { |
|
| 822 | + print 15000; |
|
| 823 | +} |
|
| 824 | +?>" onchange="map2dlimit(this.value);" /></li> |
|
| 546 | 825 | <?php |
| 547 | 826 | } |
| 548 | 827 | ?> |
@@ -550,11 +829,21 @@ discard block |
||
| 550 | 829 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
| 551 | 830 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 552 | 831 | ?> |
| 553 | - <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') print 'checked'; ?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
| 832 | + <li><input type="checkbox" name="aircraftcoloraltitude" value="1" onclick="iconColorAltitude(this)" <?php if (isset($_COOKIE['IconColorAltitude']) && $_COOKIE['IconColorAltitude'] == 'true') { |
|
| 833 | + print 'checked'; |
|
| 834 | +} |
|
| 835 | +?> ><?php echo _("Aircraft icon color based on altitude"); ?></li> |
|
| 554 | 836 | <?php |
| 555 | 837 | if (!isset($_COOKIE['IconColorAltitude']) || $_COOKIE['IconColorAltitude'] == 'false') { |
| 556 | 838 | ?> |
| 557 | - <li><?php echo _("Aircraft icon color:"); ?> <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(this.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print '1a3151'; ?>"></li> |
|
| 839 | + <li><?php echo _("Aircraft icon color:"); ?> <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(this.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
| 840 | + print $_COOKIE['IconColor']; |
|
| 841 | +} elseif (isset($globalAircraftIconColor)) { |
|
| 842 | + print $globalAircraftIconColor; |
|
| 843 | +} else { |
|
| 844 | + print '1a3151'; |
|
| 845 | +} |
|
| 846 | +?>"></li> |
|
| 558 | 847 | <?php |
| 559 | 848 | } |
| 560 | 849 | } |
@@ -565,7 +854,14 @@ discard block |
||
| 565 | 854 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 566 | 855 | ?> |
| 567 | 856 | <li><?php echo _("Marine icon color:"); ?> |
| 568 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print '1a3151'; ?>"> |
|
| 857 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
| 858 | + print $_COOKIE['MarineIconColor']; |
|
| 859 | +} elseif (isset($globalMarineIconColor)) { |
|
| 860 | + print $globalMarineIconColor; |
|
| 861 | +} else { |
|
| 862 | + print '1a3151'; |
|
| 863 | +} |
|
| 864 | +?>"> |
|
| 569 | 865 | </li> |
| 570 | 866 | <?php |
| 571 | 867 | } |
@@ -576,7 +872,14 @@ discard block |
||
| 576 | 872 | if (extension_loaded('gd') && function_exists('gd_info')) { |
| 577 | 873 | ?> |
| 578 | 874 | <li><?php echo _("Tracker icon color:"); ?> |
| 579 | - <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print '1a3151'; ?>"> |
|
| 875 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
| 876 | + print $_COOKIE['TrackerIconColor']; |
|
| 877 | +} elseif (isset($globalTrackerIconColor)) { |
|
| 878 | + print $globalTrackerIconColor; |
|
| 879 | +} else { |
|
| 880 | + print '1a3151'; |
|
| 881 | +} |
|
| 882 | +?>"> |
|
| 580 | 883 | </li> |
| 581 | 884 | <?php |
| 582 | 885 | } |
@@ -587,8 +890,22 @@ discard block |
||
| 587 | 890 | ?> |
| 588 | 891 | <li><?php echo _("Show airport icon at zoom level:"); ?> |
| 589 | 892 | <div class="range"> |
| 590 | - <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?>"> |
|
| 591 | - <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) print $_COOKIE['AirportZoom']; elseif (isset($globalAirportZoom)) print $globalAirportZoom; else print '7'; ?></output> |
|
| 893 | + <input type="range" min="0" max="19" step="1" name="airportzoom" onchange="range.value=value;airportDisplayZoom(airportzoom.value);" value="<?php if (isset($_COOKIE['AirportZoom'])) { |
|
| 894 | + print $_COOKIE['AirportZoom']; |
|
| 895 | +} elseif (isset($globalAirportZoom)) { |
|
| 896 | + print $globalAirportZoom; |
|
| 897 | +} else { |
|
| 898 | + print '7'; |
|
| 899 | +} |
|
| 900 | +?>"> |
|
| 901 | + <output id="range"><?php if (isset($_COOKIE['AirportZoom'])) { |
|
| 902 | + print $_COOKIE['AirportZoom']; |
|
| 903 | +} elseif (isset($globalAirportZoom)) { |
|
| 904 | + print $globalAirportZoom; |
|
| 905 | +} else { |
|
| 906 | + print '7'; |
|
| 907 | +} |
|
| 908 | +?></output> |
|
| 592 | 909 | </div> |
| 593 | 910 | </li> |
| 594 | 911 | <?php |
@@ -599,18 +916,48 @@ discard block |
||
| 599 | 916 | ?> |
| 600 | 917 | <li><?php echo _("Set scaling factor for rendering resolution:"); ?> |
| 601 | 918 | <div class="range"> |
| 602 | - <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?>"> |
|
| 603 | - <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) print $_COOKIE['resolutionScale']; else print '1'; ?></output> |
|
| 919 | + <input type="range" min="0.5" max="2" step="0.5" name="resolutionscale" onchange="scale.value=value;resolutionScale(resolutionscale.value);" value="<?php if (isset($_COOKIE['resolutionScale'])) { |
|
| 920 | + print $_COOKIE['resolutionScale']; |
|
| 921 | +} else { |
|
| 922 | + print '1'; |
|
| 923 | +} |
|
| 924 | +?>"> |
|
| 925 | + <output id="scale"><?php if (isset($_COOKIE['resolutionScale'])) { |
|
| 926 | + print $_COOKIE['resolutionScale']; |
|
| 927 | +} else { |
|
| 928 | + print '1'; |
|
| 929 | +} |
|
| 930 | +?></output> |
|
| 604 | 931 | </div> |
| 605 | 932 | </li> |
| 606 | 933 | <?php |
| 607 | 934 | if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
| 608 | 935 | ?> |
| 609 | - <!-- <li><?php echo _("Max number of flights to display in 3D:"); ?> <input type="number" name="3dlimit" value="<?php if (isset($_COOKIE['map_3d_limit'])) print $_COOKIE['map_3d_limit']; elseif (isset($globalMap3DAircraftsLimit)) print $globalMap3DAircraftsLimit; else print 300; ?>" onchange="map3dlimit(this.value);" /></li> --> |
|
| 610 | - <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') print 'checked'; ?> > <?php echo _("Use airlines liveries"); ?></li> |
|
| 611 | - <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') print 'checked'; ?> > <?php echo _("Force Aircraft color"); ?> |
|
| 936 | + <!-- <li><?php echo _("Max number of flights to display in 3D:"); ?> <input type="number" name="3dlimit" value="<?php if (isset($_COOKIE['map_3d_limit'])) { |
|
| 937 | + print $_COOKIE['map_3d_limit']; |
|
| 938 | +} elseif (isset($globalMap3DAircraftsLimit)) { |
|
| 939 | + print $globalMap3DAircraftsLimit; |
|
| 940 | +} else { |
|
| 941 | + print 300; |
|
| 942 | +} |
|
| 943 | +?>" onchange="map3dlimit(this.value);" /></li> --> |
|
| 944 | + <li><input type="checkbox" name="useliveries" value="1" onclick="useLiveries(this)" <?php if (isset($_COOKIE['UseLiveries']) && $_COOKIE['UseLiveries'] == 'true') { |
|
| 945 | + print 'checked'; |
|
| 946 | +} |
|
| 947 | +?> > <?php echo _("Use airlines liveries"); ?></li> |
|
| 948 | + <li><input type="checkbox" name="aircraftcolorforce" value="1" onclick="iconColorForce(this)" <?php if (isset($_COOKIE['IconColorForce']) && $_COOKIE['IconColorForce'] == 'true') { |
|
| 949 | + print 'checked'; |
|
| 950 | +} |
|
| 951 | +?> > <?php echo _("Force Aircraft color"); ?> |
|
| 612 | 952 | <!--<li><?php echo _("Aircraft icon color:"); ?>--> |
| 613 | - <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) print $_COOKIE['IconColor']; elseif (isset($globalAircraftIconColor)) print $globalAircraftIconColor; else print 'ff0000'; ?>"> |
|
| 953 | + <input type="color" name="aircraftcolor" id="html5colorpicker" onchange="iconColor(aircraftcolor.value);" value="#<?php if (isset($_COOKIE['IconColor'])) { |
|
| 954 | + print $_COOKIE['IconColor']; |
|
| 955 | +} elseif (isset($globalAircraftIconColor)) { |
|
| 956 | + print $globalAircraftIconColor; |
|
| 957 | +} else { |
|
| 958 | + print 'ff0000'; |
|
| 959 | +} |
|
| 960 | +?>"> |
|
| 614 | 961 | </li> |
| 615 | 962 | <?php |
| 616 | 963 | } |
@@ -618,9 +965,19 @@ discard block |
||
| 618 | 965 | <?php |
| 619 | 966 | if (isset($globalMarine) && $globalMarine === TRUE) { |
| 620 | 967 | ?> |
| 621 | - <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Marine color"); ?> |
|
| 968 | + <li><input type="checkbox" name="marinecolorforce" value="1" onclick="MarineiconColorForce(this)" <?php if (isset($_COOKIE['MarineIconColorForce']) && $_COOKIE['MarineIconColorForce'] == 'true') { |
|
| 969 | + print 'checked'; |
|
| 970 | +} |
|
| 971 | +?> ><?php echo _("Force Marine color"); ?> |
|
| 622 | 972 | <!--<li><?php echo _("Marine icon color:"); ?>--> |
| 623 | - <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) print $_COOKIE['MarineIconColor']; elseif (isset($globalMarineIconColor)) print $globalMarineIconColor; else print 'ff0000'; ?>"> |
|
| 973 | + <input type="color" name="marinecolor" id="html5colorpicker" onchange="MarineiconColor(marinecolor.value);" value="#<?php if (isset($_COOKIE['MarineIconColor'])) { |
|
| 974 | + print $_COOKIE['MarineIconColor']; |
|
| 975 | +} elseif (isset($globalMarineIconColor)) { |
|
| 976 | + print $globalMarineIconColor; |
|
| 977 | +} else { |
|
| 978 | + print 'ff0000'; |
|
| 979 | +} |
|
| 980 | +?>"> |
|
| 624 | 981 | </li> |
| 625 | 982 | <?php |
| 626 | 983 | } |
@@ -628,9 +985,19 @@ discard block |
||
| 628 | 985 | <?php |
| 629 | 986 | if (isset($globalTracker) && $globalTracker === TRUE) { |
| 630 | 987 | ?> |
| 631 | - <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') print 'checked'; ?> ><?php echo _("Force Tracker color"); ?> |
|
| 988 | + <li><input type="checkbox" name="trackercolorforce" value="1" onclick="TrackericonColorForce(this)" <?php if (isset($_COOKIE['TrackerIconColorForce']) && $_COOKIE['TrackerIconColorForce'] == 'true') { |
|
| 989 | + print 'checked'; |
|
| 990 | +} |
|
| 991 | +?> ><?php echo _("Force Tracker color"); ?> |
|
| 632 | 992 | <!--<li><?php echo _("Tracker icon color:"); ?>--> |
| 633 | - <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) print $_COOKIE['TrackerIconColor']; elseif (isset($globalTrackerIconColor)) print $globalTrackerIconColor; else print 'ff0000'; ?>"> |
|
| 993 | + <input type="color" name="trackercolor" id="html5colorpicker" onchange="TrackericonColor(trackercolor.value);" value="#<?php if (isset($_COOKIE['TrackerIconColor'])) { |
|
| 994 | + print $_COOKIE['TrackerIconColor']; |
|
| 995 | +} elseif (isset($globalTrackerIconColor)) { |
|
| 996 | + print $globalTrackerIconColor; |
|
| 997 | +} else { |
|
| 998 | + print 'ff0000'; |
|
| 999 | +} |
|
| 1000 | +?>"> |
|
| 634 | 1001 | </li> |
| 635 | 1002 | <?php |
| 636 | 1003 | } |
@@ -638,29 +1005,62 @@ discard block |
||
| 638 | 1005 | ?> |
| 639 | 1006 | <li><?php echo _("Distance unit:"); ?> |
| 640 | 1007 | <select class="selectpicker" onchange="unitdistance(this);"> |
| 641 | - <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) echo ' selected'; ?>>km</option> |
|
| 642 | - <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) echo ' selected'; ?>>nm</option> |
|
| 643 | - <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) echo ' selected'; ?>>mi</option> |
|
| 1008 | + <option value="km"<?php if ((!isset($_COOKIE['unitdistance']) && (!isset($globalUnitDistance) || (isset($globalUnitDistance) && $globalUnitDistance == 'km'))) || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'km')) { |
|
| 1009 | + echo ' selected'; |
|
| 1010 | +} |
|
| 1011 | +?>>km</option> |
|
| 1012 | + <option value="nm"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'nm') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'nm')) { |
|
| 1013 | + echo ' selected'; |
|
| 1014 | +} |
|
| 1015 | +?>>nm</option> |
|
| 1016 | + <option value="mi"<?php if ((!isset($_COOKIE['unitdistance']) && isset($globalUnitDistance) && $globalUnitDistance == 'mi') || (isset($_COOKIE['unitdistance']) && $_COOKIE['unitdistance'] == 'mi')) { |
|
| 1017 | + echo ' selected'; |
|
| 1018 | +} |
|
| 1019 | +?>>mi</option> |
|
| 644 | 1020 | </select> |
| 645 | 1021 | </li> |
| 646 | 1022 | <li><?php echo _("Altitude unit:"); ?> |
| 647 | 1023 | <select class="selectpicker" onchange="unitaltitude(this);"> |
| 648 | - <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) echo ' selected'; ?>>m</option> |
|
| 649 | - <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) echo ' selected'; ?>>feet</option> |
|
| 1024 | + <option value="m"<?php if ((!isset($_COOKIE['unitaltitude']) && (!isset($globalUnitAltitude) || (isset($globalUnitAltitude) && $globalUnitAltitude == 'm'))) || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'm')) { |
|
| 1025 | + echo ' selected'; |
|
| 1026 | +} |
|
| 1027 | +?>>m</option> |
|
| 1028 | + <option value="feet"<?php if ((!isset($_COOKIE['unitaltitude']) && isset($globalUnitAltitude) && $globalUnitAltitude == 'feet') || (isset($_COOKIE['unitaltitude']) && $_COOKIE['unitaltitude'] == 'feet')) { |
|
| 1029 | + echo ' selected'; |
|
| 1030 | +} |
|
| 1031 | +?>>feet</option> |
|
| 650 | 1032 | </select> |
| 651 | 1033 | </li> |
| 652 | 1034 | <li><?php echo _("Speed unit:"); ?> |
| 653 | 1035 | <select class="selectpicker" onchange="unitspeed(this);"> |
| 654 | - <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) echo ' selected'; ?>>km/h</option> |
|
| 655 | - <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) echo ' selected'; ?>>mph</option> |
|
| 656 | - <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) echo ' selected'; ?>>knots</option> |
|
| 1036 | + <option value="kmh"<?php if ((!isset($_COOKIE['unitspeed']) && (!isset($globalUnitSpeed) || (isset($globalUnitSpeed) && $globalUnitSpeed == 'kmh'))) || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'kmh')) { |
|
| 1037 | + echo ' selected'; |
|
| 1038 | +} |
|
| 1039 | +?>>km/h</option> |
|
| 1040 | + <option value="mph"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'mph') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'mph')) { |
|
| 1041 | + echo ' selected'; |
|
| 1042 | +} |
|
| 1043 | +?>>mph</option> |
|
| 1044 | + <option value="knots"<?php if ((!isset($_COOKIE['unitspeed']) && isset($globalUnitSpeed) && $globalUnitSpeed == 'knots') || (isset($_COOKIE['unitspeed']) && $_COOKIE['unitspeed'] == 'knots')) { |
|
| 1045 | + echo ' selected'; |
|
| 1046 | +} |
|
| 1047 | +?>>knots</option> |
|
| 657 | 1048 | </select> |
| 658 | 1049 | </li> |
| 659 | 1050 | <li><?php echo _("Coordinate unit:"); ?> |
| 660 | 1051 | <select class="selectpicker" onchange="unitcoordinate(this);"> |
| 661 | - <option value="dd"<?php if ((!isset($_COOKIE['unitcoordinate']) && (!isset($globalUnitCoordinate) || (isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dd'))) || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dd')) echo ' selected'; ?>>DD</option> |
|
| 662 | - <option value="dms"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) echo ' selected'; ?>>DMS</option> |
|
| 663 | - <option value="dm"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) echo ' selected'; ?>>DM</option> |
|
| 1052 | + <option value="dd"<?php if ((!isset($_COOKIE['unitcoordinate']) && (!isset($globalUnitCoordinate) || (isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dd'))) || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dd')) { |
|
| 1053 | + echo ' selected'; |
|
| 1054 | +} |
|
| 1055 | +?>>DD</option> |
|
| 1056 | + <option value="dms"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dms') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dms')) { |
|
| 1057 | + echo ' selected'; |
|
| 1058 | +} |
|
| 1059 | +?>>DMS</option> |
|
| 1060 | + <option value="dm"<?php if ((!isset($_COOKIE['unitcoordinate']) && isset($globalUnitCoordinate) && $globalUnitCoordinate == 'dm') || (isset($_COOKIE['unitcoordinate']) && $_COOKIE['unitcoordinate'] == 'dm')) { |
|
| 1061 | + echo ' selected'; |
|
| 1062 | +} |
|
| 1063 | +?>>DM</option> |
|
| 664 | 1064 | </select> |
| 665 | 1065 | </li> |
| 666 | 1066 | |
@@ -678,9 +1078,18 @@ discard block |
||
| 678 | 1078 | <?php |
| 679 | 1079 | if (((isset($globalVATSIM) && $globalVATSIM) || isset($globalIVAO) && $globalIVAO || isset($globalphpVMS) && $globalphpVMS) && (!isset($globalMapVAchoose) || $globalMapVAchoose)) { |
| 680 | 1080 | ?> |
| 681 | - <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) print 'checked'; ?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
| 682 | - <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) print 'checked'; ?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
| 683 | - <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) print 'checked'; ?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
| 1081 | + <?php if (isset($globalVATSIM) && $globalVATSIM) { ?><li><input type="checkbox" name="vatsim" value="1" onclick="clickVATSIM(this)" <?php if ((isset($_COOKIE['filter_ShowVATSIM']) && $_COOKIE['filter_ShowVATSIM'] == 'true') || !isset($_COOKIE['filter_ShowVATSIM'])) { |
|
| 1082 | + print 'checked'; |
|
| 1083 | +} |
|
| 1084 | +?> ><?php echo _("Display VATSIM data"); ?></li><?php } ?> |
|
| 1085 | + <?php if (isset($globalIVAO) && $globalIVAO) { ?><li><input type="checkbox" name="ivao" value="1" onclick="clickIVAO(this)" <?php if ((isset($_COOKIE['filter_ShowIVAO']) && $_COOKIE['filter_ShowIVAO'] == 'true') || !isset($_COOKIE['filter_ShowIVAO'])) { |
|
| 1086 | + print 'checked'; |
|
| 1087 | +} |
|
| 1088 | +?> ><?php echo _("Display IVAO data"); ?></li><?php } ?> |
|
| 1089 | + <?php if (isset($globalphpVMS) && $globalphpVMS) { ?><li><input type="checkbox" name="phpvms" value="1" onclick="clickphpVMS(this)" <?php if ((isset($_COOKIE['filter_ShowVMS']) && $_COOKIE['filter_ShowVMS'] == 'true') || !isset($_COOKIE['filter_ShowVMS'])) { |
|
| 1090 | + print 'checked'; |
|
| 1091 | +} |
|
| 1092 | +?> ><?php echo _("Display phpVMS data"); ?></li><?php } ?> |
|
| 684 | 1093 | <?php |
| 685 | 1094 | } |
| 686 | 1095 | ?> |
@@ -688,12 +1097,21 @@ discard block |
||
| 688 | 1097 | if (!(isset($globalVA) && $globalVA) && !(isset($globalVATSIM) && $globalVATSIM) && !(isset($globalIVAO) && $globalIVAO) && !(isset($globalphpVMS) && $globalphpVMS) && isset($globalSBS1) && $globalSBS1 && isset($globalAPRS) && $globalAPRS && (!isset($globalMapchoose) || $globalMapchoose)) { |
| 689 | 1098 | ?> |
| 690 | 1099 | <?php if (isset($globalSBS1) && $globalSBS1) { ?> |
| 691 | - <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) print 'checked'; ?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
| 1100 | + <li><div class="checkbox"><label><input type="checkbox" name="sbs" value="1" onclick="clickSBS1(this)" <?php if ((isset($_COOKIE['filter_ShowSBS1']) && $_COOKIE['filter_ShowSBS1'] == 'true') || !isset($_COOKIE['filter_ShowSBS1'])) { |
|
| 1101 | + print 'checked'; |
|
| 1102 | +} |
|
| 1103 | +?> ><?php echo _("Display ADS-B data"); ?></label></div></li> |
|
| 692 | 1104 | <?php } ?> |
| 693 | 1105 | <?php if (isset($globalAPRS) && $globalAPRS) { ?> |
| 694 | - <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') || !isset($_COOKIE['filter_ShowAPRS'])) print 'checked'; ?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
| 1106 | + <li><div class="checkbox"><label><input type="checkbox" name="aprs" value="1" onclick="clickAPRS(this)" <?php if ((isset($_COOKIE['filter_ShowAPRS']) && $_COOKIE['filter_ShowAPRS'] == 'true') || !isset($_COOKIE['filter_ShowAPRS'])) { |
|
| 1107 | + print 'checked'; |
|
| 1108 | +} |
|
| 1109 | +?> ><?php echo _("Display APRS data"); ?></label></div></li> |
|
| 695 | 1110 | <?php } ?> |
| 696 | - <li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') print 'checked'; ?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li> |
|
| 1111 | + <li><div class="checkbox"><label><input type="checkbox" name="blocked" value="1" onclick="clickBlocked(this)" <?php if (isset($_COOKIE['filter_blocked']) && $_COOKIE['filter_blocked'] == 'true') { |
|
| 1112 | + print 'checked'; |
|
| 1113 | +} |
|
| 1114 | +?> ><?php echo _("Only display FAA ASDI blocked aircrafts"); ?></label></div></li> |
|
| 697 | 1115 | <?php |
| 698 | 1116 | } |
| 699 | 1117 | ?> |
@@ -709,7 +1127,9 @@ discard block |
||
| 709 | 1127 | } |
| 710 | 1128 | foreach($allairlinenames as $airline) { |
| 711 | 1129 | $airline_name = $airline['airline_name']; |
| 712 | - if (strlen($airline_name) > 30) $airline_name = substr($airline_name,0,30).'...'; |
|
| 1130 | + if (strlen($airline_name) > 30) { |
|
| 1131 | + $airline_name = substr($airline_name,0,30).'...'; |
|
| 1132 | + } |
|
| 713 | 1133 | if (isset($_COOKIE['filter_Airlines']) && in_array($airline['airline_icao'],explode(',',$_COOKIE['filter_Airlines']))) { |
| 714 | 1134 | echo '<option value="'.$airline['airline_icao'].'" selected>'.$airline_name.'</option>'; |
| 715 | 1135 | } else { |
@@ -727,7 +1147,10 @@ discard block |
||
| 727 | 1147 | <li><?php echo _("Display alliance:"); ?> |
| 728 | 1148 | <br/> |
| 729 | 1149 | <select class="selectpicker" onchange="alliance(this);" id="display_alliance"> |
| 730 | - <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
| 1150 | + <option value="all"<?php if (!isset($_COOKIE['filter_alliance']) || $_COOKIE['filter_alliance'] == 'all' || $_COOKIE['filter_alliance'] == '') { |
|
| 1151 | + echo ' selected'; |
|
| 1152 | +} |
|
| 1153 | +?>><?php echo _("All"); ?></option> |
|
| 731 | 1154 | <?php |
| 732 | 1155 | foreach($allalliancenames as $alliance) { |
| 733 | 1156 | $alliance_name = $alliance['alliance']; |
@@ -786,10 +1209,22 @@ discard block |
||
| 786 | 1209 | ?> |
| 787 | 1210 | <li><?php echo _("Display airlines of type:"); ?><br/> |
| 788 | 1211 | <select class="selectpicker" onchange="airlinestype(this);"> |
| 789 | - <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') echo ' selected'; ?>><?php echo _("All"); ?></option> |
|
| 790 | - <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') echo ' selected'; ?>><?php echo _("Passenger"); ?></option> |
|
| 791 | - <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') echo ' selected'; ?>><?php echo _("Cargo"); ?></option> |
|
| 792 | - <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') echo ' selected'; ?>><?php echo _("Military"); ?></option> |
|
| 1212 | + <option value="all"<?php if (!isset($_COOKIE['filter_airlinestype']) || $_COOKIE['filter_airlinestype'] == 'all' || $_COOKIE['filter_airlinestype'] == '') { |
|
| 1213 | + echo ' selected'; |
|
| 1214 | +} |
|
| 1215 | +?>><?php echo _("All"); ?></option> |
|
| 1216 | + <option value="passenger"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'passenger') { |
|
| 1217 | + echo ' selected'; |
|
| 1218 | +} |
|
| 1219 | +?>><?php echo _("Passenger"); ?></option> |
|
| 1220 | + <option value="cargo"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'cargo') { |
|
| 1221 | + echo ' selected'; |
|
| 1222 | +} |
|
| 1223 | +?>><?php echo _("Cargo"); ?></option> |
|
| 1224 | + <option value="military"<?php if (isset($_COOKIE['filter_airlinestype']) && $_COOKIE['filter_airlinestype'] == 'military') { |
|
| 1225 | + echo ' selected'; |
|
| 1226 | +} |
|
| 1227 | +?>><?php echo _("Military"); ?></option> |
|
| 793 | 1228 | </select> |
| 794 | 1229 | </li> |
| 795 | 1230 | <?php |
@@ -803,7 +1238,10 @@ discard block |
||
| 803 | 1238 | ?> |
| 804 | 1239 | <li> |
| 805 | 1240 | <?php echo _("Display vessels with MMSI:"); ?> |
| 806 | - <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) print $_COOKIE['filter_mmsi']; ?>" /> |
|
| 1241 | + <input type="text" name="mmsifilter" onchange="mmsifilter();" id="mmsifilter" value="<?php if (isset($_COOKIE['filter_mmsi'])) { |
|
| 1242 | + print $_COOKIE['filter_mmsi']; |
|
| 1243 | +} |
|
| 1244 | +?>" /> |
|
| 807 | 1245 | </li> |
| 808 | 1246 | <?php |
| 809 | 1247 | if (isset($globalVM) && $globalVM) { |
@@ -834,7 +1272,10 @@ discard block |
||
| 834 | 1272 | ?> |
| 835 | 1273 | <li> |
| 836 | 1274 | <?php echo _("Display with ident:"); ?> |
| 837 | - <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) print $_COOKIE['filter_ident']; ?>" /> |
|
| 1275 | + <input type="text" name="identfilter" onchange="identfilter();" id="identfilter" value="<?php if (isset($_COOKIE['filter_ident'])) { |
|
| 1276 | + print $_COOKIE['filter_ident']; |
|
| 1277 | +} |
|
| 1278 | +?>" /> |
|
| 838 | 1279 | </li> |
| 839 | 1280 | </ul> |
| 840 | 1281 | </form> |
@@ -850,7 +1291,10 @@ discard block |
||
| 850 | 1291 | <h1 class="sidebar-header"><?php echo _("Satellites"); ?><span class="sidebar-close"><i class="fa fa-caret-left"></i></span></h1> |
| 851 | 1292 | <form> |
| 852 | 1293 | <ul> |
| 853 | - <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) print 'checked'; ?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
| 1294 | + <li><div class="checkbox"><label><input type="checkbox" name="displayiss" value="1" onclick="clickDisplayISS(this)" <?php if ((isset($_COOKIE['displayiss']) && $_COOKIE['displayiss'] == 'true') || !isset($_COOKIE['displayiss'])) { |
|
| 1295 | + print 'checked'; |
|
| 1296 | +} |
|
| 1297 | +?> ><?php echo _("Show ISS, Tiangong-1 and Tiangong-2 on map"); ?></label></div></li> |
|
| 854 | 1298 | <li><?php echo _("Type:"); ?> |
| 855 | 1299 | <select class="selectpicker" multiple onchange="sattypes(this);"> |
| 856 | 1300 | <?php |
@@ -858,25 +1302,45 @@ discard block |
||
| 858 | 1302 | $types = $Satellite->get_tle_types(); |
| 859 | 1303 | foreach ($types as $type) { |
| 860 | 1304 | $type_name = $type['tle_type']; |
| 861 | - if ($type_name == 'musson') $type_name = 'Russian LEO Navigation'; |
|
| 862 | - else if ($type_name == 'nnss') $type_name = 'Navi Navigation Satellite System'; |
|
| 863 | - else if ($type_name == 'sbas') $type_name = 'Satellite-Based Augmentation System'; |
|
| 864 | - else if ($type_name == 'glo-ops') $type_name = 'Glonass Operational'; |
|
| 865 | - else if ($type_name == 'gps-ops') $type_name = 'GPS Operational'; |
|
| 866 | - else if ($type_name == 'argos') $type_name = 'ARGOS Data Collection System'; |
|
| 867 | - else if ($type_name == 'tdrss') $type_name = 'Tracking and Data Relay Satellite System'; |
|
| 868 | - else if ($type_name == 'sarsat') $type_name = 'Search & Rescue'; |
|
| 869 | - else if ($type_name == 'dmc') $type_name = 'Disaster Monitoring'; |
|
| 870 | - else if ($type_name == 'resource') $type_name = 'Earth Resources'; |
|
| 871 | - else if ($type_name == 'stations') $type_name = 'Space Stations'; |
|
| 872 | - else if ($type_name == 'geo') $type_name = 'Geostationary'; |
|
| 873 | - else if ($type_name == 'amateur') $type_name = 'Amateur Radio'; |
|
| 874 | - else if ($type_name == 'x-comm') $type_name = 'Experimental'; |
|
| 875 | - else if ($type_name == 'other-comm') $type_name = 'Other Comm'; |
|
| 876 | - else if ($type_name == 'science') $type_name = 'Space & Earth Science'; |
|
| 877 | - else if ($type_name == 'military') $type_name = 'Miscellaneous Military'; |
|
| 878 | - else if ($type_name == 'radar') $type_name = 'Radar Calibration'; |
|
| 879 | - else if ($type_name == 'tle-new') $type_name = 'Last 30 days launches'; |
|
| 1305 | + if ($type_name == 'musson') { |
|
| 1306 | + $type_name = 'Russian LEO Navigation'; |
|
| 1307 | + } else if ($type_name == 'nnss') { |
|
| 1308 | + $type_name = 'Navi Navigation Satellite System'; |
|
| 1309 | + } else if ($type_name == 'sbas') { |
|
| 1310 | + $type_name = 'Satellite-Based Augmentation System'; |
|
| 1311 | + } else if ($type_name == 'glo-ops') { |
|
| 1312 | + $type_name = 'Glonass Operational'; |
|
| 1313 | + } else if ($type_name == 'gps-ops') { |
|
| 1314 | + $type_name = 'GPS Operational'; |
|
| 1315 | + } else if ($type_name == 'argos') { |
|
| 1316 | + $type_name = 'ARGOS Data Collection System'; |
|
| 1317 | + } else if ($type_name == 'tdrss') { |
|
| 1318 | + $type_name = 'Tracking and Data Relay Satellite System'; |
|
| 1319 | + } else if ($type_name == 'sarsat') { |
|
| 1320 | + $type_name = 'Search & Rescue'; |
|
| 1321 | + } else if ($type_name == 'dmc') { |
|
| 1322 | + $type_name = 'Disaster Monitoring'; |
|
| 1323 | + } else if ($type_name == 'resource') { |
|
| 1324 | + $type_name = 'Earth Resources'; |
|
| 1325 | + } else if ($type_name == 'stations') { |
|
| 1326 | + $type_name = 'Space Stations'; |
|
| 1327 | + } else if ($type_name == 'geo') { |
|
| 1328 | + $type_name = 'Geostationary'; |
|
| 1329 | + } else if ($type_name == 'amateur') { |
|
| 1330 | + $type_name = 'Amateur Radio'; |
|
| 1331 | + } else if ($type_name == 'x-comm') { |
|
| 1332 | + $type_name = 'Experimental'; |
|
| 1333 | + } else if ($type_name == 'other-comm') { |
|
| 1334 | + $type_name = 'Other Comm'; |
|
| 1335 | + } else if ($type_name == 'science') { |
|
| 1336 | + $type_name = 'Space & Earth Science'; |
|
| 1337 | + } else if ($type_name == 'military') { |
|
| 1338 | + $type_name = 'Miscellaneous Military'; |
|
| 1339 | + } else if ($type_name == 'radar') { |
|
| 1340 | + $type_name = 'Radar Calibration'; |
|
| 1341 | + } else if ($type_name == 'tle-new') { |
|
| 1342 | + $type_name = 'Last 30 days launches'; |
|
| 1343 | + } |
|
| 880 | 1344 | |
| 881 | 1345 | if (isset($_COOKIE['sattypes']) && in_array($type['tle_type'],explode(',',$_COOKIE['sattypes']))) { |
| 882 | 1346 | print '<option value="'.$type['tle_type'].'" selected>'.$type_name.'</option>'; |
@@ -16,25 +16,25 @@ discard block |
||
| 16 | 16 | require_once(dirname(__FILE__).'/class.Stats.php'); |
| 17 | 17 | require_once(dirname(__FILE__).'/class.Source.php'); |
| 18 | 18 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
| 19 | - require_once(dirname(__FILE__).'/class.APRS.php'); |
|
| 19 | + require_once(dirname(__FILE__).'/class.APRS.php'); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | class MarineImport { |
| 23 | - private $all_tracked = array(); |
|
| 24 | - private $last_delete_hourly = 0; |
|
| 25 | - private $last_delete = 0; |
|
| 26 | - private $stats = array(); |
|
| 27 | - private $tmd = 0; |
|
| 28 | - private $source_location = array(); |
|
| 29 | - public $db = null; |
|
| 30 | - public $nb = 0; |
|
| 23 | + private $all_tracked = array(); |
|
| 24 | + private $last_delete_hourly = 0; |
|
| 25 | + private $last_delete = 0; |
|
| 26 | + private $stats = array(); |
|
| 27 | + private $tmd = 0; |
|
| 28 | + private $source_location = array(); |
|
| 29 | + public $db = null; |
|
| 30 | + public $nb = 0; |
|
| 31 | 31 | |
| 32 | - public function __construct($dbc = null) { |
|
| 32 | + public function __construct($dbc = null) { |
|
| 33 | 33 | global $globalBeta, $globalServerAPRS, $APRSMarine, $globalNoDB; |
| 34 | 34 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 35 | - $Connection = new Connection($dbc); |
|
| 36 | - $this->db = $Connection->db(); |
|
| 37 | - date_default_timezone_set('UTC'); |
|
| 35 | + $Connection = new Connection($dbc); |
|
| 36 | + $this->db = $Connection->db(); |
|
| 37 | + date_default_timezone_set('UTC'); |
|
| 38 | 38 | } |
| 39 | 39 | // Get previous source stats |
| 40 | 40 | /* |
@@ -53,79 +53,79 @@ discard block |
||
| 53 | 53 | } |
| 54 | 54 | */ |
| 55 | 55 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
| 56 | - $APRSMarine = new APRSMarine(); |
|
| 57 | - //$APRSSpotter->connect(); |
|
| 56 | + $APRSMarine = new APRSMarine(); |
|
| 57 | + //$APRSSpotter->connect(); |
|
| 58 | + } |
|
| 58 | 59 | } |
| 59 | - } |
|
| 60 | 60 | |
| 61 | - public function checkAll() { |
|
| 61 | + public function checkAll() { |
|
| 62 | 62 | global $globalDebug, $globalNoDB, $globalVM; |
| 63 | 63 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 64 | - if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
| 65 | - foreach ($this->all_tracked as $key => $flight) { |
|
| 64 | + if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
| 65 | + foreach ($this->all_tracked as $key => $flight) { |
|
| 66 | 66 | if (isset($this->all_tracked[$key]['id'])) { |
| 67 | - //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
|
| 68 | - $Marine = new Marine($this->db); |
|
| 69 | - if (isset($globalVM) && $globalVM) { |
|
| 67 | + //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
|
| 68 | + $Marine = new Marine($this->db); |
|
| 69 | + if (isset($globalVM) && $globalVM) { |
|
| 70 | 70 | if ($this->all_tracked[$key]['status'] == 'Racing') { |
| 71 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
| 72 | - } else { |
|
| 73 | - $timerace = (strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']); |
|
| 74 | - if ($timerace > time()) $finaldatetime = NULL; |
|
| 75 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 76 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
| 77 | - } |
|
| 78 | - } else { |
|
| 71 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
| 72 | + } else { |
|
| 73 | + $timerace = (strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']); |
|
| 74 | + if ($timerace > time()) $finaldatetime = NULL; |
|
| 75 | + else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 76 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
| 77 | + } |
|
| 78 | + } else { |
|
| 79 | 79 | $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 80 | - } |
|
| 80 | + } |
|
| 81 | + } |
|
| 81 | 82 | } |
| 82 | - } |
|
| 83 | 83 | } |
| 84 | - } |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - public function del() { |
|
| 86 | + public function del() { |
|
| 87 | 87 | global $globalDebug, $globalNoDB, $globalNoImport; |
| 88 | 88 | // Delete old infos |
| 89 | 89 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 90 | 90 | foreach ($this->all_tracked as $key => $flight) { |
| 91 | - if (isset($flight['lastupdate'])) { |
|
| 92 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
| 93 | - if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
| 94 | - if (isset($this->all_tracked[$key]['id'])) { |
|
| 95 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 96 | - /* |
|
| 91 | + if (isset($flight['lastupdate'])) { |
|
| 92 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
| 93 | + if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
| 94 | + if (isset($this->all_tracked[$key]['id'])) { |
|
| 95 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 96 | + /* |
|
| 97 | 97 | $MarineLive = new MarineLive(); |
| 98 | 98 | $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']); |
| 99 | 99 | $MarineLive->db = null; |
| 100 | 100 | */ |
| 101 | - //$real_arrival = $this->arrival($key); |
|
| 102 | - $Marine = new Marine($this->db); |
|
| 103 | - if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
| 101 | + //$real_arrival = $this->arrival($key); |
|
| 102 | + $Marine = new Marine($this->db); |
|
| 103 | + if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
| 104 | 104 | if (isset($globalVM) && $globalVM) { |
| 105 | - if ($this->all_tracked[$key]['status'] == 'Racing') { |
|
| 105 | + if ($this->all_tracked[$key]['status'] == 'Racing') { |
|
| 106 | 106 | $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 107 | - } else { |
|
| 107 | + } else { |
|
| 108 | 108 | $timerace = strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']; |
| 109 | - if ($timerace > time()) $finaldatetime = NULL; |
|
| 109 | + if ($timerace > time()) $finaldatetime = NULL; |
|
| 110 | 110 | else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
| 111 | 111 | $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 112 | - } |
|
| 112 | + } |
|
| 113 | 113 | } else { |
| 114 | 114 | $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 115 | 115 | } |
| 116 | 116 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 117 | - } |
|
| 118 | - // Put in archive |
|
| 117 | + } |
|
| 118 | + // Put in archive |
|
| 119 | 119 | // $Marine->db = null; |
| 120 | 120 | } |
| 121 | - } |
|
| 122 | - unset($this->all_tracked[$key]); |
|
| 123 | - } |
|
| 124 | - } |
|
| 125 | - } |
|
| 126 | - } |
|
| 121 | + } |
|
| 122 | + unset($this->all_tracked[$key]); |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | + } |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - public function add($line) { |
|
| 128 | + public function add($line) { |
|
| 129 | 129 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine, $globalLiveInterval, $globalVM, $globalOnlyID; |
| 130 | 130 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
| 131 | 131 | date_default_timezone_set('UTC'); |
@@ -134,106 +134,106 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | // SBS format is CSV format |
| 136 | 136 | if(is_array($line) && (isset($line['mmsi']) || isset($line['id']))) { |
| 137 | - //print_r($line); |
|
| 138 | - if (isset($line['mmsi']) || isset($line['id'])) { |
|
| 137 | + //print_r($line); |
|
| 138 | + if (isset($line['mmsi']) || isset($line['id'])) { |
|
| 139 | 139 | |
| 140 | 140 | |
| 141 | 141 | // Increment message number |
| 142 | 142 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
| 143 | - $current_date = date('Y-m-d'); |
|
| 144 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 145 | - else $source = ''; |
|
| 146 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 147 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 148 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 149 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 150 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 143 | + $current_date = date('Y-m-d'); |
|
| 144 | + if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 145 | + else $source = ''; |
|
| 146 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 147 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 148 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 149 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 150 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
| 154 | 154 | $Common = new Common(); |
| 155 | 155 | $AIS = new AIS(); |
| 156 | - if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
| 157 | - else $id = trim($line['id']); |
|
| 156 | + if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
| 157 | + else $id = trim($line['id']); |
|
| 158 | 158 | |
| 159 | 159 | if (!isset($this->all_tracked[$id])) { |
| 160 | - $this->all_tracked[$id] = array(); |
|
| 161 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
| 162 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '','captain_id' => '','captain_name' => '','race_id' => '','race_name' => '','distance' => NULL,'race_rank' => NULL,'race_time' => NULL,'race_begin' => '')); |
|
| 163 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
| 164 | - if (!isset($line['id'])) { |
|
| 160 | + $this->all_tracked[$id] = array(); |
|
| 161 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
| 162 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '','captain_id' => '','captain_name' => '','race_id' => '','race_name' => '','distance' => NULL,'race_rank' => NULL,'race_time' => NULL,'race_begin' => '')); |
|
| 163 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
| 164 | + if (!isset($line['id'])) { |
|
| 165 | 165 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 166 | 166 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
| 167 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 168 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
| 167 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 168 | + if ($globalAllTracked !== FALSE) $dataFound = true; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
| 172 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
| 173 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 172 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
| 173 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 174 | 174 | $Marine = new Marine($this->db); |
| 175 | 175 | $identity = $Marine->getIdentity($line['mmsi']); |
| 176 | 176 | if (!empty($identity)) { |
| 177 | - $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
| 178 | - $this->all_tracked[$id]['type'] = $identity['type']; |
|
| 179 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type']))); |
|
| 177 | + $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
| 178 | + $this->all_tracked[$id]['type'] = $identity['type']; |
|
| 179 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type']))); |
|
| 180 | 180 | } |
| 181 | 181 | //print_r($identity); |
| 182 | 182 | unset($Marine); |
| 183 | 183 | //$dataFound = true; |
| 184 | - } |
|
| 184 | + } |
|
| 185 | 185 | } |
| 186 | 186 | if (isset($line['type_id'])) { |
| 187 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
| 188 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id'])); |
|
| 187 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
| 188 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id'])); |
|
| 189 | 189 | } |
| 190 | 190 | if (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] == '') { |
| 191 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 192 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type']))); |
|
| 191 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 192 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type']))); |
|
| 193 | 193 | } elseif (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] != '') { |
| 194 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 194 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 195 | 195 | } |
| 196 | 196 | if (isset($line['status']) && $line['status'] != '') { |
| 197 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
| 197 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
| 198 | 198 | } |
| 199 | 199 | if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) { |
| 200 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
| 201 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 200 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
| 201 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 202 | 202 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 203 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 203 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 204 | 204 | $Marine = new Marine($this->db); |
| 205 | 205 | $Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']); |
| 206 | 206 | unset($Marine); |
| 207 | - } |
|
| 207 | + } |
|
| 208 | + } |
|
| 208 | 209 | } |
| 209 | - } |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | |
| 213 | 213 | if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') { |
| 214 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
| 214 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
| 215 | 215 | } |
| 216 | 216 | if (isset($line['imo']) && $line['imo'] != '') { |
| 217 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
| 217 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
| 218 | 218 | } |
| 219 | 219 | if (isset($line['callsign']) && $line['callsign'] != '') { |
| 220 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
| 220 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
| 221 | 221 | } |
| 222 | 222 | if (isset($line['arrival_code']) && $line['arrival_code'] != '') { |
| 223 | - if (!isset($this->all_tracked[$id]['arrival_code'])) { |
|
| 223 | + if (!isset($this->all_tracked[$id]['arrival_code'])) { |
|
| 224 | 224 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
| 225 | 225 | if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
| 226 | 226 | if ($this->all_tracked[$id]['addedMarine'] != 0) { |
| 227 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 227 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 228 | 228 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 229 | - $Marine = new Marine($this->db); |
|
| 230 | - $fromsource = NULL; |
|
| 231 | - $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource); |
|
| 232 | - $Marine->db = null; |
|
| 229 | + $Marine = new Marine($this->db); |
|
| 230 | + $fromsource = NULL; |
|
| 231 | + $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource); |
|
| 232 | + $Marine->db = null; |
|
| 233 | + } |
|
| 233 | 234 | } |
| 234 | - } |
|
| 235 | 235 | } |
| 236 | - } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) { |
|
| 236 | + } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) { |
|
| 237 | 237 | $this->all_tracked[$id]['arrival_code'] = $line['arrival_code']; |
| 238 | 238 | if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
| 239 | 239 | if (!isset($line['id'])) { |
@@ -241,50 +241,50 @@ discard block |
||
| 241 | 241 | $this->all_tracked[$id]['forcenew'] = 1; |
| 242 | 242 | $this->all_tracked[$id]['addedMarine'] = 0; |
| 243 | 243 | } |
| 244 | - } |
|
| 244 | + } |
|
| 245 | 245 | } |
| 246 | 246 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
| 247 | - if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 247 | + if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 248 | 248 | } |
| 249 | 249 | if (isset($line['captain_id']) && $line['captain_id'] != '') { |
| 250 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_id' => $line['captain_id'])); |
|
| 250 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_id' => $line['captain_id'])); |
|
| 251 | 251 | } |
| 252 | 252 | if (isset($line['captain_name']) && $line['captain_name'] != '') { |
| 253 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_name' => $line['captain_name'])); |
|
| 253 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_name' => $line['captain_name'])); |
|
| 254 | 254 | } |
| 255 | 255 | if (isset($line['race_id']) && $line['race_id'] != '') { |
| 256 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_id' => $line['race_id'])); |
|
| 256 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_id' => $line['race_id'])); |
|
| 257 | 257 | } |
| 258 | 258 | if (isset($line['race_name']) && $line['race_name'] != '') { |
| 259 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_name' => $line['race_name'])); |
|
| 259 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_name' => $line['race_name'])); |
|
| 260 | 260 | } |
| 261 | 261 | if (isset($line['race_rank']) && $line['race_rank'] != '') { |
| 262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_rank' => $line['race_rank'])); |
|
| 262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_rank' => $line['race_rank'])); |
|
| 263 | 263 | } |
| 264 | 264 | if (isset($line['race_time']) && $line['race_time'] != '') { |
| 265 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_time' => $line['race_time'])); |
|
| 265 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_time' => $line['race_time'])); |
|
| 266 | 266 | } |
| 267 | 267 | if (isset($line['race_begin']) && $line['race_begin'] != '') { |
| 268 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_begin' => $line['race_begin'])); |
|
| 268 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_begin' => $line['race_begin'])); |
|
| 269 | 269 | } |
| 270 | 270 | if (isset($line['distance']) && $line['distance'] != '') { |
| 271 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('distance' => $line['distance'])); |
|
| 271 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('distance' => $line['distance'])); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
| 275 | 275 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
| 276 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 276 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 277 | 277 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 278 | - $timeelapsed = microtime(true); |
|
| 279 | - $Marine = new Marine($this->db); |
|
| 280 | - $Marine->addIdentity($this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['type']); |
|
| 281 | - $Marine->db = null; |
|
| 278 | + $timeelapsed = microtime(true); |
|
| 279 | + $Marine = new Marine($this->db); |
|
| 280 | + $Marine->addIdentity($this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['type']); |
|
| 281 | + $Marine->db = null; |
|
| 282 | + } |
|
| 282 | 283 | } |
| 283 | - } |
|
| 284 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 285 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 284 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 285 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 286 | 286 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 287 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 287 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 288 | 288 | $timeelapsed = microtime(true); |
| 289 | 289 | $Marine = new Marine($this->db); |
| 290 | 290 | $fromsource = NULL; |
@@ -292,20 +292,20 @@ discard block |
||
| 292 | 292 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 293 | 293 | $Marine->db = null; |
| 294 | 294 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 295 | - } |
|
| 295 | + } |
|
| 296 | + } |
|
| 296 | 297 | } |
| 297 | - } |
|
| 298 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 298 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) { |
| 302 | - if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
| 302 | + if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
| 303 | 303 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
| 304 | - } else { |
|
| 304 | + } else { |
|
| 305 | 305 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
| 306 | 306 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 307 | 307 | return ''; |
| 308 | - } |
|
| 308 | + } |
|
| 309 | 309 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) { |
| 310 | 310 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
| 311 | 311 | return ''; |
@@ -322,33 +322,33 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | |
| 324 | 324 | if (isset($line['speed'])) { |
| 325 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'],2))); |
|
| 326 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 325 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'],2))); |
|
| 326 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 327 | 327 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
| 328 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 329 | - if ($distance > 1000 && $distance < 10000) { |
|
| 328 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 329 | + if ($distance > 1000 && $distance < 10000) { |
|
| 330 | 330 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
| 331 | 331 | $speed = $speed*3.6; |
| 332 | 332 | if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed,2))); |
| 333 | 333 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['id']." : ".$speed." - distance : ".$distance."\n"; |
| 334 | - } |
|
| 334 | + } |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 338 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 339 | - else unset($timediff); |
|
| 340 | - if ($this->tmd > 5 || |
|
| 341 | - !isset($timediff) || |
|
| 342 | - $timediff > $globalLiveInterval || |
|
| 343 | - ( |
|
| 344 | - $timediff > 30 && |
|
| 345 | - isset($this->all_tracked[$id]['latitude']) && |
|
| 346 | - isset($this->all_tracked[$id]['longitude']) && |
|
| 347 | - $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')) |
|
| 348 | - ) |
|
| 349 | - ) { |
|
| 337 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 338 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 339 | + else unset($timediff); |
|
| 340 | + if ($this->tmd > 5 || |
|
| 341 | + !isset($timediff) || |
|
| 342 | + $timediff > $globalLiveInterval || |
|
| 343 | + ( |
|
| 344 | + $timediff > 30 && |
|
| 345 | + isset($this->all_tracked[$id]['latitude']) && |
|
| 346 | + isset($this->all_tracked[$id]['longitude']) && |
|
| 347 | + $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')) |
|
| 348 | + ) |
|
| 349 | + ) { |
|
| 350 | 350 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
| 351 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 351 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 352 | 352 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 353 | 353 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 354 | 354 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -356,217 +356,217 @@ discard block |
||
| 356 | 356 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
| 357 | 357 | $timeelapsed = microtime(true); |
| 358 | 358 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 359 | - $Marine = new Marine($this->db); |
|
| 360 | - $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 361 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 362 | - $Marine->db = null; |
|
| 363 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 359 | + $Marine = new Marine($this->db); |
|
| 360 | + $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 361 | + if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 362 | + $Marine->db = null; |
|
| 363 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 364 | 364 | } |
| 365 | 365 | $this->tmd = 0; |
| 366 | 366 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
| 367 | - } |
|
| 367 | + } |
|
| 368 | 368 | } |
| 369 | 369 | |
| 370 | 370 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 371 | 371 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 372 | 372 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
| 373 | - $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
| 374 | - $dataFound = true; |
|
| 375 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 373 | + $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
| 374 | + $dataFound = true; |
|
| 375 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 376 | 376 | } |
| 377 | 377 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
| 378 | 378 | } |
| 379 | 379 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 380 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 380 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 381 | 381 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 382 | 382 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
| 383 | - $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
| 384 | - $dataFound = true; |
|
| 385 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 383 | + $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
| 384 | + $dataFound = true; |
|
| 385 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 386 | 386 | } |
| 387 | 387 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - } else if ($globalDebug && $timediff > 20) { |
|
| 390 | + } else if ($globalDebug && $timediff > 20) { |
|
| 391 | 391 | $this->tmd = $this->tmd + 1; |
| 392 | 392 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
| 393 | 393 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
| 394 | 394 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
| 395 | 395 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
| 396 | - } |
|
| 396 | + } |
|
| 397 | 397 | } |
| 398 | 398 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 399 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 400 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 399 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 400 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 401 | 401 | } |
| 402 | 402 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 403 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 403 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 404 | 404 | } |
| 405 | 405 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 406 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 406 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 407 | 407 | } |
| 408 | 408 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 409 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 409 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | if (isset($line['heading']) && $line['heading'] != '') { |
| 413 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 414 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 415 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 416 | - //$dataFound = true; |
|
| 413 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 414 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 415 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 416 | + //$dataFound = true; |
|
| 417 | 417 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
| 418 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
| 419 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
| 420 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 421 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 418 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
| 419 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
| 420 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 421 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 422 | 422 | } |
| 423 | 423 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
| 424 | 424 | |
| 425 | 425 | |
| 426 | 426 | |
| 427 | 427 | if ($dataFound === true && (isset($this->all_tracked[$id]['mmsi']) || isset($this->all_tracked[$id]['id']))) { |
| 428 | - $this->all_tracked[$id]['lastupdate'] = time(); |
|
| 429 | - if ($this->all_tracked[$id]['addedMarine'] == 0 || (isset($globalVM) && $globalVM)) { |
|
| 430 | - if ((!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) && (!isset($globalOnlyID) || in_array($id,$globalOnlyID))) { |
|
| 431 | - if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
| 428 | + $this->all_tracked[$id]['lastupdate'] = time(); |
|
| 429 | + if ($this->all_tracked[$id]['addedMarine'] == 0 || (isset($globalVM) && $globalVM)) { |
|
| 430 | + if ((!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) && (!isset($globalOnlyID) || in_array($id,$globalOnlyID))) { |
|
| 431 | + if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
| 432 | 432 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 433 | - if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
| 434 | - $timeelapsed = microtime(true); |
|
| 435 | - $MarineLive = new MarineLive($this->db); |
|
| 436 | - if (isset($line['id']) && isset($globalVM) && $globalVM) { |
|
| 433 | + if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
| 434 | + $timeelapsed = microtime(true); |
|
| 435 | + $MarineLive = new MarineLive($this->db); |
|
| 436 | + if (isset($line['id']) && isset($globalVM) && $globalVM) { |
|
| 437 | 437 | $Marine = new Marine($this->db); |
| 438 | 438 | $recent_ident = $Marine->checkId($line['id']); |
| 439 | 439 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkId : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 440 | 440 | $Marine->db=null; |
| 441 | - } elseif (isset($line['id'])) { |
|
| 441 | + } elseif (isset($line['id'])) { |
|
| 442 | 442 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
| 443 | 443 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 444 | - } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
| 444 | + } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
| 445 | 445 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
| 446 | 446 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 447 | - } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
| 447 | + } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
| 448 | 448 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
| 449 | 449 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 450 | - } else $recent_ident = ''; |
|
| 451 | - $MarineLive->db=null; |
|
| 452 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 453 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 450 | + } else $recent_ident = ''; |
|
| 451 | + $MarineLive->db=null; |
|
| 452 | + if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 453 | + elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 454 | 454 | } else $recent_ident = ''; |
| 455 | - } else { |
|
| 455 | + } else { |
|
| 456 | 456 | $recent_ident = ''; |
| 457 | 457 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
| 458 | - } |
|
| 459 | - //if there was no vessel with the same callsign within the last hour and go post it into the archive |
|
| 460 | - if($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM))) |
|
| 461 | - { |
|
| 458 | + } |
|
| 459 | + //if there was no vessel with the same callsign within the last hour and go post it into the archive |
|
| 460 | + if($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM))) |
|
| 461 | + { |
|
| 462 | 462 | if ($globalDebug) { |
| 463 | 463 | if ($this->all_tracked[$id]['mmsi'] != '') echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
| 464 | 464 | else echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
| 465 | 465 | } |
| 466 | 466 | //adds the spotter data for the archive |
| 467 | - $highlight = ''; |
|
| 468 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
| 469 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 467 | + $highlight = ''; |
|
| 468 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
| 469 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 470 | 470 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 471 | - $timeelapsed = microtime(true); |
|
| 472 | - $Marine = new Marine($this->db); |
|
| 473 | - if (isset($globalVM) && $globalVM && ($this->all_tracked[$id]['race_begin'] != '' || $this->all_tracked[$id]['format_source'] == 'sailaway')) { |
|
| 471 | + $timeelapsed = microtime(true); |
|
| 472 | + $Marine = new Marine($this->db); |
|
| 473 | + if (isset($globalVM) && $globalVM && ($this->all_tracked[$id]['race_begin'] != '' || $this->all_tracked[$id]['format_source'] == 'sailaway')) { |
|
| 474 | 474 | $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['race_begin'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
| 475 | - } else { |
|
| 475 | + } else { |
|
| 476 | 476 | $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
| 477 | - } |
|
| 478 | - $Marine->db = null; |
|
| 479 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 480 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 477 | + } |
|
| 478 | + $Marine->db = null; |
|
| 479 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 480 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 481 | 481 | } |
| 482 | - } |
|
| 483 | - if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
| 482 | + } |
|
| 483 | + if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
| 484 | 484 | // Add source stat in DB |
| 485 | 485 | $Stats = new Stats($this->db); |
| 486 | 486 | if (!empty($this->stats)) { |
| 487 | - if ($globalDebug) echo 'Add source stats : '; |
|
| 488 | - foreach($this->stats as $date => $data) { |
|
| 487 | + if ($globalDebug) echo 'Add source stats : '; |
|
| 488 | + foreach($this->stats as $date => $data) { |
|
| 489 | 489 | foreach($data as $source => $sourced) { |
| 490 | - //print_r($sourced); |
|
| 491 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
| 492 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
| 493 | - if (isset($sourced['msg'])) { |
|
| 494 | - if (time() - $sourced['msg']['date'] > 10) { |
|
| 495 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 496 | - echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
| 497 | - unset($this->stats[$date][$source]['msg']); |
|
| 498 | - } |
|
| 499 | - } |
|
| 500 | - } |
|
| 501 | - if ($date != date('Y-m-d')) { |
|
| 502 | - unset($this->stats[$date]); |
|
| 503 | - } |
|
| 504 | - } |
|
| 505 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 490 | + //print_r($sourced); |
|
| 491 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
| 492 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
| 493 | + if (isset($sourced['msg'])) { |
|
| 494 | + if (time() - $sourced['msg']['date'] > 10) { |
|
| 495 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 496 | + echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
| 497 | + unset($this->stats[$date][$source]['msg']); |
|
| 498 | + } |
|
| 499 | + } |
|
| 500 | + } |
|
| 501 | + if ($date != date('Y-m-d')) { |
|
| 502 | + unset($this->stats[$date]); |
|
| 503 | + } |
|
| 504 | + } |
|
| 505 | + if ($globalDebug) echo 'Done'."\n"; |
|
| 506 | 506 | } |
| 507 | 507 | $Stats->db = null; |
| 508 | - } |
|
| 508 | + } |
|
| 509 | 509 | |
| 510 | - $this->del(); |
|
| 510 | + $this->del(); |
|
| 511 | 511 | //$ignoreImport = false; |
| 512 | 512 | $this->all_tracked[$id]['addedMarine'] = 1; |
| 513 | 513 | //print_r($this->all_tracked[$id]); |
| 514 | 514 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 515 | - if ($globalDebug) echo "---- Deleting Live Marine data older than 12 hours..."; |
|
| 516 | - //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
| 517 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 515 | + if ($globalDebug) echo "---- Deleting Live Marine data older than 12 hours..."; |
|
| 516 | + //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
| 517 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 518 | 518 | $MarineLive = new MarineLive($this->db); |
| 519 | 519 | $MarineLive->deleteLiveMarineData(); |
| 520 | 520 | $MarineLive->db=null; |
| 521 | 521 | if ($globalDebug) echo " Done\n"; |
| 522 | - } |
|
| 523 | - $this->last_delete = time(); |
|
| 522 | + } |
|
| 523 | + $this->last_delete = time(); |
|
| 524 | 524 | } |
| 525 | - } elseif ($recent_ident != '') { |
|
| 525 | + } elseif ($recent_ident != '') { |
|
| 526 | 526 | $this->all_tracked[$id]['id'] = $recent_ident; |
| 527 | 527 | $this->all_tracked[$id]['addedMarine'] = 1; |
| 528 | 528 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 529 | - if ((isset($globalDaemon) && !$globalDaemon) || (isset($globalVM) && $globalVM)) { |
|
| 529 | + if ((isset($globalDaemon) && !$globalDaemon) || (isset($globalVM) && $globalVM)) { |
|
| 530 | 530 | $Marine = new Marine($this->db); |
| 531 | 531 | if (isset($globalVM) && $globalVM) { |
| 532 | - if ($this->all_tracked[$id]['status'] == 'Racing') { |
|
| 532 | + if ($this->all_tracked[$id]['status'] == 'Racing') { |
|
| 533 | 533 | $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
| 534 | - } else { |
|
| 534 | + } else { |
|
| 535 | 535 | //$finaldatetime = date('Y-m-d H:i:s',strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']); |
| 536 | 536 | $timerace = (strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']); |
| 537 | 537 | if ($timerace > time()) $finaldatetime = NULL; |
| 538 | 538 | else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
| 539 | 539 | |
| 540 | 540 | $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$finaldatetime,$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
| 541 | - } |
|
| 541 | + } |
|
| 542 | 542 | } else { |
| 543 | - $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
|
| 543 | + $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
|
| 544 | 544 | } |
| 545 | 545 | $Marine->db = null; |
| 546 | - } |
|
| 546 | + } |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | - } |
|
| 549 | + } |
|
| 550 | 550 | } |
| 551 | - } |
|
| 552 | - //adds the spotter LIVE data |
|
| 553 | - if ($globalDebug) { |
|
| 551 | + } |
|
| 552 | + //adds the spotter LIVE data |
|
| 553 | + if ($globalDebug) { |
|
| 554 | 554 | echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n"; |
| 555 | - } |
|
| 556 | - $ignoreImport = false; |
|
| 557 | - if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] == 'sailawayfull' && $this->all_tracked[$id]['status'] != 'Racing') $ignoreImport = true; |
|
| 558 | - if (!$ignoreImport) { |
|
| 555 | + } |
|
| 556 | + $ignoreImport = false; |
|
| 557 | + if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] == 'sailawayfull' && $this->all_tracked[$id]['status'] != 'Racing') $ignoreImport = true; |
|
| 558 | + if (!$ignoreImport) { |
|
| 559 | 559 | if ((!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) && (!isset($globalOnlyID) || in_array($id,$globalOnlyID))) { |
| 560 | 560 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
| 561 | 561 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 562 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 562 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 563 | 563 | $timeelapsed = microtime(true); |
| 564 | 564 | $MarineLive = new MarineLive($this->db); |
| 565 | 565 | $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
| 566 | 566 | $MarineLive->db = null; |
| 567 | 567 | if ($globalDebug) echo $result."\n"; |
| 568 | 568 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 569 | - } |
|
| 569 | + } |
|
| 570 | 570 | } |
| 571 | 571 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
| 572 | 572 | $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | if ($stats_heading == 16) $stats_heading = 0; |
| 602 | 602 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 603 | 603 | for ($i=0;$i<=15;$i++) { |
| 604 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 604 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 605 | 605 | } |
| 606 | 606 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
| 607 | 607 | } else { |
@@ -614,11 +614,11 @@ discard block |
||
| 614 | 614 | //var_dump($this->stats); |
| 615 | 615 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 616 | 616 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 617 | - end($this->stats[$current_date][$source]['hist']); |
|
| 618 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 617 | + end($this->stats[$current_date][$source]['hist']); |
|
| 618 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 619 | 619 | } else $mini = 0; |
| 620 | 620 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 621 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 621 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 622 | 622 | } |
| 623 | 623 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
| 624 | 624 | } else { |
@@ -634,30 +634,30 @@ discard block |
||
| 634 | 634 | |
| 635 | 635 | |
| 636 | 636 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 637 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 637 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 638 | 638 | if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
| 639 | 639 | $MarineLive = new MarineLive($this->db); |
| 640 | 640 | $MarineLive->deleteLiveMarineDataNotUpdated(); |
| 641 | 641 | $MarineLive->db = null; |
| 642 | 642 | //MarineLive->deleteLiveMarineData(); |
| 643 | 643 | if ($globalDebug) echo " Done\n"; |
| 644 | - } |
|
| 645 | - $this->last_delete_hourly = time(); |
|
| 644 | + } |
|
| 645 | + $this->last_delete_hourly = time(); |
|
| 646 | 646 | } |
| 647 | 647 | |
| 648 | - } |
|
| 649 | - //$ignoreImport = false; |
|
| 648 | + } |
|
| 649 | + //$ignoreImport = false; |
|
| 650 | 650 | } |
| 651 | 651 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 652 | 652 | if ($send) return $this->all_tracked[$id]; |
| 653 | - } |
|
| 653 | + } |
|
| 654 | + } |
|
| 654 | 655 | } |
| 655 | - } |
|
| 656 | 656 | |
| 657 | - public function race_add($data) { |
|
| 658 | - $Marine = new Marine(); |
|
| 659 | - $Marine->addRace($data['id'],$data['name'],$data['creator'],$data['desc'],$data['startdate'],$data['markers']); |
|
| 660 | - $Marine->db = null; |
|
| 661 | - } |
|
| 657 | + public function race_add($data) { |
|
| 658 | + $Marine = new Marine(); |
|
| 659 | + $Marine->addRace($data['id'],$data['name'],$data['creator'],$data['desc'],$data['startdate'],$data['markers']); |
|
| 660 | + $Marine->db = null; |
|
| 661 | + } |
|
| 662 | 662 | } |
| 663 | 663 | ?> |
@@ -68,15 +68,15 @@ discard block |
||
| 68 | 68 | $Marine = new Marine($this->db); |
| 69 | 69 | if (isset($globalVM) && $globalVM) { |
| 70 | 70 | if ($this->all_tracked[$key]['status'] == 'Racing') { |
| 71 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
| 71 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime'], $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
| 72 | 72 | } else { |
| 73 | - $timerace = (strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']); |
|
| 73 | + $timerace = (strtotime($this->all_tracked[$key]['race_begin']) + $this->all_tracked[$key]['race_time']); |
|
| 74 | 74 | if ($timerace > time()) $finaldatetime = NULL; |
| 75 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 76 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
| 75 | + else $finaldatetime = date('Y-m-d H:i:s', $timerace); |
|
| 76 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $finaldatetime, $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
| 77 | 77 | } |
| 78 | 78 | } else { |
| 79 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
| 79 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime'], $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
| 80 | 80 | } |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 90 | 90 | foreach ($this->all_tracked as $key => $flight) { |
| 91 | 91 | if (isset($flight['lastupdate'])) { |
| 92 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
| 92 | + if ($flight['lastupdate'] < (time() - 3000)) { |
|
| 93 | 93 | if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
| 94 | 94 | if (isset($this->all_tracked[$key]['id'])) { |
| 95 | 95 | if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
@@ -103,15 +103,15 @@ discard block |
||
| 103 | 103 | if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
| 104 | 104 | if (isset($globalVM) && $globalVM) { |
| 105 | 105 | if ($this->all_tracked[$key]['status'] == 'Racing') { |
| 106 | - $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
| 106 | + $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime'], $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
| 107 | 107 | } else { |
| 108 | - $timerace = strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']; |
|
| 108 | + $timerace = strtotime($this->all_tracked[$key]['race_begin']) + $this->all_tracked[$key]['race_time']; |
|
| 109 | 109 | if ($timerace > time()) $finaldatetime = NULL; |
| 110 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 111 | - $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
| 110 | + else $finaldatetime = date('Y-m-d H:i:s', $timerace); |
|
| 111 | + $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $finaldatetime, $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
| 112 | 112 | } |
| 113 | 113 | } else { |
| 114 | - $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
| 114 | + $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'], $this->all_tracked[$key]['ident'], $this->all_tracked[$key]['latitude'], $this->all_tracked[$key]['longitude'], $this->all_tracked[$key]['speed'], $this->all_tracked[$key]['datetime'], $this->all_tracked[$key]['distance'], $this->all_tracked[$key]['race_rank'], $this->all_tracked[$key]['race_time'], $this->all_tracked[$key]['status'], $this->all_tracked[$key]['race_begin']); |
|
| 115 | 115 | } |
| 116 | 116 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 117 | 117 | } |
@@ -126,14 +126,14 @@ discard block |
||
| 126 | 126 | } |
| 127 | 127 | |
| 128 | 128 | public function add($line) { |
| 129 | - global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine, $globalLiveInterval, $globalVM, $globalOnlyID; |
|
| 129 | + global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS, $APRSMarine, $globalLiveInterval, $globalVM, $globalOnlyID; |
|
| 130 | 130 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
| 131 | 131 | date_default_timezone_set('UTC'); |
| 132 | 132 | $dataFound = false; |
| 133 | 133 | $send = false; |
| 134 | 134 | |
| 135 | 135 | // SBS format is CSV format |
| 136 | - if(is_array($line) && (isset($line['mmsi']) || isset($line['id']))) { |
|
| 136 | + if (is_array($line) && (isset($line['mmsi']) || isset($line['id']))) { |
|
| 137 | 137 | //print_r($line); |
| 138 | 138 | if (isset($line['mmsi']) || isset($line['id'])) { |
| 139 | 139 | |
@@ -158,25 +158,25 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | if (!isset($this->all_tracked[$id])) { |
| 160 | 160 | $this->all_tracked[$id] = array(); |
| 161 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
| 162 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '','captain_id' => '','captain_name' => '','race_id' => '','race_name' => '','distance' => NULL,'race_rank' => NULL,'race_time' => NULL,'race_begin' => '')); |
|
| 163 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
| 161 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('addedMarine' => 0)); |
|
| 162 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => '', 'latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '', 'source_name' => '', 'comment'=> '', 'type' => '', 'typeid' => '', 'noarchive' => false, 'putinarchive' => true, 'over_country' => '', 'mmsi' => '', 'status' => '', 'status_id' => '', 'imo' => '', 'callsign' => '', 'arrival_code' => '', 'arrival_date' => '', 'mmsi_type' => '', 'captain_id' => '', 'captain_name' => '', 'race_id' => '', 'race_name' => '', 'distance' => NULL, 'race_rank' => NULL, 'race_time' => NULL, 'race_begin' => '')); |
|
| 163 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('lastupdate' => time())); |
|
| 164 | 164 | if (!isset($line['id'])) { |
| 165 | 165 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 166 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
|
| 167 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 166 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $id.'-'.date('YmdHi'))); |
|
| 167 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $line['id'])); |
|
| 168 | 168 | if ($globalAllTracked !== FALSE) $dataFound = true; |
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
| 172 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
| 172 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('mmsi' => $line['mmsi'])); |
|
| 173 | 173 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 174 | 174 | $Marine = new Marine($this->db); |
| 175 | 175 | $identity = $Marine->getIdentity($line['mmsi']); |
| 176 | 176 | if (!empty($identity)) { |
| 177 | 177 | $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
| 178 | 178 | $this->all_tracked[$id]['type'] = $identity['type']; |
| 179 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type']))); |
|
| 179 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('typeid' => $AIS->getShipTypeID($identity['type']))); |
|
| 180 | 180 | } |
| 181 | 181 | //print_r($identity); |
| 182 | 182 | unset($Marine); |
@@ -184,25 +184,25 @@ discard block |
||
| 184 | 184 | } |
| 185 | 185 | } |
| 186 | 186 | if (isset($line['type_id'])) { |
| 187 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
| 188 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id'])); |
|
| 187 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $AIS->getShipType($line['type_id']))); |
|
| 188 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('typeid' => $line['type_id'])); |
|
| 189 | 189 | } |
| 190 | 190 | if (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] == '') { |
| 191 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 192 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type']))); |
|
| 191 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type'])); |
|
| 192 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('typeid' => $AIS->getShipTypeID($line['type']))); |
|
| 193 | 193 | } elseif (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] != '') { |
| 194 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 194 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('type' => $line['type'])); |
|
| 195 | 195 | } |
| 196 | 196 | if (isset($line['status']) && $line['status'] != '') { |
| 197 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
| 197 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('status' => $line['status'])); |
|
| 198 | 198 | } |
| 199 | 199 | if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) { |
| 200 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
| 200 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('status_id' => $line['status_id'])); |
|
| 201 | 201 | if ($this->all_tracked[$id]['addedMarine'] == 1) { |
| 202 | 202 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 203 | 203 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 204 | 204 | $Marine = new Marine($this->db); |
| 205 | - $Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']); |
|
| 205 | + $Marine->updateStatusMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['status']); |
|
| 206 | 206 | unset($Marine); |
| 207 | 207 | } |
| 208 | 208 | } |
@@ -211,24 +211,24 @@ discard block |
||
| 211 | 211 | |
| 212 | 212 | |
| 213 | 213 | if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') { |
| 214 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
| 214 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('mmsi_type' => $line['mmsi_type'])); |
|
| 215 | 215 | } |
| 216 | 216 | if (isset($line['imo']) && $line['imo'] != '') { |
| 217 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
| 217 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('imo' => $line['imo'])); |
|
| 218 | 218 | } |
| 219 | 219 | if (isset($line['callsign']) && $line['callsign'] != '') { |
| 220 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
| 220 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('callsign' => $line['callsign'])); |
|
| 221 | 221 | } |
| 222 | 222 | if (isset($line['arrival_code']) && $line['arrival_code'] != '') { |
| 223 | 223 | if (!isset($this->all_tracked[$id]['arrival_code'])) { |
| 224 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
|
| 224 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('arrival_code' => $line['arrival_code'])); |
|
| 225 | 225 | if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
| 226 | 226 | if ($this->all_tracked[$id]['addedMarine'] != 0) { |
| 227 | 227 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 228 | 228 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 229 | 229 | $Marine = new Marine($this->db); |
| 230 | 230 | $fromsource = NULL; |
| 231 | - $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource); |
|
| 231 | + $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['arrival_code'], $fromsource); |
|
| 232 | 232 | $Marine->db = null; |
| 233 | 233 | } |
| 234 | 234 | } |
@@ -244,31 +244,31 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
| 247 | - if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 247 | + if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('arrival_date' => $line['arrival_date'])); |
|
| 248 | 248 | } |
| 249 | 249 | if (isset($line['captain_id']) && $line['captain_id'] != '') { |
| 250 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_id' => $line['captain_id'])); |
|
| 250 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('captain_id' => $line['captain_id'])); |
|
| 251 | 251 | } |
| 252 | 252 | if (isset($line['captain_name']) && $line['captain_name'] != '') { |
| 253 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_name' => $line['captain_name'])); |
|
| 253 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('captain_name' => $line['captain_name'])); |
|
| 254 | 254 | } |
| 255 | 255 | if (isset($line['race_id']) && $line['race_id'] != '') { |
| 256 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_id' => $line['race_id'])); |
|
| 256 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_id' => $line['race_id'])); |
|
| 257 | 257 | } |
| 258 | 258 | if (isset($line['race_name']) && $line['race_name'] != '') { |
| 259 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_name' => $line['race_name'])); |
|
| 259 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_name' => $line['race_name'])); |
|
| 260 | 260 | } |
| 261 | 261 | if (isset($line['race_rank']) && $line['race_rank'] != '') { |
| 262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_rank' => $line['race_rank'])); |
|
| 262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_rank' => $line['race_rank'])); |
|
| 263 | 263 | } |
| 264 | 264 | if (isset($line['race_time']) && $line['race_time'] != '') { |
| 265 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_time' => $line['race_time'])); |
|
| 265 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_time' => $line['race_time'])); |
|
| 266 | 266 | } |
| 267 | 267 | if (isset($line['race_begin']) && $line['race_begin'] != '') { |
| 268 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_begin' => $line['race_begin'])); |
|
| 268 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('race_begin' => $line['race_begin'])); |
|
| 269 | 269 | } |
| 270 | 270 | if (isset($line['distance']) && $line['distance'] != '') { |
| 271 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('distance' => $line['distance'])); |
|
| 271 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('distance' => $line['distance'])); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
@@ -277,44 +277,44 @@ discard block |
||
| 277 | 277 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 278 | 278 | $timeelapsed = microtime(true); |
| 279 | 279 | $Marine = new Marine($this->db); |
| 280 | - $Marine->addIdentity($this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['type']); |
|
| 280 | + $Marine->addIdentity($this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['type']); |
|
| 281 | 281 | $Marine->db = null; |
| 282 | 282 | } |
| 283 | 283 | } |
| 284 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 284 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('ident' => trim($line['ident']))); |
|
| 285 | 285 | if ($this->all_tracked[$id]['addedMarine'] == 1) { |
| 286 | 286 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 287 | 287 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 288 | 288 | $timeelapsed = microtime(true); |
| 289 | 289 | $Marine = new Marine($this->db); |
| 290 | 290 | $fromsource = NULL; |
| 291 | - $result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
| 291 | + $result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $fromsource); |
|
| 292 | 292 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 293 | 293 | $Marine->db = null; |
| 294 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 294 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 295 | 295 | } |
| 296 | 296 | } |
| 297 | 297 | } |
| 298 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 298 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['ident'])); |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) { |
|
| 301 | + if (isset($line['datetime']) && strtotime($line['datetime']) > time() - 30*60 && strtotime($line['datetime']) < time() + 20*60) { |
|
| 302 | 302 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
| 303 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
|
| 303 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => $line['datetime'])); |
|
| 304 | 304 | } else { |
| 305 | 305 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
| 306 | 306 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 307 | 307 | return ''; |
| 308 | 308 | } |
| 309 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) { |
|
| 309 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time() - 30*60) { |
|
| 310 | 310 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
| 311 | 311 | return ''; |
| 312 | - } elseif (isset($line['datetime']) && strtotime($line['datetime']) >= time()+20*60) { |
|
| 312 | + } elseif (isset($line['datetime']) && strtotime($line['datetime']) >= time() + 20*60) { |
|
| 313 | 313 | if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
| 314 | 314 | return ''; |
| 315 | 315 | } elseif (!isset($line['datetime'])) { |
| 316 | 316 | date_default_timezone_set('UTC'); |
| 317 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
|
| 317 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('datetime' => date('Y-m-d H:i:s'))); |
|
| 318 | 318 | } else { |
| 319 | 319 | if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." date: ".$line['datetime']." - format : ".$line['format_source']."!!!\n"; |
| 320 | 320 | return ''; |
@@ -322,20 +322,20 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | |
| 324 | 324 | if (isset($line['speed'])) { |
| 325 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'],2))); |
|
| 326 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 325 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($line['speed'], 2))); |
|
| 326 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed_fromsrc' => true)); |
|
| 327 | 327 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
| 328 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 328 | + $distance = $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm'); |
|
| 329 | 329 | if ($distance > 1000 && $distance < 10000) { |
| 330 | 330 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
| 331 | 331 | $speed = $speed*3.6; |
| 332 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed,2))); |
|
| 332 | + if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('speed' => round($speed, 2))); |
|
| 333 | 333 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['id']." : ".$speed." - distance : ".$distance."\n"; |
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
| 338 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 338 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time() - $this->all_tracked[$id]['time_last_coord']); |
|
| 339 | 339 | else unset($timediff); |
| 340 | 340 | if ($this->tmd > 5 || |
| 341 | 341 | !isset($timediff) || |
@@ -344,11 +344,11 @@ discard block |
||
| 344 | 344 | $timediff > 30 && |
| 345 | 345 | isset($this->all_tracked[$id]['latitude']) && |
| 346 | 346 | isset($this->all_tracked[$id]['longitude']) && |
| 347 | - $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')) |
|
| 347 | + $Common->withinThreshold($timediff, $Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')) |
|
| 348 | 348 | ) |
| 349 | 349 | ) { |
| 350 | 350 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
| 351 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
| 351 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['livedb_latitude'], $this->all_tracked[$id]['livedb_longitude'], $line['latitude'], $line['longitude'])) { |
|
| 352 | 352 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 353 | 353 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 354 | 354 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -357,10 +357,10 @@ discard block |
||
| 357 | 357 | $timeelapsed = microtime(true); |
| 358 | 358 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 359 | 359 | $Marine = new Marine($this->db); |
| 360 | - $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 360 | + $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'], $line['longitude']); |
|
| 361 | 361 | if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
| 362 | 362 | $Marine->db = null; |
| 363 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 363 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 364 | 364 | } |
| 365 | 365 | $this->tmd = 0; |
| 366 | 366 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
@@ -369,55 +369,55 @@ discard block |
||
| 369 | 369 | |
| 370 | 370 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 371 | 371 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 372 | - if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
| 372 | + if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude'] - $line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
| 373 | 373 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
| 374 | 374 | $dataFound = true; |
| 375 | 375 | $this->all_tracked[$id]['time_last_coord'] = time(); |
| 376 | 376 | } |
| 377 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
|
| 377 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('latitude' => $line['latitude'])); |
|
| 378 | 378 | } |
| 379 | 379 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 380 | 380 | if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
| 381 | 381 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 382 | - if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
| 382 | + if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude'] - $line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
|
| 383 | 383 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
| 384 | 384 | $dataFound = true; |
| 385 | 385 | $this->all_tracked[$id]['time_last_coord'] = time(); |
| 386 | 386 | } |
| 387 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
|
| 387 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('longitude' => $line['longitude'])); |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | } else if ($globalDebug && $timediff > 20) { |
| 391 | 391 | $this->tmd = $this->tmd + 1; |
| 392 | 392 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
| 393 | - echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
|
| 394 | - echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
|
| 393 | + echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')."m -"; |
|
| 394 | + echo 'Speed : '.(($Common->distance($line['latitude'], $line['longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], 'm')/$timediff)*3.6)." km/h - "; |
|
| 395 | 395 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | 398 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 399 | 399 | if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
| 400 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 400 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('last_update' => $line['last_update'])); |
|
| 401 | 401 | } |
| 402 | 402 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 403 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 403 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('format_source' => $line['format_source'])); |
|
| 404 | 404 | } |
| 405 | 405 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 406 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 406 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('source_name' => $line['source_name'])); |
|
| 407 | 407 | } |
| 408 | 408 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 409 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 409 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('noarchive' => true)); |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | 412 | if (isset($line['heading']) && $line['heading'] != '') { |
| 413 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 414 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 415 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 413 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading'] - round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 414 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($line['heading']))); |
|
| 415 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading_fromsrc' => true)); |
|
| 416 | 416 | //$dataFound = true; |
| 417 | 417 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
| 418 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
| 419 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
| 420 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 418 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'], $this->all_tracked[$id]['archive_longitude'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
| 419 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('heading' => round($heading))); |
|
| 420 | + if (abs($this->all_tracked[$id]['heading'] - round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 421 | 421 | if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
| 422 | 422 | } |
| 423 | 423 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
@@ -427,7 +427,7 @@ discard block |
||
| 427 | 427 | if ($dataFound === true && (isset($this->all_tracked[$id]['mmsi']) || isset($this->all_tracked[$id]['id']))) { |
| 428 | 428 | $this->all_tracked[$id]['lastupdate'] = time(); |
| 429 | 429 | if ($this->all_tracked[$id]['addedMarine'] == 0 || (isset($globalVM) && $globalVM)) { |
| 430 | - if ((!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) && (!isset($globalOnlyID) || in_array($id,$globalOnlyID))) { |
|
| 430 | + if ((!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) && (!isset($globalOnlyID) || in_array($id, $globalOnlyID))) { |
|
| 431 | 431 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
| 432 | 432 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 433 | 433 | if ($globalDebug) echo "Check if vessel is already in DB..."; |
@@ -436,28 +436,28 @@ discard block |
||
| 436 | 436 | if (isset($line['id']) && isset($globalVM) && $globalVM) { |
| 437 | 437 | $Marine = new Marine($this->db); |
| 438 | 438 | $recent_ident = $Marine->checkId($line['id']); |
| 439 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkId : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 440 | - $Marine->db=null; |
|
| 439 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkId : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 440 | + $Marine->db = null; |
|
| 441 | 441 | } elseif (isset($line['id'])) { |
| 442 | 442 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
| 443 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 443 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 444 | 444 | } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
| 445 | 445 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
| 446 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 446 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 447 | 447 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
| 448 | 448 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
| 449 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 449 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 450 | 450 | } else $recent_ident = ''; |
| 451 | - $MarineLive->db=null; |
|
| 451 | + $MarineLive->db = null; |
|
| 452 | 452 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
| 453 | 453 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
| 454 | 454 | } else $recent_ident = ''; |
| 455 | 455 | } else { |
| 456 | 456 | $recent_ident = ''; |
| 457 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
|
| 457 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('forcenew' => 0)); |
|
| 458 | 458 | } |
| 459 | 459 | //if there was no vessel with the same callsign within the last hour and go post it into the archive |
| 460 | - if($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM))) |
|
| 460 | + if ($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM))) |
|
| 461 | 461 | { |
| 462 | 462 | if ($globalDebug) { |
| 463 | 463 | if ($this->all_tracked[$id]['mmsi'] != '') echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
@@ -465,19 +465,19 @@ discard block |
||
| 465 | 465 | } |
| 466 | 466 | //adds the spotter data for the archive |
| 467 | 467 | $highlight = ''; |
| 468 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
| 468 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id], array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
| 469 | 469 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 470 | 470 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 471 | 471 | $timeelapsed = microtime(true); |
| 472 | 472 | $Marine = new Marine($this->db); |
| 473 | 473 | if (isset($globalVM) && $globalVM && ($this->all_tracked[$id]['race_begin'] != '' || $this->all_tracked[$id]['format_source'] == 'sailaway')) { |
| 474 | - $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['race_begin'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
|
| 474 | + $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['race_begin'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['captain_id'], $this->all_tracked[$id]['captain_name'], $this->all_tracked[$id]['race_id'], $this->all_tracked[$id]['race_name'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time']); |
|
| 475 | 475 | } else { |
| 476 | - $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
|
| 476 | + $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['captain_id'], $this->all_tracked[$id]['captain_name'], $this->all_tracked[$id]['race_id'], $this->all_tracked[$id]['race_name'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time']); |
|
| 477 | 477 | } |
| 478 | 478 | $Marine->db = null; |
| 479 | 479 | if ($globalDebug && isset($result)) echo $result."\n"; |
| 480 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 480 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 481 | 481 | } |
| 482 | 482 | } |
| 483 | 483 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
@@ -485,15 +485,15 @@ discard block |
||
| 485 | 485 | $Stats = new Stats($this->db); |
| 486 | 486 | if (!empty($this->stats)) { |
| 487 | 487 | if ($globalDebug) echo 'Add source stats : '; |
| 488 | - foreach($this->stats as $date => $data) { |
|
| 489 | - foreach($data as $source => $sourced) { |
|
| 488 | + foreach ($this->stats as $date => $data) { |
|
| 489 | + foreach ($data as $source => $sourced) { |
|
| 490 | 490 | //print_r($sourced); |
| 491 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
| 492 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
| 491 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']), $source, 'polar_marine', $date); |
|
| 492 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']), $source, 'hist_marine', $date); |
|
| 493 | 493 | if (isset($sourced['msg'])) { |
| 494 | 494 | if (time() - $sourced['msg']['date'] > 10) { |
| 495 | 495 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
| 496 | - echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
| 496 | + echo $Stats->addStatSource($nbmsg, $source, 'msg_marine', $date); |
|
| 497 | 497 | unset($this->stats[$date][$source]['msg']); |
| 498 | 498 | } |
| 499 | 499 | } |
@@ -517,7 +517,7 @@ discard block |
||
| 517 | 517 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 518 | 518 | $MarineLive = new MarineLive($this->db); |
| 519 | 519 | $MarineLive->deleteLiveMarineData(); |
| 520 | - $MarineLive->db=null; |
|
| 520 | + $MarineLive->db = null; |
|
| 521 | 521 | if ($globalDebug) echo " Done\n"; |
| 522 | 522 | } |
| 523 | 523 | $this->last_delete = time(); |
@@ -530,17 +530,17 @@ discard block |
||
| 530 | 530 | $Marine = new Marine($this->db); |
| 531 | 531 | if (isset($globalVM) && $globalVM) { |
| 532 | 532 | if ($this->all_tracked[$id]['status'] == 'Racing') { |
| 533 | - $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
|
| 533 | + $Marine->updateLatestMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['race_begin']); |
|
| 534 | 534 | } else { |
| 535 | 535 | //$finaldatetime = date('Y-m-d H:i:s',strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']); |
| 536 | - $timerace = (strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']); |
|
| 536 | + $timerace = (strtotime($this->all_tracked[$id]['race_begin']) + $this->all_tracked[$id]['race_time']); |
|
| 537 | 537 | if ($timerace > time()) $finaldatetime = NULL; |
| 538 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 538 | + else $finaldatetime = date('Y-m-d H:i:s', $timerace); |
|
| 539 | 539 | |
| 540 | - $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$finaldatetime,$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
|
| 540 | + $Marine->updateLatestMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['speed'], $finaldatetime, $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['race_begin']); |
|
| 541 | 541 | } |
| 542 | 542 | } else { |
| 543 | - $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
|
| 543 | + $Marine->updateLatestMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['race_begin']); |
|
| 544 | 544 | } |
| 545 | 545 | $Marine->db = null; |
| 546 | 546 | } |
@@ -556,20 +556,20 @@ discard block |
||
| 556 | 556 | $ignoreImport = false; |
| 557 | 557 | if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] == 'sailawayfull' && $this->all_tracked[$id]['status'] != 'Racing') $ignoreImport = true; |
| 558 | 558 | if (!$ignoreImport) { |
| 559 | - if ((!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) && (!isset($globalOnlyID) || in_array($id,$globalOnlyID))) { |
|
| 559 | + if ((!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) && (!isset($globalOnlyID) || in_array($id, $globalOnlyID))) { |
|
| 560 | 560 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
| 561 | 561 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 562 | 562 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 563 | 563 | $timeelapsed = microtime(true); |
| 564 | 564 | $MarineLive = new MarineLive($this->db); |
| 565 | - $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
|
| 565 | + $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country'], $this->all_tracked[$id]['captain_id'], $this->all_tracked[$id]['captain_name'], $this->all_tracked[$id]['race_id'], $this->all_tracked[$id]['race_name'], $this->all_tracked[$id]['distance'], $this->all_tracked[$id]['race_rank'], $this->all_tracked[$id]['race_time']); |
|
| 566 | 566 | $MarineLive->db = null; |
| 567 | 567 | if ($globalDebug) echo $result."\n"; |
| 568 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 568 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true) - $timeelapsed, 2).'s'."\n"; |
|
| 569 | 569 | } |
| 570 | 570 | } |
| 571 | 571 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
| 572 | - $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
|
| 572 | + $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'], $this->all_tracked[$id]['typeid'], $this->all_tracked[$id]['imo'], $this->all_tracked[$id]['callsign'], $this->all_tracked[$id]['arrival_code'], $this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'], $this->all_tracked[$id]['noarchive'], $this->all_tracked[$id]['format_source'], $this->all_tracked[$id]['source_name'], $this->all_tracked[$id]['over_country']); |
|
| 573 | 573 | } |
| 574 | 574 | $this->all_tracked[$id]['putinarchive'] = false; |
| 575 | 575 | |
@@ -588,19 +588,19 @@ discard block |
||
| 588 | 588 | $latitude = $globalCenterLatitude; |
| 589 | 589 | $longitude = $globalCenterLongitude; |
| 590 | 590 | } |
| 591 | - $this->source_location[$source] = array('latitude' => $latitude,'longitude' => $longitude); |
|
| 591 | + $this->source_location[$source] = array('latitude' => $latitude, 'longitude' => $longitude); |
|
| 592 | 592 | } else { |
| 593 | 593 | $latitude = $this->source_location[$source]['latitude']; |
| 594 | 594 | $longitude = $this->source_location[$source]['longitude']; |
| 595 | 595 | } |
| 596 | - $stats_heading = $Common->getHeading($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
| 596 | + $stats_heading = $Common->getHeading($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
| 597 | 597 | //$stats_heading = $stats_heading%22.5; |
| 598 | 598 | $stats_heading = round($stats_heading/22.5); |
| 599 | - $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
| 599 | + $stats_distance = $Common->distance($latitude, $longitude, $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude']); |
|
| 600 | 600 | $current_date = date('Y-m-d'); |
| 601 | 601 | if ($stats_heading == 16) $stats_heading = 0; |
| 602 | 602 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 603 | - for ($i=0;$i<=15;$i++) { |
|
| 603 | + for ($i = 0; $i <= 15; $i++) { |
|
| 604 | 604 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
| 605 | 605 | } |
| 606 | 606 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
@@ -615,9 +615,9 @@ discard block |
||
| 615 | 615 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 616 | 616 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 617 | 617 | end($this->stats[$current_date][$source]['hist']); |
| 618 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 618 | + $mini = key($this->stats[$current_date][$source]['hist']) + 10; |
|
| 619 | 619 | } else $mini = 0; |
| 620 | - for ($i=$mini;$i<=$distance;$i+=10) { |
|
| 620 | + for ($i = $mini; $i <= $distance; $i += 10) { |
|
| 621 | 621 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
| 622 | 622 | } |
| 623 | 623 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | |
| 630 | 630 | $this->all_tracked[$id]['lastupdate'] = time(); |
| 631 | 631 | if ($this->all_tracked[$id]['putinarchive']) $send = true; |
| 632 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 632 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $globalDistanceIgnore['latitude'], $globalDistanceIgnore['longitude'])."\n"; |
|
| 633 | 633 | //$this->del(); |
| 634 | 634 | |
| 635 | 635 | |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | |
| 657 | 657 | public function race_add($data) { |
| 658 | 658 | $Marine = new Marine(); |
| 659 | - $Marine->addRace($data['id'],$data['name'],$data['creator'],$data['desc'],$data['startdate'],$data['markers']); |
|
| 659 | + $Marine->addRace($data['id'], $data['name'], $data['creator'], $data['desc'], $data['startdate'], $data['markers']); |
|
| 660 | 660 | $Marine->db = null; |
| 661 | 661 | } |
| 662 | 662 | } |
@@ -61,7 +61,9 @@ discard block |
||
| 61 | 61 | public function checkAll() { |
| 62 | 62 | global $globalDebug, $globalNoDB, $globalVM; |
| 63 | 63 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 64 | - if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
| 64 | + if ($globalDebug) { |
|
| 65 | + echo "Update last seen tracked data...\n"; |
|
| 66 | + } |
|
| 65 | 67 | foreach ($this->all_tracked as $key => $flight) { |
| 66 | 68 | if (isset($this->all_tracked[$key]['id'])) { |
| 67 | 69 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
@@ -71,8 +73,11 @@ discard block |
||
| 71 | 73 | $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 72 | 74 | } else { |
| 73 | 75 | $timerace = (strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']); |
| 74 | - if ($timerace > time()) $finaldatetime = NULL; |
|
| 75 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 76 | + if ($timerace > time()) { |
|
| 77 | + $finaldatetime = NULL; |
|
| 78 | + } else { |
|
| 79 | + $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 80 | + } |
|
| 76 | 81 | $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 77 | 82 | } |
| 78 | 83 | } else { |
@@ -86,13 +91,17 @@ discard block |
||
| 86 | 91 | public function del() { |
| 87 | 92 | global $globalDebug, $globalNoDB, $globalNoImport; |
| 88 | 93 | // Delete old infos |
| 89 | - if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
|
| 94 | + if ($globalDebug) { |
|
| 95 | + echo 'Delete old values and update latest data...'."\n"; |
|
| 96 | + } |
|
| 90 | 97 | foreach ($this->all_tracked as $key => $flight) { |
| 91 | 98 | if (isset($flight['lastupdate'])) { |
| 92 | 99 | if ($flight['lastupdate'] < (time()-3000)) { |
| 93 | 100 | if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
| 94 | 101 | if (isset($this->all_tracked[$key]['id'])) { |
| 95 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 102 | + if ($globalDebug) { |
|
| 103 | + echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 104 | + } |
|
| 96 | 105 | /* |
| 97 | 106 | $MarineLive = new MarineLive(); |
| 98 | 107 | $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']); |
@@ -106,14 +115,19 @@ discard block |
||
| 106 | 115 | $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 107 | 116 | } else { |
| 108 | 117 | $timerace = strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']; |
| 109 | - if ($timerace > time()) $finaldatetime = NULL; |
|
| 110 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 118 | + if ($timerace > time()) { |
|
| 119 | + $finaldatetime = NULL; |
|
| 120 | + } else { |
|
| 121 | + $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 122 | + } |
|
| 111 | 123 | $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 112 | 124 | } |
| 113 | 125 | } else { |
| 114 | 126 | $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
| 115 | 127 | } |
| 116 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 128 | + if ($globalDebug && $result != 'success') { |
|
| 129 | + echo '!!! ERROR : '.$result."\n"; |
|
| 130 | + } |
|
| 117 | 131 | } |
| 118 | 132 | // Put in archive |
| 119 | 133 | // $Marine->db = null; |
@@ -127,7 +141,9 @@ discard block |
||
| 127 | 141 | |
| 128 | 142 | public function add($line) { |
| 129 | 143 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine, $globalLiveInterval, $globalVM, $globalOnlyID; |
| 130 | - if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
|
| 144 | + if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') { |
|
| 145 | + $globalCoordMinChange = '0.02'; |
|
| 146 | + } |
|
| 131 | 147 | date_default_timezone_set('UTC'); |
| 132 | 148 | $dataFound = false; |
| 133 | 149 | $send = false; |
@@ -141,20 +157,30 @@ discard block |
||
| 141 | 157 | // Increment message number |
| 142 | 158 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
| 143 | 159 | $current_date = date('Y-m-d'); |
| 144 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 145 | - else $source = ''; |
|
| 146 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 160 | + if (isset($line['source_name'])) { |
|
| 161 | + $source = $line['source_name']; |
|
| 162 | + } else { |
|
| 163 | + $source = ''; |
|
| 164 | + } |
|
| 165 | + if ($source == '' || $line['format_source'] == 'aprs') { |
|
| 166 | + $source = $line['format_source']; |
|
| 167 | + } |
|
| 147 | 168 | if (!isset($this->stats[$current_date][$source]['msg'])) { |
| 148 | 169 | $this->stats[$current_date][$source]['msg']['date'] = time(); |
| 149 | 170 | $this->stats[$current_date][$source]['msg']['nb'] = 1; |
| 150 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 171 | + } else { |
|
| 172 | + $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 173 | + } |
|
| 151 | 174 | } |
| 152 | 175 | |
| 153 | 176 | |
| 154 | 177 | $Common = new Common(); |
| 155 | 178 | $AIS = new AIS(); |
| 156 | - if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
| 157 | - else $id = trim($line['id']); |
|
| 179 | + if (!isset($line['id'])) { |
|
| 180 | + $id = trim($line['mmsi']); |
|
| 181 | + } else { |
|
| 182 | + $id = trim($line['id']); |
|
| 183 | + } |
|
| 158 | 184 | |
| 159 | 185 | if (!isset($this->all_tracked[$id])) { |
| 160 | 186 | $this->all_tracked[$id] = array(); |
@@ -162,10 +188,16 @@ discard block |
||
| 162 | 188 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '','captain_id' => '','captain_name' => '','race_id' => '','race_name' => '','distance' => NULL,'race_rank' => NULL,'race_time' => NULL,'race_begin' => '')); |
| 163 | 189 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
| 164 | 190 | if (!isset($line['id'])) { |
| 165 | - if (!isset($globalDaemon)) $globalDaemon = TRUE; |
|
| 191 | + if (!isset($globalDaemon)) { |
|
| 192 | + $globalDaemon = TRUE; |
|
| 193 | + } |
|
| 166 | 194 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
| 167 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 168 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
| 195 | + } else { |
|
| 196 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 197 | + } |
|
| 198 | + if ($globalAllTracked !== FALSE) { |
|
| 199 | + $dataFound = true; |
|
| 200 | + } |
|
| 169 | 201 | } |
| 170 | 202 | |
| 171 | 203 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
@@ -222,7 +254,9 @@ discard block |
||
| 222 | 254 | if (isset($line['arrival_code']) && $line['arrival_code'] != '') { |
| 223 | 255 | if (!isset($this->all_tracked[$id]['arrival_code'])) { |
| 224 | 256 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
| 225 | - if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
|
| 257 | + if ($globalDebug) { |
|
| 258 | + echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
|
| 259 | + } |
|
| 226 | 260 | if ($this->all_tracked[$id]['addedMarine'] != 0) { |
| 227 | 261 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 228 | 262 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
@@ -235,7 +269,9 @@ discard block |
||
| 235 | 269 | } |
| 236 | 270 | } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) { |
| 237 | 271 | $this->all_tracked[$id]['arrival_code'] = $line['arrival_code']; |
| 238 | - if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
|
| 272 | + if ($globalDebug) { |
|
| 273 | + echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
|
| 274 | + } |
|
| 239 | 275 | if (!isset($line['id'])) { |
| 240 | 276 | $this->all_tracked[$id]['id'] = $id.'-'.date('YmdHi'); |
| 241 | 277 | $this->all_tracked[$id]['forcenew'] = 1; |
@@ -244,7 +280,9 @@ discard block |
||
| 244 | 280 | } |
| 245 | 281 | } |
| 246 | 282 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
| 247 | - if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 283 | + if (strtotime($line['arrival_date']) > time()) { |
|
| 284 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 285 | + } |
|
| 248 | 286 | } |
| 249 | 287 | if (isset($line['captain_id']) && $line['captain_id'] != '') { |
| 250 | 288 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_id' => $line['captain_id'])); |
@@ -289,34 +327,49 @@ discard block |
||
| 289 | 327 | $Marine = new Marine($this->db); |
| 290 | 328 | $fromsource = NULL; |
| 291 | 329 | $result = $Marine->updateIdentMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
| 292 | - if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
|
| 330 | + if ($globalDebug && $result != 'success') { |
|
| 331 | + echo '!!! ERROR : '.$result."\n"; |
|
| 332 | + } |
|
| 293 | 333 | $Marine->db = null; |
| 294 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 334 | + if ($globalDebugTimeElapsed) { |
|
| 335 | + echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 336 | + } |
|
| 295 | 337 | } |
| 296 | 338 | } |
| 297 | 339 | } |
| 298 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 340 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
| 341 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 342 | + } |
|
| 299 | 343 | } |
| 300 | 344 | |
| 301 | 345 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) { |
| 302 | 346 | if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
| 303 | 347 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
| 304 | 348 | } else { |
| 305 | - if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
|
| 306 | - elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 349 | + if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
| 350 | + echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
|
| 351 | + } elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) { |
|
| 352 | + echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
|
| 353 | + } |
|
| 307 | 354 | return ''; |
| 308 | 355 | } |
| 309 | 356 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) { |
| 310 | - if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
|
| 357 | + if ($globalDebug) { |
|
| 358 | + echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
|
| 359 | + } |
|
| 311 | 360 | return ''; |
| 312 | 361 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) >= time()+20*60) { |
| 313 | - if ($globalDebug) echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
|
| 362 | + if ($globalDebug) { |
|
| 363 | + echo "!!! Date is in the future ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
|
| 364 | + } |
|
| 314 | 365 | return ''; |
| 315 | 366 | } elseif (!isset($line['datetime'])) { |
| 316 | 367 | date_default_timezone_set('UTC'); |
| 317 | 368 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => date('Y-m-d H:i:s'))); |
| 318 | 369 | } else { |
| 319 | - if ($globalDebug) echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." date: ".$line['datetime']." - format : ".$line['format_source']."!!!\n"; |
|
| 370 | + if ($globalDebug) { |
|
| 371 | + echo "!!! Unknow date error ".$this->all_tracked[$id]['mmsi']." date: ".$line['datetime']." - format : ".$line['format_source']."!!!\n"; |
|
| 372 | + } |
|
| 320 | 373 | return ''; |
| 321 | 374 | } |
| 322 | 375 | |
@@ -329,14 +382,21 @@ discard block |
||
| 329 | 382 | if ($distance > 1000 && $distance < 10000) { |
| 330 | 383 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
| 331 | 384 | $speed = $speed*3.6; |
| 332 | - if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed,2))); |
|
| 333 | - if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['id']." : ".$speed." - distance : ".$distance."\n"; |
|
| 385 | + if ($speed < 1000) { |
|
| 386 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed,2))); |
|
| 387 | + } |
|
| 388 | + if ($globalDebug) { |
|
| 389 | + echo "ø Calculated Speed for ".$this->all_tracked[$id]['id']." : ".$speed." - distance : ".$distance."\n"; |
|
| 390 | + } |
|
| 334 | 391 | } |
| 335 | 392 | } |
| 336 | 393 | |
| 337 | 394 | if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
| 338 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 339 | - else unset($timediff); |
|
| 395 | + if (isset($this->all_tracked[$id]['time_last_coord'])) { |
|
| 396 | + $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 397 | + } else { |
|
| 398 | + unset($timediff); |
|
| 399 | + } |
|
| 340 | 400 | if ($this->tmd > 5 || |
| 341 | 401 | !isset($timediff) || |
| 342 | 402 | $timediff > $globalLiveInterval || |
@@ -353,22 +413,32 @@ discard block |
||
| 353 | 413 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 354 | 414 | $this->all_tracked[$id]['putinarchive'] = true; |
| 355 | 415 | |
| 356 | - if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 416 | + if ($globalDebug) { |
|
| 417 | + echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
|
| 418 | + } |
|
| 357 | 419 | $timeelapsed = microtime(true); |
| 358 | 420 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 359 | 421 | $Marine = new Marine($this->db); |
| 360 | 422 | $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
| 361 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 423 | + if (!empty($all_country)) { |
|
| 424 | + $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 425 | + } |
|
| 362 | 426 | $Marine->db = null; |
| 363 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 427 | + if ($globalDebugTimeElapsed) { |
|
| 428 | + echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 429 | + } |
|
| 364 | 430 | } |
| 365 | 431 | $this->tmd = 0; |
| 366 | - if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
| 432 | + if ($globalDebug) { |
|
| 433 | + echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
|
| 434 | + } |
|
| 367 | 435 | } |
| 368 | 436 | } |
| 369 | 437 | |
| 370 | 438 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 371 | - if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
| 439 | + if (!isset($this->all_tracked[$id]['archive_latitude'])) { |
|
| 440 | + $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
|
| 441 | + } |
|
| 372 | 442 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
| 373 | 443 | $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
| 374 | 444 | $dataFound = true; |
@@ -377,8 +447,12 @@ discard block |
||
| 377 | 447 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
| 378 | 448 | } |
| 379 | 449 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 380 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 381 | - if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
| 450 | + if ($line['longitude'] > 180) { |
|
| 451 | + $line['longitude'] = $line['longitude'] - 360; |
|
| 452 | + } |
|
| 453 | + if (!isset($this->all_tracked[$id]['archive_longitude'])) { |
|
| 454 | + $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
|
| 455 | + } |
|
| 382 | 456 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
| 383 | 457 | $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
| 384 | 458 | $dataFound = true; |
@@ -396,7 +470,9 @@ discard block |
||
| 396 | 470 | } |
| 397 | 471 | } |
| 398 | 472 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 399 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 473 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) { |
|
| 474 | + $dataFound = true; |
|
| 475 | + } |
|
| 400 | 476 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
| 401 | 477 | } |
| 402 | 478 | if (isset($line['format_source']) && $line['format_source'] != '') { |
@@ -410,15 +486,21 @@ discard block |
||
| 410 | 486 | } |
| 411 | 487 | |
| 412 | 488 | if (isset($line['heading']) && $line['heading'] != '') { |
| 413 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 489 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) { |
|
| 490 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
| 491 | + } |
|
| 414 | 492 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
| 415 | 493 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
| 416 | 494 | //$dataFound = true; |
| 417 | 495 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
| 418 | 496 | $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
| 419 | 497 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
| 420 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 421 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 498 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) { |
|
| 499 | + $this->all_tracked[$id]['putinarchive'] = true; |
|
| 500 | + } |
|
| 501 | + if ($globalDebug) { |
|
| 502 | + echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 503 | + } |
|
| 422 | 504 | } |
| 423 | 505 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
| 424 | 506 | |
@@ -430,28 +512,45 @@ discard block |
||
| 430 | 512 | if ((!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) && (!isset($globalOnlyID) || in_array($id,$globalOnlyID))) { |
| 431 | 513 | if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
| 432 | 514 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 433 | - if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
| 515 | + if ($globalDebug) { |
|
| 516 | + echo "Check if vessel is already in DB..."; |
|
| 517 | + } |
|
| 434 | 518 | $timeelapsed = microtime(true); |
| 435 | 519 | $MarineLive = new MarineLive($this->db); |
| 436 | 520 | if (isset($line['id']) && isset($globalVM) && $globalVM) { |
| 437 | 521 | $Marine = new Marine($this->db); |
| 438 | 522 | $recent_ident = $Marine->checkId($line['id']); |
| 439 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkId : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 523 | + if ($globalDebugTimeElapsed) { |
|
| 524 | + echo 'Time elapsed for update checkId : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 525 | + } |
|
| 440 | 526 | $Marine->db=null; |
| 441 | 527 | } elseif (isset($line['id'])) { |
| 442 | 528 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
| 443 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 529 | + if ($globalDebugTimeElapsed) { |
|
| 530 | + echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 531 | + } |
|
| 444 | 532 | } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
| 445 | 533 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
| 446 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 534 | + if ($globalDebugTimeElapsed) { |
|
| 535 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 536 | + } |
|
| 447 | 537 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
| 448 | 538 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
| 449 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 450 | - } else $recent_ident = ''; |
|
| 539 | + if ($globalDebugTimeElapsed) { |
|
| 540 | + echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 541 | + } |
|
| 542 | + } else { |
|
| 543 | + $recent_ident = ''; |
|
| 544 | + } |
|
| 451 | 545 | $MarineLive->db=null; |
| 452 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 453 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 454 | - } else $recent_ident = ''; |
|
| 546 | + if ($globalDebug && $recent_ident == '') { |
|
| 547 | + echo " Not in DB.\n"; |
|
| 548 | + } elseif ($globalDebug && $recent_ident != '') { |
|
| 549 | + echo " Already in DB.\n"; |
|
| 550 | + } |
|
| 551 | + } else { |
|
| 552 | + $recent_ident = ''; |
|
| 553 | + } |
|
| 455 | 554 | } else { |
| 456 | 555 | $recent_ident = ''; |
| 457 | 556 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
@@ -460,12 +559,17 @@ discard block |
||
| 460 | 559 | if($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM))) |
| 461 | 560 | { |
| 462 | 561 | if ($globalDebug) { |
| 463 | - if ($this->all_tracked[$id]['mmsi'] != '') echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
|
| 464 | - else echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
|
| 562 | + if ($this->all_tracked[$id]['mmsi'] != '') { |
|
| 563 | + echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
|
| 564 | + } else { |
|
| 565 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
|
| 566 | + } |
|
| 465 | 567 | } |
| 466 | 568 | //adds the spotter data for the archive |
| 467 | 569 | $highlight = ''; |
| 468 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
| 570 | + if (!isset($this->all_tracked[$id]['id'])) { |
|
| 571 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
| 572 | + } |
|
| 469 | 573 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 470 | 574 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 471 | 575 | $timeelapsed = microtime(true); |
@@ -476,20 +580,30 @@ discard block |
||
| 476 | 580 | $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
| 477 | 581 | } |
| 478 | 582 | $Marine->db = null; |
| 479 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 480 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 583 | + if ($globalDebug && isset($result)) { |
|
| 584 | + echo $result."\n"; |
|
| 585 | + } |
|
| 586 | + if ($globalDebugTimeElapsed) { |
|
| 587 | + echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 588 | + } |
|
| 481 | 589 | } |
| 482 | 590 | } |
| 483 | 591 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
| 484 | 592 | // Add source stat in DB |
| 485 | 593 | $Stats = new Stats($this->db); |
| 486 | 594 | if (!empty($this->stats)) { |
| 487 | - if ($globalDebug) echo 'Add source stats : '; |
|
| 595 | + if ($globalDebug) { |
|
| 596 | + echo 'Add source stats : '; |
|
| 597 | + } |
|
| 488 | 598 | foreach($this->stats as $date => $data) { |
| 489 | 599 | foreach($data as $source => $sourced) { |
| 490 | 600 | //print_r($sourced); |
| 491 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
| 492 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
| 601 | + if (isset($sourced['polar'])) { |
|
| 602 | + echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
| 603 | + } |
|
| 604 | + if (isset($sourced['hist'])) { |
|
| 605 | + echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
| 606 | + } |
|
| 493 | 607 | if (isset($sourced['msg'])) { |
| 494 | 608 | if (time() - $sourced['msg']['date'] > 10) { |
| 495 | 609 | $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
@@ -502,7 +616,9 @@ discard block |
||
| 502 | 616 | unset($this->stats[$date]); |
| 503 | 617 | } |
| 504 | 618 | } |
| 505 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 619 | + if ($globalDebug) { |
|
| 620 | + echo 'Done'."\n"; |
|
| 621 | + } |
|
| 506 | 622 | } |
| 507 | 623 | $Stats->db = null; |
| 508 | 624 | } |
@@ -512,13 +628,17 @@ discard block |
||
| 512 | 628 | $this->all_tracked[$id]['addedMarine'] = 1; |
| 513 | 629 | //print_r($this->all_tracked[$id]); |
| 514 | 630 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 515 | - if ($globalDebug) echo "---- Deleting Live Marine data older than 12 hours..."; |
|
| 631 | + if ($globalDebug) { |
|
| 632 | + echo "---- Deleting Live Marine data older than 12 hours..."; |
|
| 633 | + } |
|
| 516 | 634 | //MarineLive->deleteLiveMarineDataNotUpdated(); |
| 517 | 635 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 518 | 636 | $MarineLive = new MarineLive($this->db); |
| 519 | 637 | $MarineLive->deleteLiveMarineData(); |
| 520 | 638 | $MarineLive->db=null; |
| 521 | - if ($globalDebug) echo " Done\n"; |
|
| 639 | + if ($globalDebug) { |
|
| 640 | + echo " Done\n"; |
|
| 641 | + } |
|
| 522 | 642 | } |
| 523 | 643 | $this->last_delete = time(); |
| 524 | 644 | } |
@@ -534,8 +654,11 @@ discard block |
||
| 534 | 654 | } else { |
| 535 | 655 | //$finaldatetime = date('Y-m-d H:i:s',strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']); |
| 536 | 656 | $timerace = (strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']); |
| 537 | - if ($timerace > time()) $finaldatetime = NULL; |
|
| 538 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 657 | + if ($timerace > time()) { |
|
| 658 | + $finaldatetime = NULL; |
|
| 659 | + } else { |
|
| 660 | + $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
| 661 | + } |
|
| 539 | 662 | |
| 540 | 663 | $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$finaldatetime,$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
| 541 | 664 | } |
@@ -554,18 +677,26 @@ discard block |
||
| 554 | 677 | echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n"; |
| 555 | 678 | } |
| 556 | 679 | $ignoreImport = false; |
| 557 | - if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] == 'sailawayfull' && $this->all_tracked[$id]['status'] != 'Racing') $ignoreImport = true; |
|
| 680 | + if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] == 'sailawayfull' && $this->all_tracked[$id]['status'] != 'Racing') { |
|
| 681 | + $ignoreImport = true; |
|
| 682 | + } |
|
| 558 | 683 | if (!$ignoreImport) { |
| 559 | 684 | if ((!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) && (!isset($globalOnlyID) || in_array($id,$globalOnlyID))) { |
| 560 | - if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
| 685 | + if ($globalDebug) { |
|
| 686 | + echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
|
| 687 | + } |
|
| 561 | 688 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 562 | 689 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 563 | 690 | $timeelapsed = microtime(true); |
| 564 | 691 | $MarineLive = new MarineLive($this->db); |
| 565 | 692 | $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
| 566 | 693 | $MarineLive->db = null; |
| 567 | - if ($globalDebug) echo $result."\n"; |
|
| 568 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 694 | + if ($globalDebug) { |
|
| 695 | + echo $result."\n"; |
|
| 696 | + } |
|
| 697 | + if ($globalDebugTimeElapsed) { |
|
| 698 | + echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 699 | + } |
|
| 569 | 700 | } |
| 570 | 701 | } |
| 571 | 702 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
@@ -577,7 +708,9 @@ discard block |
||
| 577 | 708 | |
| 578 | 709 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $line['format_source'] != 'aprs' && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
| 579 | 710 | $source = $this->all_tracked[$id]['source_name']; |
| 580 | - if ($source == '') $source = $this->all_tracked[$id]['format_source']; |
|
| 711 | + if ($source == '') { |
|
| 712 | + $source = $this->all_tracked[$id]['format_source']; |
|
| 713 | + } |
|
| 581 | 714 | if (!isset($this->source_location[$source])) { |
| 582 | 715 | $Location = new Source($this->db); |
| 583 | 716 | $coord = $Location->getLocationInfobySourceName($source); |
@@ -598,7 +731,9 @@ discard block |
||
| 598 | 731 | $stats_heading = round($stats_heading/22.5); |
| 599 | 732 | $stats_distance = $Common->distance($latitude,$longitude,$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
| 600 | 733 | $current_date = date('Y-m-d'); |
| 601 | - if ($stats_heading == 16) $stats_heading = 0; |
|
| 734 | + if ($stats_heading == 16) { |
|
| 735 | + $stats_heading = 0; |
|
| 736 | + } |
|
| 602 | 737 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 603 | 738 | for ($i=0;$i<=15;$i++) { |
| 604 | 739 | $this->stats[$current_date][$source]['polar'][$i] = 0; |
@@ -616,7 +751,9 @@ discard block |
||
| 616 | 751 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 617 | 752 | end($this->stats[$current_date][$source]['hist']); |
| 618 | 753 | $mini = key($this->stats[$current_date][$source]['hist'])+10; |
| 619 | - } else $mini = 0; |
|
| 754 | + } else { |
|
| 755 | + $mini = 0; |
|
| 756 | + } |
|
| 620 | 757 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 621 | 758 | $this->stats[$current_date][$source]['hist'][$i] = 0; |
| 622 | 759 | } |
@@ -628,19 +765,27 @@ discard block |
||
| 628 | 765 | |
| 629 | 766 | |
| 630 | 767 | $this->all_tracked[$id]['lastupdate'] = time(); |
| 631 | - if ($this->all_tracked[$id]['putinarchive']) $send = true; |
|
| 632 | - } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 768 | + if ($this->all_tracked[$id]['putinarchive']) { |
|
| 769 | + $send = true; |
|
| 770 | + } |
|
| 771 | + } elseif (isset($this->all_tracked[$id]['latitude']) && isset($globalDistanceIgnore['latitude']) && $globalDebug) { |
|
| 772 | + echo "!! Too far -> Distance : ".$Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude'])."\n"; |
|
| 773 | + } |
|
| 633 | 774 | //$this->del(); |
| 634 | 775 | |
| 635 | 776 | |
| 636 | 777 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 637 | 778 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 638 | - if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
|
| 779 | + if ($globalDebug) { |
|
| 780 | + echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
|
| 781 | + } |
|
| 639 | 782 | $MarineLive = new MarineLive($this->db); |
| 640 | 783 | $MarineLive->deleteLiveMarineDataNotUpdated(); |
| 641 | 784 | $MarineLive->db = null; |
| 642 | 785 | //MarineLive->deleteLiveMarineData(); |
| 643 | - if ($globalDebug) echo " Done\n"; |
|
| 786 | + if ($globalDebug) { |
|
| 787 | + echo " Done\n"; |
|
| 788 | + } |
|
| 644 | 789 | } |
| 645 | 790 | $this->last_delete_hourly = time(); |
| 646 | 791 | } |
@@ -649,7 +794,9 @@ discard block |
||
| 649 | 794 | //$ignoreImport = false; |
| 650 | 795 | } |
| 651 | 796 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 652 | - if ($send) return $this->all_tracked[$id]; |
|
| 797 | + if ($send) { |
|
| 798 | + return $this->all_tracked[$id]; |
|
| 799 | + } |
|
| 653 | 800 | } |
| 654 | 801 | } |
| 655 | 802 | } |
@@ -6,53 +6,53 @@ discard block |
||
| 6 | 6 | $Spotter = new Spotter(); |
| 7 | 7 | if (isset($_GET['start_date'])) { |
| 8 | 8 | //for the date manipulation into the query |
| 9 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
| 10 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
| 11 | - $end_date = date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
| 9 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
| 10 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
| 11 | + $end_date = date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
| 12 | 12 | $sql_date = $start_date.",".$end_date; |
| 13 | - } else if($_GET['start_date'] != ""){ |
|
| 14 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
| 13 | + } else if ($_GET['start_date'] != "") { |
|
| 14 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
| 15 | 15 | $sql_date = $start_date; |
| 16 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
| 17 | - $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
| 16 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
| 17 | + $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
| 18 | 18 | $sql_date = $end_date; |
| 19 | 19 | } else $sql_date = ''; |
| 20 | 20 | } else $sql_date = ''; |
| 21 | 21 | |
| 22 | 22 | if (isset($_GET['highest_altitude'])) { |
| 23 | 23 | //for altitude manipulation |
| 24 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
| 25 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 26 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 24 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
| 25 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 26 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 27 | 27 | $sql_altitude = $start_altitude.",".$end_altitude; |
| 28 | - } else if($_GET['highest_altitude'] != ""){ |
|
| 29 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 28 | + } else if ($_GET['highest_altitude'] != "") { |
|
| 29 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 30 | 30 | $sql_altitude = $end_altitude; |
| 31 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
| 32 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 31 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
| 32 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 33 | 33 | $sql_altitude = $start_altitude; |
| 34 | 34 | } else $sql_altitude = ''; |
| 35 | 35 | } else $sql_altitude = ''; |
| 36 | 36 | |
| 37 | 37 | //calculuation for the pagination |
| 38 | -if(!isset($_GET['limit'])) |
|
| 38 | +if (!isset($_GET['limit'])) |
|
| 39 | 39 | { |
| 40 | 40 | if (!isset($_GET['number_results'])) { |
| 41 | 41 | $limit_start = 0; |
| 42 | 42 | $limit_end = 25; |
| 43 | 43 | $absolute_difference = 25; |
| 44 | 44 | } else { |
| 45 | - if ($_GET['number_results'] > 1000){ |
|
| 45 | + if ($_GET['number_results'] > 1000) { |
|
| 46 | 46 | $_GET['number_results'] = 1000; |
| 47 | 47 | } |
| 48 | 48 | $limit_start = 0; |
| 49 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 50 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 49 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 50 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 51 | 51 | } |
| 52 | -} else { |
|
| 52 | +} else { |
|
| 53 | 53 | $limit_explode = explode(",", $_GET['limit']); |
| 54 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 55 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 54 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 55 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -69,34 +69,34 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
| 71 | 71 | else $sort = ''; |
| 72 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
| 73 | -$id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
|
| 74 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
| 75 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
| 76 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
| 77 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
| 78 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 79 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
| 80 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
| 81 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
| 82 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
| 83 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
| 84 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
| 85 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
| 86 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
| 87 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
| 88 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
| 72 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
| 73 | +$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); |
|
| 74 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
| 75 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
| 76 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
| 77 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
| 78 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 79 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
| 80 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
| 81 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
| 82 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
| 83 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
| 84 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
| 85 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
| 86 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
| 87 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
| 88 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
| 89 | 89 | if ($id != '') { |
| 90 | 90 | $spotter_array = $Spotter->getSpotterDataByID($id); |
| 91 | 91 | } else { |
| 92 | - $spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
| 92 | + $spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
| 93 | 93 | } |
| 94 | 94 | $output = '<?xml version="1.0" encoding="UTF-8"?>'; |
| 95 | 95 | $output .= '<gpx version="1.0">'; |
| 96 | 96 | $output .= '<name>FlightAirMap GPX Feed</name>'; |
| 97 | 97 | if (!empty($spotter_array)) |
| 98 | 98 | { |
| 99 | - foreach($spotter_array as $spotter_item) |
|
| 99 | + foreach ($spotter_array as $spotter_item) |
|
| 100 | 100 | { |
| 101 | 101 | $altitude = $spotter_item['altitude'].'00'; |
| 102 | 102 | //waypoint plotting |
@@ -16,8 +16,12 @@ discard block |
||
| 16 | 16 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
| 17 | 17 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
| 18 | 18 | $sql_date = $end_date; |
| 19 | - } else $sql_date = ''; |
|
| 20 | -} else $sql_date = ''; |
|
| 19 | + } else { |
|
| 20 | + $sql_date = ''; |
|
| 21 | + } |
|
| 22 | + } else { |
|
| 23 | + $sql_date = ''; |
|
| 24 | +} |
|
| 21 | 25 | |
| 22 | 26 | if (isset($_GET['highest_altitude'])) { |
| 23 | 27 | //for altitude manipulation |
@@ -31,8 +35,12 @@ discard block |
||
| 31 | 35 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
| 32 | 36 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
| 33 | 37 | $sql_altitude = $start_altitude; |
| 34 | - } else $sql_altitude = ''; |
|
| 35 | -} else $sql_altitude = ''; |
|
| 38 | + } else { |
|
| 39 | + $sql_altitude = ''; |
|
| 40 | + } |
|
| 41 | + } else { |
|
| 42 | + $sql_altitude = ''; |
|
| 43 | +} |
|
| 36 | 44 | |
| 37 | 45 | //calculuation for the pagination |
| 38 | 46 | if(!isset($_GET['limit'])) |
@@ -49,7 +57,7 @@ discard block |
||
| 49 | 57 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 50 | 58 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 51 | 59 | } |
| 52 | -} else { |
|
| 60 | +} else { |
|
| 53 | 61 | $limit_explode = explode(",", $_GET['limit']); |
| 54 | 62 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
| 55 | 63 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -67,8 +75,11 @@ discard block |
||
| 67 | 75 | |
| 68 | 76 | header('Content-Type: text/xml'); |
| 69 | 77 | |
| 70 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
| 71 | -else $sort = ''; |
|
| 78 | +if (isset($_GET['sort'])) { |
|
| 79 | + $sort = $_GET['sort']; |
|
| 80 | +} else { |
|
| 81 | + $sort = ''; |
|
| 82 | +} |
|
| 72 | 83 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
| 73 | 84 | $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
| 74 | 85 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
@@ -3,39 +3,39 @@ discard block |
||
| 3 | 3 | require_once('require/class.Language.php'); |
| 4 | 4 | require_once('require/class.Spotter.php'); |
| 5 | 5 | require_once('require/class.SpotterArchive.php'); |
| 6 | -$Spotter=new Spotter(); |
|
| 6 | +$Spotter = new Spotter(); |
|
| 7 | 7 | if (isset($_GET['start_date'])) { |
| 8 | 8 | //for the date manipulation into the query |
| 9 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
| 9 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
| 10 | 10 | $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
| 11 | - $end_date = date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
| 11 | + $end_date = date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
| 12 | 12 | $sql_date = $start_date.",".$end_date; |
| 13 | - } else if($_GET['start_date'] != ""){ |
|
| 14 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
| 13 | + } else if ($_GET['start_date'] != "") { |
|
| 14 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
| 15 | 15 | $sql_date = $start_date; |
| 16 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
| 17 | - $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
| 16 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
| 17 | + $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
| 18 | 18 | $sql_date = $end_date; |
| 19 | 19 | } else $sql_date = ''; |
| 20 | 20 | } else $sql_date = ''; |
| 21 | 21 | |
| 22 | 22 | if (isset($_GET['highest_altitude'])) { |
| 23 | 23 | //for altitude manipulation |
| 24 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
| 25 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 26 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 24 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
| 25 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 26 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 27 | 27 | $sql_altitude = $start_altitude.",".$end_altitude; |
| 28 | - } else if($_GET['highest_altitude'] != ""){ |
|
| 29 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 28 | + } else if ($_GET['highest_altitude'] != "") { |
|
| 29 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 30 | 30 | $sql_altitude = $end_altitude; |
| 31 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
| 32 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 31 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
| 32 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 33 | 33 | $sql_altitude = $start_altitude; |
| 34 | 34 | } else $sql_altitude = ''; |
| 35 | 35 | } else $sql_altitude = ''; |
| 36 | 36 | |
| 37 | 37 | //calculuation for the pagination |
| 38 | -if(!isset($_GET['limit'])) |
|
| 38 | +if (!isset($_GET['limit'])) |
|
| 39 | 39 | { |
| 40 | 40 | if (!isset($_GET['number_results'])) |
| 41 | 41 | { |
@@ -43,17 +43,17 @@ discard block |
||
| 43 | 43 | $limit_end = 25; |
| 44 | 44 | $absolute_difference = 25; |
| 45 | 45 | } else { |
| 46 | - if ($_GET['number_results'] > 1000){ |
|
| 46 | + if ($_GET['number_results'] > 1000) { |
|
| 47 | 47 | $_GET['number_results'] = 1000; |
| 48 | 48 | } |
| 49 | 49 | $limit_start = 0; |
| 50 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 51 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 50 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 51 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 52 | 52 | } |
| 53 | -} else { |
|
| 53 | +} else { |
|
| 54 | 54 | $limit_explode = explode(",", $_GET['limit']); |
| 55 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 56 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 55 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 56 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -70,34 +70,34 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
| 72 | 72 | else $sort = ''; |
| 73 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
| 74 | -$id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
|
| 75 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
| 76 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
| 77 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
| 78 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
| 79 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 80 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
| 81 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
| 82 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
| 83 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
| 84 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
| 85 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
| 86 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
| 87 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
| 88 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
| 89 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
| 73 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
| 74 | +$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); |
|
| 75 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
| 76 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
| 77 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
| 78 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
| 79 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 80 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
| 81 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
| 82 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
| 83 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
| 84 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
| 85 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
| 86 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
| 87 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
| 88 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
| 89 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
| 90 | 90 | if ($id != '') { |
| 91 | 91 | $spotter_array = $Spotter->getSpotterDataByID($id); |
| 92 | 92 | } else { |
| 93 | - $spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
| 93 | + $spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $output = '{'; |
| 97 | 97 | $output .= '"type": "FeatureCollection",'; |
| 98 | 98 | $output .= '"features": ['; |
| 99 | 99 | if (!empty($spotter_array)) { |
| 100 | - foreach($spotter_array as $spotter_item) { |
|
| 100 | + foreach ($spotter_array as $spotter_item) { |
|
| 101 | 101 | //waypoint plotting |
| 102 | 102 | $output .= '{'; |
| 103 | 103 | $output .= '"type": "Feature",'; |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | $output .= '"coordinates": ['; |
| 165 | 165 | foreach ($archive_data as $coord_data) { |
| 166 | 166 | $output .= '['; |
| 167 | - $output .= $coord_data['longitude'].', '; |
|
| 168 | - $output .= $coord_data['latitude']; |
|
| 167 | + $output .= $coord_data['longitude'].', '; |
|
| 168 | + $output .= $coord_data['latitude']; |
|
| 169 | 169 | $output .= '],'; |
| 170 | 170 | } |
| 171 | 171 | $output = substr($output, 0, -1); |
@@ -16,8 +16,12 @@ discard block |
||
| 16 | 16 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
| 17 | 17 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
| 18 | 18 | $sql_date = $end_date; |
| 19 | - } else $sql_date = ''; |
|
| 20 | -} else $sql_date = ''; |
|
| 19 | + } else { |
|
| 20 | + $sql_date = ''; |
|
| 21 | + } |
|
| 22 | + } else { |
|
| 23 | + $sql_date = ''; |
|
| 24 | +} |
|
| 21 | 25 | |
| 22 | 26 | if (isset($_GET['highest_altitude'])) { |
| 23 | 27 | //for altitude manipulation |
@@ -31,8 +35,12 @@ discard block |
||
| 31 | 35 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
| 32 | 36 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
| 33 | 37 | $sql_altitude = $start_altitude; |
| 34 | - } else $sql_altitude = ''; |
|
| 35 | -} else $sql_altitude = ''; |
|
| 38 | + } else { |
|
| 39 | + $sql_altitude = ''; |
|
| 40 | + } |
|
| 41 | + } else { |
|
| 42 | + $sql_altitude = ''; |
|
| 43 | +} |
|
| 36 | 44 | |
| 37 | 45 | //calculuation for the pagination |
| 38 | 46 | if(!isset($_GET['limit'])) |
@@ -50,7 +58,7 @@ discard block |
||
| 50 | 58 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 51 | 59 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 52 | 60 | } |
| 53 | -} else { |
|
| 61 | +} else { |
|
| 54 | 62 | $limit_explode = explode(",", $_GET['limit']); |
| 55 | 63 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
| 56 | 64 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -68,8 +76,11 @@ discard block |
||
| 68 | 76 | |
| 69 | 77 | header('Content-Type: application/json'); |
| 70 | 78 | |
| 71 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
| 72 | -else $sort = ''; |
|
| 79 | +if (isset($_GET['sort'])) { |
|
| 80 | + $sort = $_GET['sort']; |
|
| 81 | +} else { |
|
| 82 | + $sort = ''; |
|
| 83 | +} |
|
| 73 | 84 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
| 74 | 85 | $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
| 75 | 86 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
@@ -5,52 +5,52 @@ discard block |
||
| 5 | 5 | $Spotter = new Spotter(); |
| 6 | 6 | if (isset($_GET['start_date'])) { |
| 7 | 7 | //for the date manipulation into the query |
| 8 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
| 9 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
| 10 | - $end_date = date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
| 8 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
| 9 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
| 10 | + $end_date = date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
| 11 | 11 | $sql_date = $start_date.",".$end_date; |
| 12 | - } else if($_GET['start_date'] != ""){ |
|
| 13 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
| 12 | + } else if ($_GET['start_date'] != "") { |
|
| 13 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
| 14 | 14 | $sql_date = $start_date; |
| 15 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
| 16 | - $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
| 15 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
| 16 | + $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
| 17 | 17 | $sql_date = $end_date; |
| 18 | 18 | } else $sql_date = ''; |
| 19 | 19 | } else $sql_date = ''; |
| 20 | 20 | |
| 21 | 21 | if (isset($_GET['highest_altitude'])) { |
| 22 | 22 | //for altitude manipulation |
| 23 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
| 24 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 25 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 23 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
| 24 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 25 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 26 | 26 | $sql_altitude = $start_altitude.",".$end_altitude; |
| 27 | - } else if($_GET['highest_altitude'] != ""){ |
|
| 28 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 27 | + } else if ($_GET['highest_altitude'] != "") { |
|
| 28 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 29 | 29 | $sql_altitude = $end_altitude; |
| 30 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
| 31 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 30 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
| 31 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 32 | 32 | $sql_altitude = $start_altitude; |
| 33 | 33 | } else $sql_altitude = ''; |
| 34 | 34 | } else $sql_altitude = ''; |
| 35 | 35 | |
| 36 | 36 | //calculuation for the pagination |
| 37 | -if(!isset($_GET['limit'])) { |
|
| 37 | +if (!isset($_GET['limit'])) { |
|
| 38 | 38 | if (!isset($_GET['number_results'])) { |
| 39 | 39 | $limit_start = 0; |
| 40 | 40 | $limit_end = 25; |
| 41 | 41 | $absolute_difference = 25; |
| 42 | 42 | } else { |
| 43 | - if ($_GET['number_results'] > 1000){ |
|
| 43 | + if ($_GET['number_results'] > 1000) { |
|
| 44 | 44 | $_GET['number_results'] = 1000; |
| 45 | 45 | } |
| 46 | 46 | $limit_start = 0; |
| 47 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 48 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 47 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 48 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 49 | 49 | } |
| 50 | -} else { |
|
| 50 | +} else { |
|
| 51 | 51 | $limit_explode = explode(",", $_GET['limit']); |
| 52 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 53 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 52 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 53 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -67,27 +67,27 @@ discard block |
||
| 67 | 67 | |
| 68 | 68 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
| 69 | 69 | else $sort = ''; |
| 70 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
| 71 | -$id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
|
| 72 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
| 73 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
| 74 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
| 75 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
| 76 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 77 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
| 78 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
| 79 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
| 80 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
| 81 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
| 82 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
| 83 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
| 84 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
| 85 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
| 86 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
| 70 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
| 71 | +$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_NUMBER_INT); |
|
| 72 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
| 73 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
| 74 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
| 75 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
| 76 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 77 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
| 78 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
| 79 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
| 80 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
| 81 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
| 82 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
| 83 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
| 84 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
| 85 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
| 86 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
| 87 | 87 | if ($id != '') { |
| 88 | 88 | $spotter_array = $Spotter->getSpotterDataByID($id); |
| 89 | 89 | } else { |
| 90 | - $spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
| 90 | + $spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
| 91 | 91 | } |
| 92 | 92 | $output = '<?xml version="1.0" encoding="UTF-8" ?>'; |
| 93 | 93 | $output .= '<flightairmap>'; |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $output .= '<link>http://'.$_SERVER['HTTP_HOST'].$globalURL.'</link>'; |
| 96 | 96 | $output .= '<aircrafts>'; |
| 97 | 97 | if (!empty($spotter_array)) { |
| 98 | - foreach($spotter_array as $spotter_item) { |
|
| 98 | + foreach ($spotter_array as $spotter_item) { |
|
| 99 | 99 | $output .= '<aircraft>'; |
| 100 | 100 | $output .= '<id>'.$spotter_item['spotter_id'].'</id>'; |
| 101 | 101 | $output .= '<ident>'.$spotter_item['ident'].'</ident>'; |
@@ -15,8 +15,12 @@ discard block |
||
| 15 | 15 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
| 16 | 16 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
| 17 | 17 | $sql_date = $end_date; |
| 18 | - } else $sql_date = ''; |
|
| 19 | -} else $sql_date = ''; |
|
| 18 | + } else { |
|
| 19 | + $sql_date = ''; |
|
| 20 | + } |
|
| 21 | + } else { |
|
| 22 | + $sql_date = ''; |
|
| 23 | +} |
|
| 20 | 24 | |
| 21 | 25 | if (isset($_GET['highest_altitude'])) { |
| 22 | 26 | //for altitude manipulation |
@@ -30,8 +34,12 @@ discard block |
||
| 30 | 34 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
| 31 | 35 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
| 32 | 36 | $sql_altitude = $start_altitude; |
| 33 | - } else $sql_altitude = ''; |
|
| 34 | -} else $sql_altitude = ''; |
|
| 37 | + } else { |
|
| 38 | + $sql_altitude = ''; |
|
| 39 | + } |
|
| 40 | + } else { |
|
| 41 | + $sql_altitude = ''; |
|
| 42 | +} |
|
| 35 | 43 | |
| 36 | 44 | //calculuation for the pagination |
| 37 | 45 | if(!isset($_GET['limit'])) { |
@@ -47,7 +55,7 @@ discard block |
||
| 47 | 55 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 48 | 56 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 49 | 57 | } |
| 50 | -} else { |
|
| 58 | +} else { |
|
| 51 | 59 | $limit_explode = explode(",", $_GET['limit']); |
| 52 | 60 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
| 53 | 61 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -65,8 +73,11 @@ discard block |
||
| 65 | 73 | |
| 66 | 74 | header('Content-Type: application/xml'); |
| 67 | 75 | |
| 68 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
| 69 | -else $sort = ''; |
|
| 76 | +if (isset($_GET['sort'])) { |
|
| 77 | + $sort = $_GET['sort']; |
|
| 78 | +} else { |
|
| 79 | + $sort = ''; |
|
| 80 | +} |
|
| 70 | 81 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
| 71 | 82 | $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_NUMBER_INT); |
| 72 | 83 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
@@ -6,53 +6,53 @@ discard block |
||
| 6 | 6 | $Spotter = new Spotter(); |
| 7 | 7 | if (isset($_GET['start_date'])) { |
| 8 | 8 | //for the date manipulation into the query |
| 9 | - if($_GET['start_date'] != "" && $_GET['end_date'] != ""){ |
|
| 10 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
| 11 | - $end_date = date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
| 9 | + if ($_GET['start_date'] != "" && $_GET['end_date'] != "") { |
|
| 10 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
| 11 | + $end_date = date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
| 12 | 12 | $sql_date = $start_date.",".$end_date; |
| 13 | - } else if($_GET['start_date'] != ""){ |
|
| 14 | - $start_date = date("Y-m-d",strtotime($_GET['start_date']))." 00:00:00"; |
|
| 13 | + } else if ($_GET['start_date'] != "") { |
|
| 14 | + $start_date = date("Y-m-d", strtotime($_GET['start_date']))." 00:00:00"; |
|
| 15 | 15 | $sql_date = $start_date; |
| 16 | - } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
|
| 17 | - $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
|
| 16 | + } else if ($_GET['start_date'] == "" && $_GET['end_date'] != "") { |
|
| 17 | + $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d", strtotime($_GET['end_date']))." 00:00:00"; |
|
| 18 | 18 | $sql_date = $end_date; |
| 19 | 19 | } else $sql_date = ''; |
| 20 | 20 | } else $sql_date = ''; |
| 21 | 21 | |
| 22 | 22 | if (isset($_GET['highest_altitude'])) { |
| 23 | 23 | //for altitude manipulation |
| 24 | - if($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != ""){ |
|
| 25 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 26 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 24 | + if ($_GET['highest_altitude'] != "" && $_GET['lowest_altitude'] != "") { |
|
| 25 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 26 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 27 | 27 | $sql_altitude = $start_altitude.",".$end_altitude; |
| 28 | - } else if($_GET['highest_altitude'] != ""){ |
|
| 29 | - $end_altitude = filter_input(INPUT_GET,'highest_altitude',FILTER_SANITIZE_NUMBER_INT); |
|
| 28 | + } else if ($_GET['highest_altitude'] != "") { |
|
| 29 | + $end_altitude = filter_input(INPUT_GET, 'highest_altitude', FILTER_SANITIZE_NUMBER_INT); |
|
| 30 | 30 | $sql_altitude = $end_altitude; |
| 31 | - } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
|
| 32 | - $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 31 | + } else if ($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != "") { |
|
| 32 | + $start_altitude = filter_input(INPUT_GET, 'lowest_altitude', FILTER_SANITIZE_NUMBER_INT).",60000"; |
|
| 33 | 33 | $sql_altitude = $start_altitude; |
| 34 | 34 | } else $sql_altitude = ''; |
| 35 | 35 | } else $sql_altitude = ''; |
| 36 | 36 | |
| 37 | 37 | //calculuation for the pagination |
| 38 | -if(!isset($_GET['limit'])) |
|
| 38 | +if (!isset($_GET['limit'])) |
|
| 39 | 39 | { |
| 40 | 40 | if (!isset($_GET['number_results'])) { |
| 41 | 41 | $limit_start = 0; |
| 42 | 42 | $limit_end = 25; |
| 43 | 43 | $absolute_difference = 25; |
| 44 | 44 | } else { |
| 45 | - if ($_GET['number_results'] > 1000){ |
|
| 45 | + if ($_GET['number_results'] > 1000) { |
|
| 46 | 46 | $_GET['number_results'] = 1000; |
| 47 | 47 | } |
| 48 | 48 | $limit_start = 0; |
| 49 | - $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 50 | - $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
|
| 49 | + $limit_end = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 50 | + $absolute_difference = filter_input(INPUT_GET, 'number_results', FILTER_SANITIZE_NUMBER_INT); |
|
| 51 | 51 | } |
| 52 | -} else { |
|
| 52 | +} else { |
|
| 53 | 53 | $limit_explode = explode(",", $_GET['limit']); |
| 54 | - $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
|
| 55 | - $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
|
| 54 | + $limit_start = filter_var($limit_explode[0], FILTER_SANITIZE_NUMBER_INT); |
|
| 55 | + $limit_end = filter_var($limit_explode[1], FILTER_SANITIZE_NUMBER_INT); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | $absolute_difference = abs($limit_start - $limit_end); |
@@ -69,27 +69,27 @@ discard block |
||
| 69 | 69 | |
| 70 | 70 | if (isset($_GET['sort'])) $sort = $_GET['sort']; |
| 71 | 71 | else $sort = ''; |
| 72 | -$q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
|
| 73 | -$id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_STRING); |
|
| 74 | -$registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |
|
| 75 | -$aircraft = filter_input(INPUT_GET,'aircraft',FILTER_SANITIZE_STRING); |
|
| 76 | -$manufacturer = filter_input(INPUT_GET,'manufacturer',FILTER_SANITIZE_STRING); |
|
| 77 | -$highlights = filter_input(INPUT_GET,'highlights',FILTER_SANITIZE_STRING); |
|
| 78 | -$airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
|
| 79 | -$airline_country = filter_input(INPUT_GET,'airline_country',FILTER_SANITIZE_STRING); |
|
| 80 | -$airline_type = filter_input(INPUT_GET,'airline_type',FILTER_SANITIZE_STRING); |
|
| 81 | -$airport = filter_input(INPUT_GET,'airport',FILTER_SANITIZE_STRING); |
|
| 82 | -$airport_country = filter_input(INPUT_GET,'airport_country',FILTER_SANITIZE_STRING); |
|
| 83 | -$callsign = filter_input(INPUT_GET,'callsign',FILTER_SANITIZE_STRING); |
|
| 84 | -$owner = filter_input(INPUT_GET,'owner',FILTER_SANITIZE_STRING); |
|
| 85 | -$pilot_id = filter_input(INPUT_GET,'pilot_id',FILTER_SANITIZE_STRING); |
|
| 86 | -$pilot_name = filter_input(INPUT_GET,'pilot_name',FILTER_SANITIZE_STRING); |
|
| 87 | -$departure_airport_route = filter_input(INPUT_GET,'departure_airport_route',FILTER_SANITIZE_STRING); |
|
| 88 | -$arrival_airport_route = filter_input(INPUT_GET,'arrival_airport_route',FILTER_SANITIZE_STRING); |
|
| 72 | +$q = filter_input(INPUT_GET, 'q', FILTER_SANITIZE_STRING); |
|
| 73 | +$id = filter_input(INPUT_GET, 'id', FILTER_SANITIZE_STRING); |
|
| 74 | +$registration = filter_input(INPUT_GET, 'registratrion', FILTER_SANITIZE_STRING); |
|
| 75 | +$aircraft = filter_input(INPUT_GET, 'aircraft', FILTER_SANITIZE_STRING); |
|
| 76 | +$manufacturer = filter_input(INPUT_GET, 'manufacturer', FILTER_SANITIZE_STRING); |
|
| 77 | +$highlights = filter_input(INPUT_GET, 'highlights', FILTER_SANITIZE_STRING); |
|
| 78 | +$airline = filter_input(INPUT_GET, 'airline', FILTER_SANITIZE_STRING); |
|
| 79 | +$airline_country = filter_input(INPUT_GET, 'airline_country', FILTER_SANITIZE_STRING); |
|
| 80 | +$airline_type = filter_input(INPUT_GET, 'airline_type', FILTER_SANITIZE_STRING); |
|
| 81 | +$airport = filter_input(INPUT_GET, 'airport', FILTER_SANITIZE_STRING); |
|
| 82 | +$airport_country = filter_input(INPUT_GET, 'airport_country', FILTER_SANITIZE_STRING); |
|
| 83 | +$callsign = filter_input(INPUT_GET, 'callsign', FILTER_SANITIZE_STRING); |
|
| 84 | +$owner = filter_input(INPUT_GET, 'owner', FILTER_SANITIZE_STRING); |
|
| 85 | +$pilot_id = filter_input(INPUT_GET, 'pilot_id', FILTER_SANITIZE_STRING); |
|
| 86 | +$pilot_name = filter_input(INPUT_GET, 'pilot_name', FILTER_SANITIZE_STRING); |
|
| 87 | +$departure_airport_route = filter_input(INPUT_GET, 'departure_airport_route', FILTER_SANITIZE_STRING); |
|
| 88 | +$arrival_airport_route = filter_input(INPUT_GET, 'arrival_airport_route', FILTER_SANITIZE_STRING); |
|
| 89 | 89 | if ($id != '') { |
| 90 | 90 | $spotter_array = $Spotter->getSpotterDataByID($id); |
| 91 | 91 | } else { |
| 92 | - $spotter_array = $Spotter->searchSpotterData($q,$registration,$aircraft,strtolower(str_replace("-", " ", $manufacturer)),$highlights,$airline,$airline_country,$airline_type,$airport,$airport_country,$callsign,$departure_airport_route,$arrival_airport_route,$owner,$pilot_id,$pilot_name,$sql_altitude,$sql_date,$limit_start.",".$absolute_difference,$sort,''); |
|
| 92 | + $spotter_array = $Spotter->searchSpotterData($q, $registration, $aircraft, strtolower(str_replace("-", " ", $manufacturer)), $highlights, $airline, $airline_country, $airline_type, $airport, $airport_country, $callsign, $departure_airport_route, $arrival_airport_route, $owner, $pilot_id, $pilot_name, $sql_altitude, $sql_date, $limit_start.",".$absolute_difference, $sort, ''); |
|
| 93 | 93 | } |
| 94 | 94 | $output = '<?xml version="1.0" encoding="UTF-8"?>'; |
| 95 | 95 | $output .= '<kml xmlns="http://www.opengis.net/kml/2.2">'; |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $output .= '</Style>'; |
| 118 | 118 | |
| 119 | 119 | if (!empty($spotter_array)) { |
| 120 | - foreach($spotter_array as $spotter_item) { |
|
| 120 | + foreach ($spotter_array as $spotter_item) { |
|
| 121 | 121 | $altitude = $spotter_item['altitude'].'00'; |
| 122 | 122 | $SpotterArchive = new SpotterArchive(); |
| 123 | 123 | $archive_data = $SpotterArchive->getAllArchiveSpotterDataById($spotter_item['flightaware_id']); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | $output .= '<LineString>'; |
| 129 | 129 | $output .= '<coordinates>'; |
| 130 | 130 | foreach ($archive_data as $coord_data) { |
| 131 | - $output .= $coord_data['longitude'].','.$coord_data['latitude'].','.$coord_data['real_altitude'].' '; |
|
| 131 | + $output .= $coord_data['longitude'].','.$coord_data['latitude'].','.$coord_data['real_altitude'].' '; |
|
| 132 | 132 | } |
| 133 | 133 | $output .= '</coordinates>'; |
| 134 | 134 | $output .= '<altitudeMode>absolute</altitudeMode>'; |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $output .= ' ]]></description>'; |
| 192 | 192 | $output .= '<styleUrl>#departureAirport</styleUrl>'; |
| 193 | 193 | $output .= '<Point>'; |
| 194 | - $output .= '<coordinates>'.$spotter_item['departure_airport_longitude'].', '.$spotter_item['departure_airport_latitude'].', '.$spotter_item['departure_airport_altitude'].'</coordinates>'; |
|
| 194 | + $output .= '<coordinates>'.$spotter_item['departure_airport_longitude'].', '.$spotter_item['departure_airport_latitude'].', '.$spotter_item['departure_airport_altitude'].'</coordinates>'; |
|
| 195 | 195 | $output .= '<altitudeMode>absolute</altitudeMode>'; |
| 196 | 196 | $output .= '</Point>'; |
| 197 | 197 | $output .= '</Placemark>'; |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | $output .= ' ]]></description>'; |
| 233 | 233 | $output .= '<styleUrl>#arrivalAirport</styleUrl>'; |
| 234 | 234 | $output .= '<Point>'; |
| 235 | - $output .= '<coordinates>'.$spotter_item['arrival_airport_longitude'].', '.$spotter_item['arrival_airport_latitude'].', '.$spotter_item['arrival_airport_altitude'].'</coordinates>'; |
|
| 235 | + $output .= '<coordinates>'.$spotter_item['arrival_airport_longitude'].', '.$spotter_item['arrival_airport_latitude'].', '.$spotter_item['arrival_airport_altitude'].'</coordinates>'; |
|
| 236 | 236 | $output .= '<altitudeMode>absolute</altitudeMode>'; |
| 237 | 237 | $output .= '</Point>'; |
| 238 | 238 | $output .= '</Placemark>'; |
@@ -16,8 +16,12 @@ discard block |
||
| 16 | 16 | } else if($_GET['start_date'] == "" && $_GET['end_date'] != ""){ |
| 17 | 17 | $end_date = date("Y-m-d H:i:s", strtotime("2014-04-12")).",".date("Y-m-d",strtotime($_GET['end_date']))." 00:00:00"; |
| 18 | 18 | $sql_date = $end_date; |
| 19 | - } else $sql_date = ''; |
|
| 20 | -} else $sql_date = ''; |
|
| 19 | + } else { |
|
| 20 | + $sql_date = ''; |
|
| 21 | + } |
|
| 22 | + } else { |
|
| 23 | + $sql_date = ''; |
|
| 24 | +} |
|
| 21 | 25 | |
| 22 | 26 | if (isset($_GET['highest_altitude'])) { |
| 23 | 27 | //for altitude manipulation |
@@ -31,8 +35,12 @@ discard block |
||
| 31 | 35 | } else if($_GET['highest_altitude'] == "" && $_GET['lowest_altitude'] != ""){ |
| 32 | 36 | $start_altitude = filter_input(INPUT_GET,'lowest_altitude',FILTER_SANITIZE_NUMBER_INT).",60000"; |
| 33 | 37 | $sql_altitude = $start_altitude; |
| 34 | - } else $sql_altitude = ''; |
|
| 35 | -} else $sql_altitude = ''; |
|
| 38 | + } else { |
|
| 39 | + $sql_altitude = ''; |
|
| 40 | + } |
|
| 41 | + } else { |
|
| 42 | + $sql_altitude = ''; |
|
| 43 | +} |
|
| 36 | 44 | |
| 37 | 45 | //calculuation for the pagination |
| 38 | 46 | if(!isset($_GET['limit'])) |
@@ -49,7 +57,7 @@ discard block |
||
| 49 | 57 | $limit_end = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 50 | 58 | $absolute_difference = filter_input(INPUT_GET,'number_results',FILTER_SANITIZE_NUMBER_INT); |
| 51 | 59 | } |
| 52 | -} else { |
|
| 60 | +} else { |
|
| 53 | 61 | $limit_explode = explode(",", $_GET['limit']); |
| 54 | 62 | $limit_start = filter_var($limit_explode[0],FILTER_SANITIZE_NUMBER_INT); |
| 55 | 63 | $limit_end = filter_var($limit_explode[1],FILTER_SANITIZE_NUMBER_INT); |
@@ -67,8 +75,11 @@ discard block |
||
| 67 | 75 | |
| 68 | 76 | header('Content-Type: text/xml'); |
| 69 | 77 | |
| 70 | -if (isset($_GET['sort'])) $sort = $_GET['sort']; |
|
| 71 | -else $sort = ''; |
|
| 78 | +if (isset($_GET['sort'])) { |
|
| 79 | + $sort = $_GET['sort']; |
|
| 80 | +} else { |
|
| 81 | + $sort = ''; |
|
| 82 | +} |
|
| 72 | 83 | $q = filter_input(INPUT_GET,'q',FILTER_SANITIZE_STRING); |
| 73 | 84 | $id = filter_input(INPUT_GET,'id',FILTER_SANITIZE_STRING); |
| 74 | 85 | $registration = filter_input(INPUT_GET,'registratrion',FILTER_SANITIZE_STRING); |