@@ -21,18 +21,18 @@ discard block |
||
| 21 | 21 | print '<div class="select-item">'; |
| 22 | 22 | print '<form action="'.$globalURL.'/aircraft" method="get">'; |
| 23 | 23 | print '<select name="aircraft_type" class="selectpicker" data-live-search="true">'; |
| 24 | - print '<option></option>'; |
|
| 25 | - $Stats = new Stats(); |
|
| 26 | - $aircraft_types = $Stats->getAllAircraftTypes(); |
|
| 27 | - if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
| 28 | - foreach($aircraft_types as $aircrafttype) |
|
| 29 | - { |
|
| 30 | - if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
| 31 | - { |
|
| 32 | - print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
| 33 | - } else { |
|
| 34 | - print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
| 35 | - } |
|
| 24 | + print '<option></option>'; |
|
| 25 | + $Stats = new Stats(); |
|
| 26 | + $aircraft_types = $Stats->getAllAircraftTypes(); |
|
| 27 | + if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
| 28 | + foreach($aircraft_types as $aircrafttype) |
|
| 29 | + { |
|
| 30 | + if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
| 31 | + { |
|
| 32 | + print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
| 33 | + } else { |
|
| 34 | + print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
| 35 | + } |
|
| 36 | 36 | } |
| 37 | 37 | print '</select>'; |
| 38 | 38 | print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>'; |
@@ -61,18 +61,18 @@ discard block |
||
| 61 | 61 | print '<script type="text/javascript" src="'.$globalURL.'/js/datamaps.world.min.js"></script>'; |
| 62 | 62 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
| 63 | 63 | print 'var series = ['; |
| 64 | - $country_data = ''; |
|
| 64 | + $country_data = ''; |
|
| 65 | 65 | foreach($airline_array as $airline_item) |
| 66 | 66 | { |
| 67 | 67 | $country_data .= '[ "'.$airline_item['airline_country_iso3'].'",'.$airline_item['airline_country_count'].'],'; |
| 68 | 68 | } |
| 69 | - $country_data = substr($country_data, 0, -1); |
|
| 70 | - print $country_data; |
|
| 71 | - print '];'; |
|
| 72 | - print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
| 73 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);'; |
|
| 74 | - print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});'; |
|
| 75 | - print 'new Datamap({ |
|
| 69 | + $country_data = substr($country_data, 0, -1); |
|
| 70 | + print $country_data; |
|
| 71 | + print '];'; |
|
| 72 | + print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
| 73 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);'; |
|
| 74 | + print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});'; |
|
| 75 | + print 'new Datamap({ |
|
| 76 | 76 | element: document.getElementById("chartCountry"), |
| 77 | 77 | projection: "mercator", // big world map |
| 78 | 78 | fills: { defaultFill: "#F5F5F5" }, |
@@ -62,12 +62,12 @@ |
||
| 62 | 62 | */ |
| 63 | 63 | //if ($aircraft_type != "NA") |
| 64 | 64 | //{ |
| 65 | - print '<div class="info column">'; |
|
| 66 | - print '<h1>'.$spotter_array[0]['type'].'</h1>'; |
|
| 67 | - //print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>'; |
|
| 68 | - //print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; |
|
| 69 | - //if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>'; |
|
| 70 | - print '</div>'; |
|
| 65 | + print '<div class="info column">'; |
|
| 66 | + print '<h1>'.$spotter_array[0]['type'].'</h1>'; |
|
| 67 | + //print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>'; |
|
| 68 | + //print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; |
|
| 69 | + //if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>'; |
|
| 70 | + print '</div>'; |
|
| 71 | 71 | //} else { |
| 72 | 72 | // print '<div class="alert alert-warning">'._("This special aircraft profile shows all flights in where the aircraft type is unknown.").'</div>'; |
| 73 | 73 | //} |
@@ -9,25 +9,25 @@ discard block |
||
| 9 | 9 | require_once(dirname(__FILE__).'/class.Stats.php'); |
| 10 | 10 | require_once(dirname(__FILE__).'/class.Source.php'); |
| 11 | 11 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
| 12 | - require_once(dirname(__FILE__).'/class.APRS.php'); |
|
| 12 | + require_once(dirname(__FILE__).'/class.APRS.php'); |
|
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | class MarineImport { |
| 16 | - private $all_tracked = array(); |
|
| 17 | - private $last_delete_hourly = 0; |
|
| 18 | - private $last_delete = 0; |
|
| 19 | - private $stats = array(); |
|
| 20 | - private $tmd = 0; |
|
| 21 | - private $source_location = array(); |
|
| 22 | - public $db = null; |
|
| 23 | - public $nb = 0; |
|
| 16 | + private $all_tracked = array(); |
|
| 17 | + private $last_delete_hourly = 0; |
|
| 18 | + private $last_delete = 0; |
|
| 19 | + private $stats = array(); |
|
| 20 | + private $tmd = 0; |
|
| 21 | + private $source_location = array(); |
|
| 22 | + public $db = null; |
|
| 23 | + public $nb = 0; |
|
| 24 | 24 | |
| 25 | - public function __construct($dbc = null) { |
|
| 25 | + public function __construct($dbc = null) { |
|
| 26 | 26 | global $globalBeta, $globalServerAPRS, $APRSMarine, $globalNoDB; |
| 27 | 27 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 28 | - $Connection = new Connection($dbc); |
|
| 29 | - $this->db = $Connection->db(); |
|
| 30 | - date_default_timezone_set('UTC'); |
|
| 28 | + $Connection = new Connection($dbc); |
|
| 29 | + $this->db = $Connection->db(); |
|
| 30 | + date_default_timezone_set('UTC'); |
|
| 31 | 31 | } |
| 32 | 32 | // Get previous source stats |
| 33 | 33 | /* |
@@ -46,57 +46,57 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | */ |
| 48 | 48 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
| 49 | - $APRSMarine = new APRSMarine(); |
|
| 50 | - //$APRSSpotter->connect(); |
|
| 49 | + $APRSMarine = new APRSMarine(); |
|
| 50 | + //$APRSSpotter->connect(); |
|
| 51 | + } |
|
| 51 | 52 | } |
| 52 | - } |
|
| 53 | 53 | |
| 54 | - public function checkAll() { |
|
| 54 | + public function checkAll() { |
|
| 55 | 55 | global $globalDebug, $globalNoDB; |
| 56 | 56 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 57 | - if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
| 58 | - foreach ($this->all_tracked as $key => $flight) { |
|
| 57 | + if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
| 58 | + foreach ($this->all_tracked as $key => $flight) { |
|
| 59 | 59 | if (isset($this->all_tracked[$key]['id'])) { |
| 60 | - //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
|
| 61 | - $Marine = new Marine($this->db); |
|
| 62 | - $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']); |
|
| 60 | + //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
|
| 61 | + $Marine = new Marine($this->db); |
|
| 62 | + $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']); |
|
| 63 | + } |
|
| 63 | 64 | } |
| 64 | - } |
|
| 65 | 65 | } |
| 66 | - } |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - public function del() { |
|
| 68 | + public function del() { |
|
| 69 | 69 | global $globalDebug, $globalNoDB, $globalNoImport; |
| 70 | 70 | // Delete old infos |
| 71 | 71 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 72 | 72 | foreach ($this->all_tracked as $key => $flight) { |
| 73 | - if (isset($flight['lastupdate'])) { |
|
| 74 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
| 75 | - if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
| 76 | - if (isset($this->all_tracked[$key]['id'])) { |
|
| 77 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 78 | - /* |
|
| 73 | + if (isset($flight['lastupdate'])) { |
|
| 74 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
| 75 | + if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
| 76 | + if (isset($this->all_tracked[$key]['id'])) { |
|
| 77 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 78 | + /* |
|
| 79 | 79 | $MarineLive = new MarineLive(); |
| 80 | 80 | $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']); |
| 81 | 81 | $MarineLive->db = null; |
| 82 | 82 | */ |
| 83 | - //$real_arrival = $this->arrival($key); |
|
| 84 | - $Marine = new Marine($this->db); |
|
| 85 | - if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
| 83 | + //$real_arrival = $this->arrival($key); |
|
| 84 | + $Marine = new Marine($this->db); |
|
| 85 | + if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
| 86 | 86 | $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']); |
| 87 | 87 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 88 | - } |
|
| 89 | - // Put in archive |
|
| 88 | + } |
|
| 89 | + // Put in archive |
|
| 90 | 90 | // $Marine->db = null; |
| 91 | 91 | } |
| 92 | - } |
|
| 93 | - unset($this->all_tracked[$key]); |
|
| 94 | - } |
|
| 95 | - } |
|
| 96 | - } |
|
| 97 | - } |
|
| 92 | + } |
|
| 93 | + unset($this->all_tracked[$key]); |
|
| 94 | + } |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - public function add($line) { |
|
| 99 | + public function add($line) { |
|
| 100 | 100 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine; |
| 101 | 101 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
| 102 | 102 | date_default_timezone_set('UTC'); |
@@ -105,103 +105,103 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | // SBS format is CSV format |
| 107 | 107 | if(is_array($line) && isset($line['mmsi'])) { |
| 108 | - //print_r($line); |
|
| 109 | - if (isset($line['mmsi'])) { |
|
| 108 | + //print_r($line); |
|
| 109 | + if (isset($line['mmsi'])) { |
|
| 110 | 110 | |
| 111 | 111 | |
| 112 | 112 | // Increment message number |
| 113 | 113 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
| 114 | - $current_date = date('Y-m-d'); |
|
| 115 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 116 | - else $source = ''; |
|
| 117 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 118 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 119 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 120 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 121 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 114 | + $current_date = date('Y-m-d'); |
|
| 115 | + if (isset($line['source_name'])) $source = $line['source_name']; |
|
| 116 | + else $source = ''; |
|
| 117 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
| 118 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
| 119 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
| 120 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
| 121 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | |
| 125 | 125 | $Common = new Common(); |
| 126 | 126 | $AIS = new AIS(); |
| 127 | - if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
| 128 | - else $id = trim($line['id']); |
|
| 127 | + if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
| 128 | + else $id = trim($line['id']); |
|
| 129 | 129 | |
| 130 | 130 | if (!isset($this->all_tracked[$id])) { |
| 131 | - $this->all_tracked[$id] = array(); |
|
| 132 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
| 133 | - $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' => '')); |
|
| 134 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
| 135 | - if (!isset($line['id'])) { |
|
| 131 | + $this->all_tracked[$id] = array(); |
|
| 132 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
| 133 | + $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' => '')); |
|
| 134 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
| 135 | + if (!isset($line['id'])) { |
|
| 136 | 136 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 137 | 137 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
| 138 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 139 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
| 138 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 139 | + if ($globalAllTracked !== FALSE) $dataFound = true; |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
| 143 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
| 144 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 143 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
| 144 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 145 | 145 | $Marine = new Marine($this->db); |
| 146 | 146 | $identity = $Marine->getIdentity($line['mmsi']); |
| 147 | 147 | if (!empty($identity)) { |
| 148 | - $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
| 149 | - $this->all_tracked[$id]['type'] = $identity['type']; |
|
| 148 | + $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
| 149 | + $this->all_tracked[$id]['type'] = $identity['type']; |
|
| 150 | 150 | } |
| 151 | 151 | //print_r($identity); |
| 152 | 152 | unset($Marine); |
| 153 | 153 | //$dataFound = true; |
| 154 | - } |
|
| 154 | + } |
|
| 155 | 155 | } |
| 156 | 156 | if (isset($line['type_id'])) { |
| 157 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
| 158 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id'])); |
|
| 157 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
| 158 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id'])); |
|
| 159 | 159 | } |
| 160 | 160 | if (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] == '') { |
| 161 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 162 | - if (!isset($line['type_id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type']))); |
|
| 161 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 162 | + if (!isset($line['type_id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type']))); |
|
| 163 | 163 | } |
| 164 | 164 | if (isset($line['status']) && $line['status'] != '') { |
| 165 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
| 165 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
| 166 | 166 | } |
| 167 | 167 | if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) { |
| 168 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
| 169 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 168 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
| 169 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 170 | 170 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 171 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 171 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 172 | 172 | $Marine = new Marine($this->db); |
| 173 | 173 | $Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']); |
| 174 | 174 | unset($Marine); |
| 175 | - } |
|
| 175 | + } |
|
| 176 | + } |
|
| 176 | 177 | } |
| 177 | - } |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | |
| 181 | 181 | if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') { |
| 182 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
| 182 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
| 183 | 183 | } |
| 184 | 184 | if (isset($line['imo']) && $line['imo'] != '') { |
| 185 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
| 185 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
| 186 | 186 | } |
| 187 | 187 | if (isset($line['callsign']) && $line['callsign'] != '') { |
| 188 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
| 188 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
| 189 | 189 | } |
| 190 | 190 | if (isset($line['arrival_code']) && $line['arrival_code'] != '') { |
| 191 | - if (!isset($this->all_tracked[$id]['arrival_code'])) { |
|
| 191 | + if (!isset($this->all_tracked[$id]['arrival_code'])) { |
|
| 192 | 192 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
| 193 | 193 | if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
| 194 | 194 | if ($this->all_tracked[$id]['addedMarine'] != 0) { |
| 195 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 195 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 196 | 196 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 197 | - $Marine = new Marine($this->db); |
|
| 198 | - $fromsource = NULL; |
|
| 199 | - $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource); |
|
| 200 | - $Marine->db = null; |
|
| 197 | + $Marine = new Marine($this->db); |
|
| 198 | + $fromsource = NULL; |
|
| 199 | + $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource); |
|
| 200 | + $Marine->db = null; |
|
| 201 | + } |
|
| 201 | 202 | } |
| 202 | - } |
|
| 203 | 203 | } |
| 204 | - } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) { |
|
| 204 | + } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) { |
|
| 205 | 205 | $this->all_tracked[$id]['arrival_code'] = $line['arrival_code']; |
| 206 | 206 | if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
| 207 | 207 | if (!isset($line['id'])) { |
@@ -209,18 +209,18 @@ discard block |
||
| 209 | 209 | $this->all_tracked[$id]['forcenew'] = 1; |
| 210 | 210 | $this->all_tracked[$id]['addedMarine'] = 0; |
| 211 | 211 | } |
| 212 | - } |
|
| 212 | + } |
|
| 213 | 213 | } |
| 214 | 214 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
| 215 | - if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 215 | + if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | //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'])) { |
| 219 | 219 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
| 220 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 221 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 220 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 221 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 222 | 222 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 223 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 223 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 224 | 224 | $timeelapsed = microtime(true); |
| 225 | 225 | $Marine = new Marine($this->db); |
| 226 | 226 | $fromsource = NULL; |
@@ -229,20 +229,20 @@ discard block |
||
| 229 | 229 | $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']); |
| 230 | 230 | $Marine->db = null; |
| 231 | 231 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 232 | - } |
|
| 232 | + } |
|
| 233 | + } |
|
| 233 | 234 | } |
| 234 | - } |
|
| 235 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 235 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) { |
| 239 | - if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
| 239 | + if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
| 240 | 240 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
| 241 | - } else { |
|
| 241 | + } else { |
|
| 242 | 242 | 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"; |
| 243 | 243 | 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"; |
| 244 | 244 | return ''; |
| 245 | - } |
|
| 245 | + } |
|
| 246 | 246 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) { |
| 247 | 247 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
| 248 | 248 | return ''; |
@@ -259,24 +259,24 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | |
| 261 | 261 | if (isset($line['speed'])) { |
| 262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
| 263 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
| 263 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 264 | 264 | } 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'])) { |
| 265 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 266 | - if ($distance > 1000 && $distance < 10000) { |
|
| 265 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 266 | + if ($distance > 1000 && $distance < 10000) { |
|
| 267 | 267 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
| 268 | 268 | $speed = $speed*3.6; |
| 269 | 269 | if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
| 270 | 270 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
| 271 | - } |
|
| 271 | + } |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 275 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 276 | - else unset($timediff); |
|
| 277 | - if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
| 274 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 275 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 276 | + else unset($timediff); |
|
| 277 | + if ($this->tmd > 5 || !isset($timediff) || $timediff > 2000 || ($timediff > 30 && isset($this->all_tracked[$id]['latitude']) && isset($this->all_tracked[$id]['longitude']) && $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')))) { |
|
| 278 | 278 | 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'])) { |
| 279 | - 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'])) { |
|
| 279 | + 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'])) { |
|
| 280 | 280 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 281 | 281 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 282 | 282 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -284,195 +284,195 @@ discard block |
||
| 284 | 284 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
| 285 | 285 | $timeelapsed = microtime(true); |
| 286 | 286 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 287 | - $Marine = new Marine($this->db); |
|
| 288 | - $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 289 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 290 | - $Marine->db = null; |
|
| 291 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 287 | + $Marine = new Marine($this->db); |
|
| 288 | + $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 289 | + if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 290 | + $Marine->db = null; |
|
| 291 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 292 | 292 | } |
| 293 | 293 | $this->tmd = 0; |
| 294 | 294 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
| 295 | - } |
|
| 295 | + } |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 299 | 299 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 300 | 300 | 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') { |
| 301 | - $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
| 302 | - $dataFound = true; |
|
| 303 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 301 | + $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
| 302 | + $dataFound = true; |
|
| 303 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 304 | 304 | } |
| 305 | 305 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
| 306 | 306 | } |
| 307 | 307 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 308 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 308 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 309 | 309 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 310 | 310 | 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') { |
| 311 | - $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
| 312 | - $dataFound = true; |
|
| 313 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 311 | + $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
| 312 | + $dataFound = true; |
|
| 313 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 314 | 314 | } |
| 315 | 315 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - } else if ($globalDebug && $timediff > 20) { |
|
| 318 | + } else if ($globalDebug && $timediff > 20) { |
|
| 319 | 319 | $this->tmd = $this->tmd + 1; |
| 320 | 320 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
| 321 | 321 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
| 322 | 322 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
| 323 | 323 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
| 324 | - } |
|
| 324 | + } |
|
| 325 | 325 | } |
| 326 | 326 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 327 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 328 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 327 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 328 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 329 | 329 | } |
| 330 | 330 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 331 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 331 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 332 | 332 | } |
| 333 | 333 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 334 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 334 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 335 | 335 | } |
| 336 | 336 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 337 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 337 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | if (isset($line['heading']) && $line['heading'] != '') { |
| 341 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 342 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 343 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 344 | - //$dataFound = true; |
|
| 341 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 342 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 343 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 344 | + //$dataFound = true; |
|
| 345 | 345 | } 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']) { |
| 346 | - $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']); |
|
| 347 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
| 348 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 349 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 346 | + $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']); |
|
| 347 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
| 348 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 349 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 350 | 350 | } |
| 351 | 351 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
| 352 | 352 | |
| 353 | 353 | |
| 354 | 354 | |
| 355 | 355 | if ($dataFound === true && isset($this->all_tracked[$id]['mmsi'])) { |
| 356 | - $this->all_tracked[$id]['lastupdate'] = time(); |
|
| 357 | - if ($this->all_tracked[$id]['addedMarine'] == 0) { |
|
| 358 | - 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'])) { |
|
| 359 | - if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
| 356 | + $this->all_tracked[$id]['lastupdate'] = time(); |
|
| 357 | + if ($this->all_tracked[$id]['addedMarine'] == 0) { |
|
| 358 | + 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'])) { |
|
| 359 | + if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
| 360 | 360 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 361 | - if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
| 362 | - $timeelapsed = microtime(true); |
|
| 363 | - $MarineLive = new MarineLive($this->db); |
|
| 364 | - if (isset($line['id'])) { |
|
| 361 | + if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
| 362 | + $timeelapsed = microtime(true); |
|
| 363 | + $MarineLive = new MarineLive($this->db); |
|
| 364 | + if (isset($line['id'])) { |
|
| 365 | 365 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
| 366 | 366 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 367 | - } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
| 367 | + } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
| 368 | 368 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
| 369 | 369 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 370 | - } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
| 370 | + } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
| 371 | 371 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
| 372 | 372 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 373 | - } else $recent_ident = ''; |
|
| 374 | - $MarineLive->db=null; |
|
| 375 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 376 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 373 | + } else $recent_ident = ''; |
|
| 374 | + $MarineLive->db=null; |
|
| 375 | + if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 376 | + elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 377 | 377 | } else $recent_ident = ''; |
| 378 | - } else { |
|
| 378 | + } else { |
|
| 379 | 379 | $recent_ident = ''; |
| 380 | 380 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
| 381 | - } |
|
| 382 | - //if there was no vessel with the same callsign within the last hour and go post it into the archive |
|
| 383 | - if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
| 384 | - { |
|
| 381 | + } |
|
| 382 | + //if there was no vessel with the same callsign within the last hour and go post it into the archive |
|
| 383 | + if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
| 384 | + { |
|
| 385 | 385 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
| 386 | 386 | //adds the spotter data for the archive |
| 387 | - $highlight = ''; |
|
| 388 | - 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'))); |
|
| 389 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 387 | + $highlight = ''; |
|
| 388 | + 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'))); |
|
| 389 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 390 | 390 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 391 | - $timeelapsed = microtime(true); |
|
| 392 | - $Marine = new Marine($this->db); |
|
| 393 | - $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']); |
|
| 394 | - $Marine->db = null; |
|
| 395 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 396 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 391 | + $timeelapsed = microtime(true); |
|
| 392 | + $Marine = new Marine($this->db); |
|
| 393 | + $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']); |
|
| 394 | + $Marine->db = null; |
|
| 395 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 396 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 397 | 397 | } |
| 398 | - } |
|
| 399 | - if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
| 398 | + } |
|
| 399 | + if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
| 400 | 400 | // Add source stat in DB |
| 401 | 401 | $Stats = new Stats($this->db); |
| 402 | 402 | if (!empty($this->stats)) { |
| 403 | - if ($globalDebug) echo 'Add source stats : '; |
|
| 404 | - foreach($this->stats as $date => $data) { |
|
| 403 | + if ($globalDebug) echo 'Add source stats : '; |
|
| 404 | + foreach($this->stats as $date => $data) { |
|
| 405 | 405 | foreach($data as $source => $sourced) { |
| 406 | - //print_r($sourced); |
|
| 407 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
| 408 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
| 409 | - if (isset($sourced['msg'])) { |
|
| 410 | - if (time() - $sourced['msg']['date'] > 10) { |
|
| 411 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 412 | - echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
| 413 | - unset($this->stats[$date][$source]['msg']); |
|
| 414 | - } |
|
| 415 | - } |
|
| 416 | - } |
|
| 417 | - if ($date != date('Y-m-d')) { |
|
| 418 | - unset($this->stats[$date]); |
|
| 419 | - } |
|
| 420 | - } |
|
| 421 | - if ($globalDebug) echo 'Done'."\n"; |
|
| 406 | + //print_r($sourced); |
|
| 407 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
| 408 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
| 409 | + if (isset($sourced['msg'])) { |
|
| 410 | + if (time() - $sourced['msg']['date'] > 10) { |
|
| 411 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
| 412 | + echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
| 413 | + unset($this->stats[$date][$source]['msg']); |
|
| 414 | + } |
|
| 415 | + } |
|
| 416 | + } |
|
| 417 | + if ($date != date('Y-m-d')) { |
|
| 418 | + unset($this->stats[$date]); |
|
| 419 | + } |
|
| 420 | + } |
|
| 421 | + if ($globalDebug) echo 'Done'."\n"; |
|
| 422 | 422 | } |
| 423 | 423 | $Stats->db = null; |
| 424 | - } |
|
| 424 | + } |
|
| 425 | 425 | |
| 426 | - $this->del(); |
|
| 426 | + $this->del(); |
|
| 427 | 427 | //$ignoreImport = false; |
| 428 | 428 | $this->all_tracked[$id]['addedMarine'] = 1; |
| 429 | 429 | //print_r($this->all_tracked[$id]); |
| 430 | 430 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 431 | - if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
| 432 | - //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
| 433 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 431 | + if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
| 432 | + //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
| 433 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 434 | 434 | $MarineLive = new MarineLive($this->db); |
| 435 | 435 | $MarineLive->deleteLiveMarineData(); |
| 436 | 436 | $MarineLive->db=null; |
| 437 | 437 | if ($globalDebug) echo " Done\n"; |
| 438 | - } |
|
| 439 | - $this->last_delete = time(); |
|
| 438 | + } |
|
| 439 | + $this->last_delete = time(); |
|
| 440 | 440 | } |
| 441 | - } elseif ($recent_ident != '') { |
|
| 441 | + } elseif ($recent_ident != '') { |
|
| 442 | 442 | $this->all_tracked[$id]['id'] = $recent_ident; |
| 443 | 443 | $this->all_tracked[$id]['addedMarine'] = 1; |
| 444 | 444 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 445 | - if (isset($globalDaemon) && !$globalDaemon) { |
|
| 445 | + if (isset($globalDaemon) && !$globalDaemon) { |
|
| 446 | 446 | $Marine = new Marine($this->db); |
| 447 | 447 | $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']); |
| 448 | 448 | $Marine->db = null; |
| 449 | - } |
|
| 449 | + } |
|
| 450 | 450 | } |
| 451 | 451 | |
| 452 | - } |
|
| 452 | + } |
|
| 453 | + } |
|
| 453 | 454 | } |
| 454 | - } |
|
| 455 | - //adds the spotter LIVE data |
|
| 456 | - if ($globalDebug) { |
|
| 455 | + //adds the spotter LIVE data |
|
| 456 | + if ($globalDebug) { |
|
| 457 | 457 | 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"; |
| 458 | - } |
|
| 459 | - $ignoreImport = false; |
|
| 458 | + } |
|
| 459 | + $ignoreImport = false; |
|
| 460 | 460 | |
| 461 | - if (!$ignoreImport) { |
|
| 461 | + if (!$ignoreImport) { |
|
| 462 | 462 | 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'])) { |
| 463 | 463 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
| 464 | 464 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 465 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 465 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 466 | 466 | $timeelapsed = microtime(true); |
| 467 | 467 | $MarineLive = new MarineLive($this->db); |
| 468 | 468 | $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']); |
| 469 | 469 | $MarineLive->db = null; |
| 470 | 470 | if ($globalDebug) echo $result."\n"; |
| 471 | 471 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 472 | - } |
|
| 472 | + } |
|
| 473 | 473 | } |
| 474 | 474 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
| 475 | - $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']); |
|
| 475 | + $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']); |
|
| 476 | 476 | } |
| 477 | 477 | $this->all_tracked[$id]['putinarchive'] = false; |
| 478 | 478 | |
@@ -504,7 +504,7 @@ discard block |
||
| 504 | 504 | if ($stats_heading == 16) $stats_heading = 0; |
| 505 | 505 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
| 506 | 506 | for ($i=0;$i<=15;$i++) { |
| 507 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 507 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
| 508 | 508 | } |
| 509 | 509 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
| 510 | 510 | } else { |
@@ -517,11 +517,11 @@ discard block |
||
| 517 | 517 | //var_dump($this->stats); |
| 518 | 518 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
| 519 | 519 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
| 520 | - end($this->stats[$current_date][$source]['hist']); |
|
| 521 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 520 | + end($this->stats[$current_date][$source]['hist']); |
|
| 521 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
| 522 | 522 | } else $mini = 0; |
| 523 | 523 | for ($i=$mini;$i<=$distance;$i+=10) { |
| 524 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 524 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
| 525 | 525 | } |
| 526 | 526 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
| 527 | 527 | } else { |
@@ -537,24 +537,24 @@ discard block |
||
| 537 | 537 | |
| 538 | 538 | |
| 539 | 539 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 540 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 540 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 541 | 541 | if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
| 542 | 542 | $MarineLive = new MarineLive($this->db); |
| 543 | 543 | $MarineLive->deleteLiveMarineDataNotUpdated(); |
| 544 | 544 | $MarineLive->db = null; |
| 545 | 545 | //MarineLive->deleteLiveMarineData(); |
| 546 | 546 | if ($globalDebug) echo " Done\n"; |
| 547 | - } |
|
| 548 | - $this->last_delete_hourly = time(); |
|
| 547 | + } |
|
| 548 | + $this->last_delete_hourly = time(); |
|
| 549 | 549 | } |
| 550 | 550 | |
| 551 | - } |
|
| 552 | - //$ignoreImport = false; |
|
| 551 | + } |
|
| 552 | + //$ignoreImport = false; |
|
| 553 | 553 | } |
| 554 | 554 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 555 | 555 | if ($send) return $this->all_tracked[$id]; |
| 556 | - } |
|
| 556 | + } |
|
| 557 | + } |
|
| 557 | 558 | } |
| 558 | - } |
|
| 559 | 559 | } |
| 560 | 560 | ?> |
@@ -12,10 +12,10 @@ discard block |
||
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | - * Get SQL query part for filter used |
|
| 16 | - * @param Array $filter the filter |
|
| 17 | - * @return Array the SQL part |
|
| 18 | - */ |
|
| 15 | + * Get SQL query part for filter used |
|
| 16 | + * @param Array $filter the filter |
|
| 17 | + * @return Array the SQL part |
|
| 18 | + */ |
|
| 19 | 19 | |
| 20 | 20 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 21 | 21 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -82,14 +82,14 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
| 85 | - * Executes the SQL statements to get the spotter information |
|
| 86 | - * |
|
| 87 | - * @param String $query the SQL query |
|
| 88 | - * @param Array $params parameter of the query |
|
| 89 | - * @param String $limitQuery the limit query |
|
| 90 | - * @return Array the spotter information |
|
| 91 | - * |
|
| 92 | - */ |
|
| 85 | + * Executes the SQL statements to get the spotter information |
|
| 86 | + * |
|
| 87 | + * @param String $query the SQL query |
|
| 88 | + * @param Array $params parameter of the query |
|
| 89 | + * @param String $limitQuery the limit query |
|
| 90 | + * @return Array the spotter information |
|
| 91 | + * |
|
| 92 | + */ |
|
| 93 | 93 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
| 94 | 94 | { |
| 95 | 95 | date_default_timezone_set('UTC'); |
@@ -220,11 +220,11 @@ discard block |
||
| 220 | 220 | |
| 221 | 221 | |
| 222 | 222 | /** |
| 223 | - * Gets all the spotter information based on the latest data entry |
|
| 224 | - * |
|
| 225 | - * @return Array the spotter information |
|
| 226 | - * |
|
| 227 | - */ |
|
| 223 | + * Gets all the spotter information based on the latest data entry |
|
| 224 | + * |
|
| 225 | + * @return Array the spotter information |
|
| 226 | + * |
|
| 227 | + */ |
|
| 228 | 228 | public function getLatestMarineData($limit = '', $sort = '', $filter = array()) |
| 229 | 229 | { |
| 230 | 230 | global $global_query; |
@@ -273,11 +273,11 @@ discard block |
||
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /** |
| 276 | - * Gets all the spotter information based on the callsign |
|
| 277 | - * |
|
| 278 | - * @return Array the spotter information |
|
| 279 | - * |
|
| 280 | - */ |
|
| 276 | + * Gets all the spotter information based on the callsign |
|
| 277 | + * |
|
| 278 | + * @return Array the spotter information |
|
| 279 | + * |
|
| 280 | + */ |
|
| 281 | 281 | public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
| 282 | 282 | { |
| 283 | 283 | global $global_query; |
@@ -329,11 +329,11 @@ discard block |
||
| 329 | 329 | } |
| 330 | 330 | |
| 331 | 331 | /** |
| 332 | - * Gets all the marine information based on the type |
|
| 333 | - * |
|
| 334 | - * @return Array the marine information |
|
| 335 | - * |
|
| 336 | - */ |
|
| 332 | + * Gets all the marine information based on the type |
|
| 333 | + * |
|
| 334 | + * @return Array the marine information |
|
| 335 | + * |
|
| 336 | + */ |
|
| 337 | 337 | public function getMarineDataByType($type = '', $limit = '', $sort = '', $filter = array()) |
| 338 | 338 | { |
| 339 | 339 | global $global_query; |
@@ -441,12 +441,12 @@ discard block |
||
| 441 | 441 | |
| 442 | 442 | |
| 443 | 443 | /** |
| 444 | - * Gets all source name |
|
| 445 | - * |
|
| 446 | - * @param String type format of source |
|
| 447 | - * @return Array list of source name |
|
| 448 | - * |
|
| 449 | - */ |
|
| 444 | + * Gets all source name |
|
| 445 | + * |
|
| 446 | + * @param String type format of source |
|
| 447 | + * @return Array list of source name |
|
| 448 | + * |
|
| 449 | + */ |
|
| 450 | 450 | public function getAllSourceName($type = '',$filters = array()) |
| 451 | 451 | { |
| 452 | 452 | $filter_query = $this->getFilter($filters,true,true); |
@@ -476,11 +476,11 @@ discard block |
||
| 476 | 476 | |
| 477 | 477 | |
| 478 | 478 | /** |
| 479 | - * Gets a list of all idents/callsigns |
|
| 480 | - * |
|
| 481 | - * @return Array list of ident/callsign names |
|
| 482 | - * |
|
| 483 | - */ |
|
| 479 | + * Gets a list of all idents/callsigns |
|
| 480 | + * |
|
| 481 | + * @return Array list of ident/callsign names |
|
| 482 | + * |
|
| 483 | + */ |
|
| 484 | 484 | public function getAllIdents($filters = array()) |
| 485 | 485 | { |
| 486 | 486 | $filter_query = $this->getFilter($filters,true,true); |
@@ -504,11 +504,11 @@ discard block |
||
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | /** |
| 507 | - * Gets all info from a mmsi |
|
| 508 | - * |
|
| 509 | - * @return Array ident |
|
| 510 | - * |
|
| 511 | - */ |
|
| 507 | + * Gets all info from a mmsi |
|
| 508 | + * |
|
| 509 | + * @return Array ident |
|
| 510 | + * |
|
| 511 | + */ |
|
| 512 | 512 | public function getIdentity($mmsi) |
| 513 | 513 | { |
| 514 | 514 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -521,9 +521,9 @@ discard block |
||
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | /** |
| 524 | - * Add identity |
|
| 525 | - * |
|
| 526 | - */ |
|
| 524 | + * Add identity |
|
| 525 | + * |
|
| 526 | + */ |
|
| 527 | 527 | public function addIdentity($mmsi,$imo,$ident,$callsign,$type) |
| 528 | 528 | { |
| 529 | 529 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -589,13 +589,13 @@ discard block |
||
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | /** |
| 592 | - * Update ident tracker data |
|
| 593 | - * |
|
| 594 | - * @param String $fammarine_id the ID |
|
| 595 | - * @param String $ident the marine ident |
|
| 596 | - * @return String success or false |
|
| 597 | - * |
|
| 598 | - */ |
|
| 592 | + * Update ident tracker data |
|
| 593 | + * |
|
| 594 | + * @param String $fammarine_id the ID |
|
| 595 | + * @param String $ident the marine ident |
|
| 596 | + * @return String success or false |
|
| 597 | + * |
|
| 598 | + */ |
|
| 599 | 599 | public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
| 600 | 600 | { |
| 601 | 601 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
@@ -610,13 +610,13 @@ discard block |
||
| 610 | 610 | } |
| 611 | 611 | |
| 612 | 612 | /** |
| 613 | - * Update arrival marine data |
|
| 614 | - * |
|
| 615 | - * @param String $fammarine_id the ID |
|
| 616 | - * @param String $arrival_code the marine ident |
|
| 617 | - * @return String success or false |
|
| 618 | - * |
|
| 619 | - */ |
|
| 613 | + * Update arrival marine data |
|
| 614 | + * |
|
| 615 | + * @param String $fammarine_id the ID |
|
| 616 | + * @param String $arrival_code the marine ident |
|
| 617 | + * @return String success or false |
|
| 618 | + * |
|
| 619 | + */ |
|
| 620 | 620 | public function updateArrivalPortNameMarineData($fammarine_id = '', $arrival_code = '',$fromsource = NULL) |
| 621 | 621 | { |
| 622 | 622 | $query = 'UPDATE marine_output SET arrival_port_name = :arrival_code WHERE fammarine_id = :fammarine_id'; |
@@ -631,19 +631,19 @@ discard block |
||
| 631 | 631 | } |
| 632 | 632 | |
| 633 | 633 | /** |
| 634 | - * Update Status data |
|
| 635 | - * |
|
| 636 | - * @param String $fammarine_id the ID |
|
| 637 | - * @param String $status_id the marine status id |
|
| 638 | - * @param String $status the marine status |
|
| 639 | - * @return String success or false |
|
| 640 | - * |
|
| 641 | - */ |
|
| 634 | + * Update Status data |
|
| 635 | + * |
|
| 636 | + * @param String $fammarine_id the ID |
|
| 637 | + * @param String $status_id the marine status id |
|
| 638 | + * @param String $status the marine status |
|
| 639 | + * @return String success or false |
|
| 640 | + * |
|
| 641 | + */ |
|
| 642 | 642 | public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
| 643 | 643 | { |
| 644 | 644 | |
| 645 | 645 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
| 646 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
| 646 | + $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
| 647 | 647 | |
| 648 | 648 | try { |
| 649 | 649 | $sth = $this->db->prepare($query); |
@@ -656,17 +656,17 @@ discard block |
||
| 656 | 656 | |
| 657 | 657 | } |
| 658 | 658 | /** |
| 659 | - * Update latest marine data |
|
| 660 | - * |
|
| 661 | - * @param String $fammarine_id the ID |
|
| 662 | - * @param String $ident the marine ident |
|
| 663 | - * @return String success or false |
|
| 664 | - * |
|
| 665 | - */ |
|
| 659 | + * Update latest marine data |
|
| 660 | + * |
|
| 661 | + * @param String $fammarine_id the ID |
|
| 662 | + * @param String $ident the marine ident |
|
| 663 | + * @return String success or false |
|
| 664 | + * |
|
| 665 | + */ |
|
| 666 | 666 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '') |
| 667 | 667 | { |
| 668 | 668 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id'; |
| 669 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 669 | + $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 670 | 670 | |
| 671 | 671 | try { |
| 672 | 672 | $sth = $this->db->prepare($query); |
@@ -680,30 +680,30 @@ discard block |
||
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | /** |
| 683 | - * Adds a new spotter data |
|
| 684 | - * |
|
| 685 | - * @param String $fammarine_id the ID |
|
| 686 | - * @param String $ident the marine ident |
|
| 687 | - * @param String $departure_airport_icao the departure airport |
|
| 688 | - * @param String $arrival_airport_icao the arrival airport |
|
| 689 | - * @param String $latitude latitude of flight |
|
| 690 | - * @param String $longitude latitude of flight |
|
| 691 | - * @param String $waypoints waypoints of flight |
|
| 692 | - * @param String $heading heading of flight |
|
| 693 | - * @param String $groundspeed speed of flight |
|
| 694 | - * @param String $date date of flight |
|
| 695 | - * @param String $departure_airport_time departure time of flight |
|
| 696 | - * @param String $arrival_airport_time arrival time of flight |
|
| 697 | - * @param String $squawk squawk code of flight |
|
| 698 | - * @param String $route_stop route stop of flight |
|
| 699 | - * @param String $highlight highlight or not |
|
| 700 | - * @param String $ModeS ModesS code of flight |
|
| 701 | - * @param String $registration registration code of flight |
|
| 702 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 703 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 704 | - * @param String $verticalrate vertival rate of flight |
|
| 705 | - * @return String success or false |
|
| 706 | - */ |
|
| 683 | + * Adds a new spotter data |
|
| 684 | + * |
|
| 685 | + * @param String $fammarine_id the ID |
|
| 686 | + * @param String $ident the marine ident |
|
| 687 | + * @param String $departure_airport_icao the departure airport |
|
| 688 | + * @param String $arrival_airport_icao the arrival airport |
|
| 689 | + * @param String $latitude latitude of flight |
|
| 690 | + * @param String $longitude latitude of flight |
|
| 691 | + * @param String $waypoints waypoints of flight |
|
| 692 | + * @param String $heading heading of flight |
|
| 693 | + * @param String $groundspeed speed of flight |
|
| 694 | + * @param String $date date of flight |
|
| 695 | + * @param String $departure_airport_time departure time of flight |
|
| 696 | + * @param String $arrival_airport_time arrival time of flight |
|
| 697 | + * @param String $squawk squawk code of flight |
|
| 698 | + * @param String $route_stop route stop of flight |
|
| 699 | + * @param String $highlight highlight or not |
|
| 700 | + * @param String $ModeS ModesS code of flight |
|
| 701 | + * @param String $registration registration code of flight |
|
| 702 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 703 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 704 | + * @param String $verticalrate vertival rate of flight |
|
| 705 | + * @return String success or false |
|
| 706 | + */ |
|
| 707 | 707 | public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$statusid = '',$format_source = '', $source_name = '') |
| 708 | 708 | { |
| 709 | 709 | global $globalURL, $globalMarineImageFetch; |
@@ -818,7 +818,7 @@ discard block |
||
| 818 | 818 | $sth->execute($query_values); |
| 819 | 819 | $this->db = null; |
| 820 | 820 | } catch (PDOException $e) { |
| 821 | - return "error : ".$e->getMessage(); |
|
| 821 | + return "error : ".$e->getMessage(); |
|
| 822 | 822 | } |
| 823 | 823 | |
| 824 | 824 | return "success"; |
@@ -827,11 +827,11 @@ discard block |
||
| 827 | 827 | |
| 828 | 828 | |
| 829 | 829 | /** |
| 830 | - * Gets the aircraft ident within the last hour |
|
| 831 | - * |
|
| 832 | - * @return String the ident |
|
| 833 | - * |
|
| 834 | - */ |
|
| 830 | + * Gets the aircraft ident within the last hour |
|
| 831 | + * |
|
| 832 | + * @return String the ident |
|
| 833 | + * |
|
| 834 | + */ |
|
| 835 | 835 | public function getIdentFromLastHour($ident) |
| 836 | 836 | { |
| 837 | 837 | global $globalDBdriver, $globalTimezone; |
@@ -847,11 +847,11 @@ discard block |
||
| 847 | 847 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 848 | 848 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
| 849 | 849 | $query_data = array(':ident' => $ident); |
| 850 | - } |
|
| 850 | + } |
|
| 851 | 851 | |
| 852 | 852 | $sth = $this->db->prepare($query); |
| 853 | 853 | $sth->execute($query_data); |
| 854 | - $ident_result=''; |
|
| 854 | + $ident_result=''; |
|
| 855 | 855 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 856 | 856 | { |
| 857 | 857 | $ident_result = $row['ident']; |
@@ -862,11 +862,11 @@ discard block |
||
| 862 | 862 | |
| 863 | 863 | |
| 864 | 864 | /** |
| 865 | - * Gets the aircraft data from the last 20 seconds |
|
| 866 | - * |
|
| 867 | - * @return Array the spotter data |
|
| 868 | - * |
|
| 869 | - */ |
|
| 865 | + * Gets the aircraft data from the last 20 seconds |
|
| 866 | + * |
|
| 867 | + * @return Array the spotter data |
|
| 868 | + * |
|
| 869 | + */ |
|
| 870 | 870 | public function getRealTimeData($q = '') |
| 871 | 871 | { |
| 872 | 872 | global $globalDBdriver; |
@@ -904,11 +904,11 @@ discard block |
||
| 904 | 904 | |
| 905 | 905 | |
| 906 | 906 | /** |
| 907 | - * Gets all number of flight over countries |
|
| 908 | - * |
|
| 909 | - * @return Array the airline country list |
|
| 910 | - * |
|
| 911 | - */ |
|
| 907 | + * Gets all number of flight over countries |
|
| 908 | + * |
|
| 909 | + * @return Array the airline country list |
|
| 910 | + * |
|
| 911 | + */ |
|
| 912 | 912 | |
| 913 | 913 | public function countAllMarineOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 914 | 914 | { |
@@ -981,11 +981,11 @@ discard block |
||
| 981 | 981 | |
| 982 | 982 | |
| 983 | 983 | /** |
| 984 | - * Gets all callsigns that have flown over |
|
| 985 | - * |
|
| 986 | - * @return Array the callsign list |
|
| 987 | - * |
|
| 988 | - */ |
|
| 984 | + * Gets all callsigns that have flown over |
|
| 985 | + * |
|
| 986 | + * @return Array the callsign list |
|
| 987 | + * |
|
| 988 | + */ |
|
| 989 | 989 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 990 | 990 | { |
| 991 | 991 | global $globalDBdriver; |
@@ -1052,11 +1052,11 @@ discard block |
||
| 1052 | 1052 | |
| 1053 | 1053 | |
| 1054 | 1054 | /** |
| 1055 | - * Counts all dates |
|
| 1056 | - * |
|
| 1057 | - * @return Array the date list |
|
| 1058 | - * |
|
| 1059 | - */ |
|
| 1055 | + * Counts all dates |
|
| 1056 | + * |
|
| 1057 | + * @return Array the date list |
|
| 1058 | + * |
|
| 1059 | + */ |
|
| 1060 | 1060 | public function countAllDates($filters = array()) |
| 1061 | 1061 | { |
| 1062 | 1062 | global $globalTimezone, $globalDBdriver; |
@@ -1102,11 +1102,11 @@ discard block |
||
| 1102 | 1102 | |
| 1103 | 1103 | |
| 1104 | 1104 | /** |
| 1105 | - * Counts all dates during the last 7 days |
|
| 1106 | - * |
|
| 1107 | - * @return Array the date list |
|
| 1108 | - * |
|
| 1109 | - */ |
|
| 1105 | + * Counts all dates during the last 7 days |
|
| 1106 | + * |
|
| 1107 | + * @return Array the date list |
|
| 1108 | + * |
|
| 1109 | + */ |
|
| 1110 | 1110 | public function countAllDatesLast7Days($filters = array()) |
| 1111 | 1111 | { |
| 1112 | 1112 | global $globalTimezone, $globalDBdriver; |
@@ -1128,7 +1128,7 @@ discard block |
||
| 1128 | 1128 | $query .= " GROUP BY date_name |
| 1129 | 1129 | ORDER BY date_name ASC"; |
| 1130 | 1130 | $query_data = array(':offset' => $offset); |
| 1131 | - } |
|
| 1131 | + } |
|
| 1132 | 1132 | |
| 1133 | 1133 | $sth = $this->db->prepare($query); |
| 1134 | 1134 | $sth->execute($query_data); |
@@ -1148,11 +1148,11 @@ discard block |
||
| 1148 | 1148 | } |
| 1149 | 1149 | |
| 1150 | 1150 | /** |
| 1151 | - * Counts all dates during the last month |
|
| 1152 | - * |
|
| 1153 | - * @return Array the date list |
|
| 1154 | - * |
|
| 1155 | - */ |
|
| 1151 | + * Counts all dates during the last month |
|
| 1152 | + * |
|
| 1153 | + * @return Array the date list |
|
| 1154 | + * |
|
| 1155 | + */ |
|
| 1156 | 1156 | public function countAllDatesLastMonth($filters = array()) |
| 1157 | 1157 | { |
| 1158 | 1158 | global $globalTimezone, $globalDBdriver; |
@@ -1174,7 +1174,7 @@ discard block |
||
| 1174 | 1174 | $query .= " GROUP BY date_name |
| 1175 | 1175 | ORDER BY date_name ASC"; |
| 1176 | 1176 | $query_data = array(':offset' => $offset); |
| 1177 | - } |
|
| 1177 | + } |
|
| 1178 | 1178 | |
| 1179 | 1179 | $sth = $this->db->prepare($query); |
| 1180 | 1180 | $sth->execute($query_data); |
@@ -1196,11 +1196,11 @@ discard block |
||
| 1196 | 1196 | |
| 1197 | 1197 | |
| 1198 | 1198 | /** |
| 1199 | - * Counts all month |
|
| 1200 | - * |
|
| 1201 | - * @return Array the month list |
|
| 1202 | - * |
|
| 1203 | - */ |
|
| 1199 | + * Counts all month |
|
| 1200 | + * |
|
| 1201 | + * @return Array the month list |
|
| 1202 | + * |
|
| 1203 | + */ |
|
| 1204 | 1204 | public function countAllMonths($filters = array()) |
| 1205 | 1205 | { |
| 1206 | 1206 | global $globalTimezone, $globalDBdriver; |
@@ -1245,11 +1245,11 @@ discard block |
||
| 1245 | 1245 | |
| 1246 | 1246 | |
| 1247 | 1247 | /** |
| 1248 | - * Counts all dates during the last year |
|
| 1249 | - * |
|
| 1250 | - * @return Array the date list |
|
| 1251 | - * |
|
| 1252 | - */ |
|
| 1248 | + * Counts all dates during the last year |
|
| 1249 | + * |
|
| 1250 | + * @return Array the date list |
|
| 1251 | + * |
|
| 1252 | + */ |
|
| 1253 | 1253 | public function countAllMonthsLastYear($filters) |
| 1254 | 1254 | { |
| 1255 | 1255 | global $globalTimezone, $globalDBdriver; |
@@ -1271,7 +1271,7 @@ discard block |
||
| 1271 | 1271 | $query .= " GROUP BY year_name, month_name |
| 1272 | 1272 | ORDER BY year_name, month_name ASC"; |
| 1273 | 1273 | $query_data = array(':offset' => $offset); |
| 1274 | - } |
|
| 1274 | + } |
|
| 1275 | 1275 | |
| 1276 | 1276 | $sth = $this->db->prepare($query); |
| 1277 | 1277 | $sth->execute($query_data); |
@@ -1294,11 +1294,11 @@ discard block |
||
| 1294 | 1294 | |
| 1295 | 1295 | |
| 1296 | 1296 | /** |
| 1297 | - * Counts all hours |
|
| 1298 | - * |
|
| 1299 | - * @return Array the hour list |
|
| 1300 | - * |
|
| 1301 | - */ |
|
| 1297 | + * Counts all hours |
|
| 1298 | + * |
|
| 1299 | + * @return Array the hour list |
|
| 1300 | + * |
|
| 1301 | + */ |
|
| 1302 | 1302 | public function countAllHours($orderby,$filters = array()) |
| 1303 | 1303 | { |
| 1304 | 1304 | global $globalTimezone, $globalDBdriver; |
@@ -1361,11 +1361,11 @@ discard block |
||
| 1361 | 1361 | |
| 1362 | 1362 | |
| 1363 | 1363 | /** |
| 1364 | - * Counts all hours by date |
|
| 1365 | - * |
|
| 1366 | - * @return Array the hour list |
|
| 1367 | - * |
|
| 1368 | - */ |
|
| 1364 | + * Counts all hours by date |
|
| 1365 | + * |
|
| 1366 | + * @return Array the hour list |
|
| 1367 | + * |
|
| 1368 | + */ |
|
| 1369 | 1369 | public function countAllHoursByDate($date, $filters = array()) |
| 1370 | 1370 | { |
| 1371 | 1371 | global $globalTimezone, $globalDBdriver; |
@@ -1409,11 +1409,11 @@ discard block |
||
| 1409 | 1409 | |
| 1410 | 1410 | |
| 1411 | 1411 | /** |
| 1412 | - * Counts all hours by a ident/callsign |
|
| 1413 | - * |
|
| 1414 | - * @return Array the hour list |
|
| 1415 | - * |
|
| 1416 | - */ |
|
| 1412 | + * Counts all hours by a ident/callsign |
|
| 1413 | + * |
|
| 1414 | + * @return Array the hour list |
|
| 1415 | + * |
|
| 1416 | + */ |
|
| 1417 | 1417 | public function countAllHoursByIdent($ident, $filters = array()) |
| 1418 | 1418 | { |
| 1419 | 1419 | global $globalTimezone, $globalDBdriver; |
@@ -1458,11 +1458,11 @@ discard block |
||
| 1458 | 1458 | |
| 1459 | 1459 | |
| 1460 | 1460 | /** |
| 1461 | - * Counts all vessels |
|
| 1462 | - * |
|
| 1463 | - * @return Integer the number of vessels |
|
| 1464 | - * |
|
| 1465 | - */ |
|
| 1461 | + * Counts all vessels |
|
| 1462 | + * |
|
| 1463 | + * @return Integer the number of vessels |
|
| 1464 | + * |
|
| 1465 | + */ |
|
| 1466 | 1466 | public function countOverallMarine($filters = array(),$year = '',$month = '') |
| 1467 | 1467 | { |
| 1468 | 1468 | global $globalDBdriver; |
@@ -1497,11 +1497,11 @@ discard block |
||
| 1497 | 1497 | } |
| 1498 | 1498 | |
| 1499 | 1499 | /** |
| 1500 | - * Counts all vessel type |
|
| 1501 | - * |
|
| 1502 | - * @return Integer the number of vessels |
|
| 1503 | - * |
|
| 1504 | - */ |
|
| 1500 | + * Counts all vessel type |
|
| 1501 | + * |
|
| 1502 | + * @return Integer the number of vessels |
|
| 1503 | + * |
|
| 1504 | + */ |
|
| 1505 | 1505 | public function countOverallMarineTypes($filters = array(),$year = '',$month = '') |
| 1506 | 1506 | { |
| 1507 | 1507 | global $globalDBdriver; |
@@ -1536,11 +1536,11 @@ discard block |
||
| 1536 | 1536 | |
| 1537 | 1537 | |
| 1538 | 1538 | /** |
| 1539 | - * Counts all hours of today |
|
| 1540 | - * |
|
| 1541 | - * @return Array the hour list |
|
| 1542 | - * |
|
| 1543 | - */ |
|
| 1539 | + * Counts all hours of today |
|
| 1540 | + * |
|
| 1541 | + * @return Array the hour list |
|
| 1542 | + * |
|
| 1543 | + */ |
|
| 1544 | 1544 | public function countAllHoursFromToday($filters = array()) |
| 1545 | 1545 | { |
| 1546 | 1546 | global $globalTimezone, $globalDBdriver; |
@@ -1580,12 +1580,12 @@ discard block |
||
| 1580 | 1580 | } |
| 1581 | 1581 | |
| 1582 | 1582 | |
| 1583 | - /** |
|
| 1584 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1585 | - * |
|
| 1586 | - * @return Integer the Barrie Spotter ID |
|
| 1583 | + /** |
|
| 1584 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1585 | + * |
|
| 1586 | + * @return Integer the Barrie Spotter ID |
|
| 1587 | 1587 | q * |
| 1588 | - */ |
|
| 1588 | + */ |
|
| 1589 | 1589 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
| 1590 | 1590 | { |
| 1591 | 1591 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -1606,13 +1606,13 @@ discard block |
||
| 1606 | 1606 | |
| 1607 | 1607 | |
| 1608 | 1608 | /** |
| 1609 | - * Parses a date string |
|
| 1610 | - * |
|
| 1611 | - * @param String $dateString the date string |
|
| 1612 | - * @param String $timezone the timezone of a user |
|
| 1613 | - * @return Array the time information |
|
| 1614 | - * |
|
| 1615 | - */ |
|
| 1609 | + * Parses a date string |
|
| 1610 | + * |
|
| 1611 | + * @param String $dateString the date string |
|
| 1612 | + * @param String $timezone the timezone of a user |
|
| 1613 | + * @return Array the time information |
|
| 1614 | + * |
|
| 1615 | + */ |
|
| 1616 | 1616 | public function parseDateString($dateString, $timezone = '') |
| 1617 | 1617 | { |
| 1618 | 1618 | $time_array = array(); |
@@ -1645,12 +1645,12 @@ discard block |
||
| 1645 | 1645 | } |
| 1646 | 1646 | |
| 1647 | 1647 | /** |
| 1648 | - * Parses the direction degrees to working |
|
| 1649 | - * |
|
| 1650 | - * @param Float $direction the direction in degrees |
|
| 1651 | - * @return Array the direction information |
|
| 1652 | - * |
|
| 1653 | - */ |
|
| 1648 | + * Parses the direction degrees to working |
|
| 1649 | + * |
|
| 1650 | + * @param Float $direction the direction in degrees |
|
| 1651 | + * @return Array the direction information |
|
| 1652 | + * |
|
| 1653 | + */ |
|
| 1654 | 1654 | public function parseDirection($direction = 0) |
| 1655 | 1655 | { |
| 1656 | 1656 | if ($direction == '') $direction = 0; |
@@ -1729,12 +1729,12 @@ discard block |
||
| 1729 | 1729 | |
| 1730 | 1730 | |
| 1731 | 1731 | /** |
| 1732 | - * Gets Country from latitude/longitude |
|
| 1733 | - * |
|
| 1734 | - * @param Float $latitude latitute of the flight |
|
| 1735 | - * @param Float $longitude longitute of the flight |
|
| 1736 | - * @return String the countrie |
|
| 1737 | - */ |
|
| 1732 | + * Gets Country from latitude/longitude |
|
| 1733 | + * |
|
| 1734 | + * @param Float $latitude latitute of the flight |
|
| 1735 | + * @param Float $longitude longitute of the flight |
|
| 1736 | + * @return String the countrie |
|
| 1737 | + */ |
|
| 1738 | 1738 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 1739 | 1739 | { |
| 1740 | 1740 | global $globalDBdriver, $globalDebug; |
@@ -1771,11 +1771,11 @@ discard block |
||
| 1771 | 1771 | } |
| 1772 | 1772 | |
| 1773 | 1773 | /** |
| 1774 | - * Gets Country from iso2 |
|
| 1775 | - * |
|
| 1776 | - * @param String $iso2 ISO2 country code |
|
| 1777 | - * @return String the countrie |
|
| 1778 | - */ |
|
| 1774 | + * Gets Country from iso2 |
|
| 1775 | + * |
|
| 1776 | + * @param String $iso2 ISO2 country code |
|
| 1777 | + * @return String the countrie |
|
| 1778 | + */ |
|
| 1779 | 1779 | public function getCountryFromISO2($iso2) |
| 1780 | 1780 | { |
| 1781 | 1781 | global $globalDBdriver, $globalDebug; |
@@ -1804,12 +1804,12 @@ discard block |
||
| 1804 | 1804 | |
| 1805 | 1805 | |
| 1806 | 1806 | /** |
| 1807 | - * Gets the short url from bit.ly |
|
| 1808 | - * |
|
| 1809 | - * @param String $url the full url |
|
| 1810 | - * @return String the bit.ly url |
|
| 1811 | - * |
|
| 1812 | - */ |
|
| 1807 | + * Gets the short url from bit.ly |
|
| 1808 | + * |
|
| 1809 | + * @param String $url the full url |
|
| 1810 | + * @return String the bit.ly url |
|
| 1811 | + * |
|
| 1812 | + */ |
|
| 1813 | 1813 | public function getBitlyURL($url) |
| 1814 | 1814 | { |
| 1815 | 1815 | global $globalBitlyAccessToken; |
@@ -1836,11 +1836,11 @@ discard block |
||
| 1836 | 1836 | |
| 1837 | 1837 | |
| 1838 | 1838 | /** |
| 1839 | - * Gets all vessels types that have flown over |
|
| 1840 | - * |
|
| 1841 | - * @return Array the vessel type list |
|
| 1842 | - * |
|
| 1843 | - */ |
|
| 1839 | + * Gets all vessels types that have flown over |
|
| 1840 | + * |
|
| 1841 | + * @return Array the vessel type list |
|
| 1842 | + * |
|
| 1843 | + */ |
|
| 1844 | 1844 | public function countAllMarineTypes($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array(),$year = '',$month = '',$day = '') |
| 1845 | 1845 | { |
| 1846 | 1846 | global $globalDBdriver; |
@@ -1906,11 +1906,11 @@ discard block |
||
| 1906 | 1906 | } |
| 1907 | 1907 | |
| 1908 | 1908 | /** |
| 1909 | - * Gets all the tracker information |
|
| 1910 | - * |
|
| 1911 | - * @return Array the tracker information |
|
| 1912 | - * |
|
| 1913 | - */ |
|
| 1909 | + * Gets all the tracker information |
|
| 1910 | + * |
|
| 1911 | + * @return Array the tracker information |
|
| 1912 | + * |
|
| 1913 | + */ |
|
| 1914 | 1914 | public function searchMarineData($q = '', $callsign = '',$mmsi = '', $imo = '', $date_posted = '', $limit = '', $sort = '', $includegeodata = '',$origLat = '',$origLon = '',$dist = '',$filters = array()) |
| 1915 | 1915 | { |
| 1916 | 1916 | global $globalTimezone, $globalDBdriver; |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | print '<div class="select-item">'; |
| 43 | 43 | print '<form action="'.$globalURL.'/aircraft" method="get">'; |
| 44 | 44 | print '<select name="aircraft_type" class="selectpicker" data-live-search="true">'; |
| 45 | - print '<option></option>'; |
|
| 46 | - $Stats = new Stats(); |
|
| 45 | + print '<option></option>'; |
|
| 46 | + $Stats = new Stats(); |
|
| 47 | 47 | $aircraft_types = $Stats->getAllAircraftTypes(); |
| 48 | 48 | if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
| 49 | 49 | foreach($aircraft_types as $aircrafttype) |
@@ -54,20 +54,20 @@ discard block |
||
| 54 | 54 | } else { |
| 55 | 55 | print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_manufacturer'].' '.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
| 56 | 56 | } |
| 57 | - } |
|
| 58 | - print '</select>'; |
|
| 59 | - print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>'; |
|
| 57 | + } |
|
| 58 | + print '</select>'; |
|
| 59 | + print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>'; |
|
| 60 | 60 | print '</form>'; |
| 61 | 61 | print '</div>'; |
| 62 | 62 | |
| 63 | 63 | if ($aircraft_type != "NA") |
| 64 | 64 | { |
| 65 | - print '<div class="info column">'; |
|
| 66 | - print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>'; |
|
| 67 | - print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>'; |
|
| 68 | - print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; |
|
| 69 | - if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>'; |
|
| 70 | - print '</div>'; |
|
| 65 | + print '<div class="info column">'; |
|
| 66 | + print '<h1>'.$spotter_array[0]['aircraft_name'].' ('.$spotter_array[0]['aircraft_type'].')</h1>'; |
|
| 67 | + print '<div><span class="label">'._("Name").'</span>'.$spotter_array[0]['aircraft_name'].'</div>'; |
|
| 68 | + print '<div><span class="label">'._("ICAO").'</span>'.$spotter_array[0]['aircraft_type'].'</div>'; |
|
| 69 | + if (isset($spotter_array[0]['aircraft_manufacturer'])) print '<div><span class="label">'._("Manufacturer").'</span><a href="'.$globalURL.'/manufacturer/'.strtolower(str_replace(" ", "-", $spotter_array[0]['aircraft_manufacturer'])).'">'.$spotter_array[0]['aircraft_manufacturer'].'</a></div>'; |
|
| 70 | + print '</div>'; |
|
| 71 | 71 | } else { |
| 72 | 72 | print '<div class="alert alert-warning">'._("This special aircraft profile shows all flights in where the aircraft type is unknown.").'</div>'; |
| 73 | 73 | } |
@@ -254,16 +254,16 @@ discard block |
||
| 254 | 254 | <div class="more"> |
| 255 | 255 | <?php |
| 256 | 256 | |
| 257 | - if ($year != '' && $month != '') { |
|
| 258 | - ?> |
|
| 257 | + if ($year != '' && $month != '') { |
|
| 258 | + ?> |
|
| 259 | 259 | <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 260 | 260 | <?php |
| 261 | - } else { |
|
| 262 | - ?> |
|
| 261 | + } else { |
|
| 262 | + ?> |
|
| 263 | 263 | <a href="<?php print $globalURL; ?>/marine/statistics/type" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
| 264 | 264 | <?php |
| 265 | - } |
|
| 266 | - ?> |
|
| 265 | + } |
|
| 266 | + ?> |
|
| 267 | 267 | </div> |
| 268 | 268 | </div> |
| 269 | 269 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | ?> |
| 298 | 298 | <div class="more"> |
| 299 | 299 | <?php |
| 300 | - /* |
|
| 300 | + /* |
|
| 301 | 301 | if ($year != '' && $month != '') { |
| 302 | 302 | ?> |
| 303 | 303 | <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | <?php |
| 309 | 309 | } |
| 310 | 310 | */ |
| 311 | - ?> |
|
| 311 | + ?> |
|
| 312 | 312 | </div> |
| 313 | 313 | </div> |
| 314 | 314 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |