@@ -264,7 +264,7 @@ discard block |
||
| 264 | 264 | print '<th class="arrival"><span class="nomobile">'._("Going to").'</span><span class="mobile">'._("To").'</span></th>'; |
| 265 | 265 | } |
| 266 | 266 | } |
| 267 | - if ($type == 'aircraft') { |
|
| 267 | + if ($type == 'aircraft') { |
|
| 268 | 268 | if ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalVAM) && $globalVAM) || (isset($globalphpVMS) && $globalphpVMS)) { |
| 269 | 269 | print '<th class="pilot"><span class="nomobile">'._("Pilot name").'</span><span class="mobile">'._("Pilot").'</span></a></th>'; |
| 270 | 270 | } else { |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | } elseif(strtolower($current_page) != "currently" && strtolower($current_page) != "upcoming" && strtolower($current_page) != "acars-latest" && strtolower($current_page) != "acars-archive" && strtolower($current_page) != "accident-latest" && strtolower($current_page) != "incident-latest" && strtolower($current_page) != "accident-detailed" && strtolower($current_page) != "incident-detailed"){ |
| 531 | 531 | if ($type == 'aircraft') { |
| 532 | 532 | if (!isset($spotter_item['squawk']) || $spotter_item['squawk'] == 0) { |
| 533 | - $spotter_item['squawk'] = '-'; |
|
| 533 | + $spotter_item['squawk'] = '-'; |
|
| 534 | 534 | } |
| 535 | 535 | if ($spotter_item['image_thumbnail'] != "") |
| 536 | 536 | { |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | print '</td>'."\n"; |
| 570 | 570 | } else { |
| 571 | 571 | print '<td class="aircraft_thumbnail">'."\n"; |
| 572 | - // print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>'; |
|
| 572 | + // print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" alt="Click to see more information about this flight" title="Click to see more information about this flight" width="100px" /></a>'; |
|
| 573 | 573 | //} |
| 574 | 574 | if (!isset($spotter_item['airline_name']) && !isset($spotter_item['aircraft_name'])) { |
| 575 | 575 | print '<a href="'.$globalURL.'/flightid/'.$spotter_item['spotter_id'].'"><img src="'.$globalURL.'/images/placeholder_thumb.png" class="img-rounded" data-toggle="popover" title="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" alt="'.$spotter_item['registration'].' - '.$spotter_item['aircraft_type'].' - '._("Not available").'" data-content="'._("Registration:").' '.$spotter_item['registration'].'<br />'._("Aircraft:").' '._("Not available").' ('.$spotter_item['aircraft_type'].')<br />'._("Airline:").' '._("Not available").'<br />'._("Squawk:").' '.$spotter_item['squawk'].'" data-html="true" width="100px" /></a>'."\n"; |
@@ -9,16 +9,16 @@ discard block |
||
| 9 | 9 | require_once(dirname(__FILE__).'/class.Source.php'); |
| 10 | 10 | |
| 11 | 11 | class TrackerImport { |
| 12 | - private $all_tracked = array(); |
|
| 13 | - private $last_delete_hourly = 0; |
|
| 14 | - private $last_delete = 0; |
|
| 15 | - private $stats = array(); |
|
| 16 | - private $tmd = 0; |
|
| 17 | - private $source_location = array(); |
|
| 18 | - public $db = null; |
|
| 19 | - public $nb = 0; |
|
| 12 | + private $all_tracked = array(); |
|
| 13 | + private $last_delete_hourly = 0; |
|
| 14 | + private $last_delete = 0; |
|
| 15 | + private $stats = array(); |
|
| 16 | + private $tmd = 0; |
|
| 17 | + private $source_location = array(); |
|
| 18 | + public $db = null; |
|
| 19 | + public $nb = 0; |
|
| 20 | 20 | |
| 21 | - public function __construct($dbc = null) { |
|
| 21 | + public function __construct($dbc = null) { |
|
| 22 | 22 | global $globalBeta; |
| 23 | 23 | $Connection = new Connection($dbc); |
| 24 | 24 | $this->db = $Connection->db(); |
@@ -40,50 +40,50 @@ discard block |
||
| 40 | 40 | } |
| 41 | 41 | } |
| 42 | 42 | */ |
| 43 | - } |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - public function checkAll() { |
|
| 45 | + public function checkAll() { |
|
| 46 | 46 | global $globalDebug; |
| 47 | 47 | if ($globalDebug) echo "Update last seen tracked data...\n"; |
| 48 | 48 | foreach ($this->all_tracked as $key => $flight) { |
| 49 | - if (isset($this->all_tracked[$key]['id'])) { |
|
| 49 | + if (isset($this->all_tracked[$key]['id'])) { |
|
| 50 | 50 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
| 51 | - $Tracker = new Tracker($this->db); |
|
| 52 | - $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
| 53 | - } |
|
| 51 | + $Tracker = new Tracker($this->db); |
|
| 52 | + $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime']); |
|
| 53 | + } |
|
| 54 | + } |
|
| 54 | 55 | } |
| 55 | - } |
|
| 56 | 56 | |
| 57 | - public function del() { |
|
| 57 | + public function del() { |
|
| 58 | 58 | global $globalDebug; |
| 59 | 59 | // Delete old infos |
| 60 | 60 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 61 | 61 | foreach ($this->all_tracked as $key => $flight) { |
| 62 | - if (isset($flight['lastupdate'])) { |
|
| 63 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
| 64 | - if (isset($this->all_tracked[$key]['id'])) { |
|
| 65 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 62 | + if (isset($flight['lastupdate'])) { |
|
| 63 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
| 64 | + if (isset($this->all_tracked[$key]['id'])) { |
|
| 65 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 66 | 66 | /* |
| 67 | 67 | $TrackerLive = new TrackerLive(); |
| 68 | 68 | $TrackerLive->deleteLiveTrackerDataById($this->all_tracked[$key]['id']); |
| 69 | 69 | $TrackerLive->db = null; |
| 70 | 70 | */ |
| 71 | - //$real_arrival = $this->arrival($key); |
|
| 72 | - $Tracker = new Tracker($this->db); |
|
| 73 | - if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
| 71 | + //$real_arrival = $this->arrival($key); |
|
| 72 | + $Tracker = new Tracker($this->db); |
|
| 73 | + if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
| 74 | 74 | $result = $Tracker->updateLatestTrackerData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['altitude'],$this->all_tracked[$key]['speed']); |
| 75 | 75 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 76 | 76 | } |
| 77 | 77 | // Put in archive |
| 78 | 78 | // $Tracker->db = null; |
| 79 | - } |
|
| 80 | - unset($this->all_tracked[$key]); |
|
| 81 | - } |
|
| 82 | - } |
|
| 83 | - } |
|
| 84 | - } |
|
| 79 | + } |
|
| 80 | + unset($this->all_tracked[$key]); |
|
| 81 | + } |
|
| 82 | + } |
|
| 83 | + } |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - public function add($line) { |
|
| 86 | + public function add($line) { |
|
| 87 | 87 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked; |
| 88 | 88 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
| 89 | 89 | date_default_timezone_set('UTC'); |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | // SBS format is CSV format |
| 94 | 94 | if(is_array($line) && isset($line['ident'])) { |
| 95 | - //print_r($line); |
|
| 96 | - if (isset($line['ident'])) { |
|
| 95 | + //print_r($line); |
|
| 96 | + if (isset($line['ident'])) { |
|
| 97 | 97 | |
| 98 | 98 | /* |
| 99 | 99 | // Increment message number |
@@ -109,29 +109,29 @@ discard block |
||
| 109 | 109 | */ |
| 110 | 110 | |
| 111 | 111 | $Common = new Common(); |
| 112 | - if (!isset($line['id'])) $id = trim($line['ident']); |
|
| 113 | - else $id = trim($line['id']); |
|
| 112 | + if (!isset($line['id'])) $id = trim($line['ident']); |
|
| 113 | + else $id = trim($line['id']); |
|
| 114 | 114 | |
| 115 | 115 | if (!isset($this->all_tracked[$id])) { |
| 116 | - $this->all_tracked[$id] = array(); |
|
| 117 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
| 118 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
|
| 119 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
| 120 | - if (!isset($line['id'])) { |
|
| 116 | + $this->all_tracked[$id] = array(); |
|
| 117 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedTracker' => 0)); |
|
| 118 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '', 'altitude' => '', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','noarchive' => false,'putinarchive' => true,'over_country' => '')); |
|
| 119 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
| 120 | + if (!isset($line['id'])) { |
|
| 121 | 121 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 122 | 122 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
| 123 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 124 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
| 123 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 124 | + if ($globalAllTracked !== FALSE) $dataFound = true; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
| 128 | - if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
|
| 128 | + if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) >= strtotime($this->all_tracked[$id]['datetime'])) { |
|
| 129 | 129 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
| 130 | - } else { |
|
| 130 | + } else { |
|
| 131 | 131 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
| 132 | 132 | 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"; |
| 133 | 133 | return ''; |
| 134 | - } |
|
| 134 | + } |
|
| 135 | 135 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
| 136 | 136 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."!!!"; |
| 137 | 137 | return ''; |
@@ -148,38 +148,38 @@ discard block |
||
| 148 | 148 | |
| 149 | 149 | //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'])) { |
| 150 | 150 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
| 151 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 152 | - if ($this->all_tracked[$id]['addedTracker'] == 1) { |
|
| 151 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 152 | + if ($this->all_tracked[$id]['addedTracker'] == 1) { |
|
| 153 | 153 | $timeelapsed = microtime(true); |
| 154 | - $Tracker = new Tracker($this->db); |
|
| 155 | - $fromsource = NULL; |
|
| 156 | - $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
| 154 | + $Tracker = new Tracker($this->db); |
|
| 155 | + $fromsource = NULL; |
|
| 156 | + $result = $Tracker->updateIdentTrackerData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$fromsource); |
|
| 157 | 157 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 158 | 158 | $Tracker->db = null; |
| 159 | 159 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 160 | - } |
|
| 161 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 160 | + } |
|
| 161 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | if (isset($line['speed']) && $line['speed'] != '') { |
| 165 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
| 166 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 165 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
| 166 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 167 | 167 | } 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'])) { |
| 168 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 169 | - if ($distance > 1000 && $distance < 10000) { |
|
| 168 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 169 | + if ($distance > 1000 && $distance < 10000) { |
|
| 170 | 170 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
| 171 | 171 | $speed = $speed*3.6; |
| 172 | 172 | if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
| 173 | 173 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['ident']." : ".$speed." - distance : ".$distance."\n"; |
| 174 | - } |
|
| 174 | + } |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 178 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 179 | - else unset($timediff); |
|
| 180 | - 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')))) { |
|
| 177 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 178 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 179 | + else unset($timediff); |
|
| 180 | + 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')))) { |
|
| 181 | 181 | 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'])) { |
| 182 | - 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'])) { |
|
| 182 | + 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'])) { |
|
| 183 | 183 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 184 | 184 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 185 | 185 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -193,120 +193,120 @@ discard block |
||
| 193 | 193 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 194 | 194 | $this->tmd = 0; |
| 195 | 195 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
| 196 | - } |
|
| 196 | + } |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 200 | 200 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 201 | 201 | 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') { |
| 202 | - $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
| 203 | - $dataFound = true; |
|
| 204 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 202 | + $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
| 203 | + $dataFound = true; |
|
| 204 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 205 | 205 | } |
| 206 | 206 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
| 207 | 207 | } |
| 208 | 208 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 209 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 209 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 210 | 210 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 211 | 211 | 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') { |
| 212 | - $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
| 213 | - $dataFound = true; |
|
| 214 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 212 | + $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
| 213 | + $dataFound = true; |
|
| 214 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 215 | 215 | } |
| 216 | 216 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - } else if ($globalDebug && $timediff > 20) { |
|
| 219 | + } else if ($globalDebug && $timediff > 20) { |
|
| 220 | 220 | $this->tmd = $this->tmd + 1; |
| 221 | 221 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
| 222 | 222 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
| 223 | 223 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
| 224 | 224 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
| 225 | - } |
|
| 225 | + } |
|
| 226 | 226 | } |
| 227 | 227 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 228 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 229 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 228 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 229 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 230 | 230 | } |
| 231 | 231 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 232 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 232 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 233 | 233 | } |
| 234 | 234 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 235 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 235 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 236 | 236 | } |
| 237 | 237 | if (isset($line['comment']) && $line['comment'] != '') { |
| 238 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
| 239 | - //$dataFound = true; |
|
| 238 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('comment' => $line['comment'])); |
|
| 239 | + //$dataFound = true; |
|
| 240 | 240 | } |
| 241 | 241 | if (isset($line['type']) && $line['type'] != '') { |
| 242 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 243 | - //$dataFound = true; |
|
| 242 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 243 | + //$dataFound = true; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | if (isset($line['altitude']) && $line['altitude'] != '') { |
| 247 | - //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
| 247 | + //if (!isset($this->all_tracked[$id]['altitude']) || $this->all_tracked[$id]['altitude'] == '' || ($this->all_tracked[$id]['altitude'] > 0 && $line['altitude'] != 0)) { |
|
| 248 | 248 | if (is_int($this->all_tracked[$id]['altitude']) && abs(round($line['altitude']/100)-$this->all_tracked[$id]['altitude']) > 3) $this->all_tracked[$id]['putinarchive'] = true; |
| 249 | 249 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude' => round($line['altitude']/100))); |
| 250 | 250 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('altitude_real' => $line['altitude'])); |
| 251 | 251 | //$dataFound = true; |
| 252 | - //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
| 252 | + //} elseif ($globalDebug) echo "!!! Strange altitude data... not added.\n"; |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 256 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 256 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | if (isset($line['heading']) && $line['heading'] != '') { |
| 260 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 261 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 263 | - //$dataFound = true; |
|
| 260 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 261 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 263 | + //$dataFound = true; |
|
| 264 | 264 | } 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']) { |
| 265 | - $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']); |
|
| 266 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
| 267 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 268 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 265 | + $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']); |
|
| 266 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
| 267 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 268 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 269 | 269 | } |
| 270 | 270 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
| 271 | 271 | |
| 272 | 272 | if ($dataFound === true && isset($this->all_tracked[$id]['ident'])) { |
| 273 | - $this->all_tracked[$id]['lastupdate'] = time(); |
|
| 274 | - if ($this->all_tracked[$id]['addedTracker'] == 0) { |
|
| 275 | - 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'])) { |
|
| 276 | - if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
| 273 | + $this->all_tracked[$id]['lastupdate'] = time(); |
|
| 274 | + if ($this->all_tracked[$id]['addedTracker'] == 0) { |
|
| 275 | + 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'])) { |
|
| 276 | + if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
| 277 | 277 | if ($globalDebug) echo "Check if aircraft is already in DB..."; |
| 278 | 278 | $timeelapsed = microtime(true); |
| 279 | 279 | $TrackerLive = new TrackerLive($this->db); |
| 280 | 280 | if (isset($line['id'])) { |
| 281 | - $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
|
| 282 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 281 | + $recent_ident = $TrackerLive->checkIdRecent($line['id']); |
|
| 282 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 283 | 283 | } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
| 284 | - $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
|
| 285 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 284 | + $recent_ident = $TrackerLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
|
| 285 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 286 | 286 | } else $recent_ident = ''; |
| 287 | 287 | $TrackerLive->db=null; |
| 288 | 288 | |
| 289 | 289 | if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
| 290 | 290 | elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
| 291 | - } else { |
|
| 291 | + } else { |
|
| 292 | 292 | $recent_ident = ''; |
| 293 | 293 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
| 294 | - } |
|
| 295 | - //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
| 296 | - if($recent_ident == "") |
|
| 297 | - { |
|
| 294 | + } |
|
| 295 | + //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
| 296 | + if($recent_ident == "") |
|
| 297 | + { |
|
| 298 | 298 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
| 299 | 299 | //adds the spotter data for the archive |
| 300 | - $highlight = ''; |
|
| 301 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
| 302 | - $timeelapsed = microtime(true); |
|
| 303 | - $Tracker = new Tracker($this->db); |
|
| 304 | - $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
| 305 | - $Tracker->db = null; |
|
| 306 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 307 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 300 | + $highlight = ''; |
|
| 301 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'].'-'.date('YmdHi'))); |
|
| 302 | + $timeelapsed = microtime(true); |
|
| 303 | + $Tracker = new Tracker($this->db); |
|
| 304 | + $result = $Tracker->addTrackerData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['altitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['comment'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name']); |
|
| 305 | + $Tracker->db = null; |
|
| 306 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 307 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 308 | 308 | |
| 309 | - /* |
|
| 309 | + /* |
|
| 310 | 310 | // Add source stat in DB |
| 311 | 311 | $Stats = new Stats($this->db); |
| 312 | 312 | if (!empty($this->stats)) { |
@@ -333,20 +333,20 @@ discard block |
||
| 333 | 333 | } |
| 334 | 334 | $Stats->db = null; |
| 335 | 335 | */ |
| 336 | - $this->del(); |
|
| 336 | + $this->del(); |
|
| 337 | 337 | //$ignoreImport = false; |
| 338 | 338 | $this->all_tracked[$id]['addedTracker'] = 1; |
| 339 | 339 | //print_r($this->all_tracked[$id]); |
| 340 | 340 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 341 | - if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
| 342 | - //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
| 343 | - $TrackerLive = new TrackerLive($this->db); |
|
| 344 | - $TrackerLive->deleteLiveTrackerData(); |
|
| 345 | - $TrackerLive->db=null; |
|
| 346 | - if ($globalDebug) echo " Done\n"; |
|
| 347 | - $this->last_delete = time(); |
|
| 341 | + if ($globalDebug) echo "---- Deleting Live Tracker data older than 9 hours..."; |
|
| 342 | + //TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
| 343 | + $TrackerLive = new TrackerLive($this->db); |
|
| 344 | + $TrackerLive->deleteLiveTrackerData(); |
|
| 345 | + $TrackerLive->db=null; |
|
| 346 | + if ($globalDebug) echo " Done\n"; |
|
| 347 | + $this->last_delete = time(); |
|
| 348 | 348 | } |
| 349 | - } else { |
|
| 349 | + } else { |
|
| 350 | 350 | $this->all_tracked[$id]['id'] = $recent_ident; |
| 351 | 351 | $this->all_tracked[$id]['addedTracker'] = 1; |
| 352 | 352 | if (isset($globalDaemon) && !$globalDaemon) { |
@@ -355,16 +355,16 @@ discard block |
||
| 355 | 355 | $Tracker->db = null; |
| 356 | 356 | } |
| 357 | 357 | |
| 358 | - } |
|
| 358 | + } |
|
| 359 | + } |
|
| 359 | 360 | } |
| 360 | - } |
|
| 361 | - //adds the spotter LIVE data |
|
| 362 | - if ($globalDebug) { |
|
| 361 | + //adds the spotter LIVE data |
|
| 362 | + if ($globalDebug) { |
|
| 363 | 363 | 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'].' - Altitude : '.$this->all_tracked[$id]['altitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n"; |
| 364 | - } |
|
| 365 | - $ignoreImport = false; |
|
| 364 | + } |
|
| 365 | + $ignoreImport = false; |
|
| 366 | 366 | |
| 367 | - if (!$ignoreImport) { |
|
| 367 | + if (!$ignoreImport) { |
|
| 368 | 368 | 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'])) { |
| 369 | 369 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
| 370 | 370 | $timeelapsed = microtime(true); |
@@ -436,22 +436,22 @@ discard block |
||
| 436 | 436 | |
| 437 | 437 | |
| 438 | 438 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 439 | - if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
| 440 | - $TrackerLive = new TrackerLive($this->db); |
|
| 441 | - $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
| 442 | - $TrackerLive->db = null; |
|
| 443 | - //TrackerLive->deleteLiveTrackerData(); |
|
| 444 | - if ($globalDebug) echo " Done\n"; |
|
| 445 | - $this->last_delete_hourly = time(); |
|
| 439 | + if ($globalDebug) echo "---- Deleting Live Tracker data Not updated since 2 hour..."; |
|
| 440 | + $TrackerLive = new TrackerLive($this->db); |
|
| 441 | + $TrackerLive->deleteLiveTrackerDataNotUpdated(); |
|
| 442 | + $TrackerLive->db = null; |
|
| 443 | + //TrackerLive->deleteLiveTrackerData(); |
|
| 444 | + if ($globalDebug) echo " Done\n"; |
|
| 445 | + $this->last_delete_hourly = time(); |
|
| 446 | 446 | } |
| 447 | 447 | |
| 448 | - } |
|
| 449 | - //$ignoreImport = false; |
|
| 448 | + } |
|
| 449 | + //$ignoreImport = false; |
|
| 450 | 450 | } |
| 451 | 451 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 452 | 452 | if ($send) return $this->all_tracked[$id]; |
| 453 | - } |
|
| 453 | + } |
|
| 454 | + } |
|
| 454 | 455 | } |
| 455 | - } |
|
| 456 | 456 | } |
| 457 | 457 | ?> |
@@ -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,55 +46,55 @@ 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; |
| 56 | 56 | if ($globalDebug) echo "Update last seen tracked data...\n"; |
| 57 | 57 | foreach ($this->all_tracked as $key => $flight) { |
| 58 | - if (isset($this->all_tracked[$key]['id'])) { |
|
| 58 | + if (isset($this->all_tracked[$key]['id'])) { |
|
| 59 | 59 | //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
| 60 | - $Marine = new Marine($this->db); |
|
| 61 | - $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']); |
|
| 62 | - } |
|
| 60 | + $Marine = new Marine($this->db); |
|
| 61 | + $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']); |
|
| 62 | + } |
|
| 63 | + } |
|
| 63 | 64 | } |
| 64 | - } |
|
| 65 | 65 | |
| 66 | - public function del() { |
|
| 66 | + public function del() { |
|
| 67 | 67 | global $globalDebug, $globalNoDB, $globalNoImport; |
| 68 | 68 | // Delete old infos |
| 69 | 69 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
| 70 | 70 | foreach ($this->all_tracked as $key => $flight) { |
| 71 | - if (isset($flight['lastupdate'])) { |
|
| 72 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
| 73 | - if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
| 74 | - if (isset($this->all_tracked[$key]['id'])) { |
|
| 75 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 76 | - /* |
|
| 71 | + if (isset($flight['lastupdate'])) { |
|
| 72 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
| 73 | + if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
| 74 | + if (isset($this->all_tracked[$key]['id'])) { |
|
| 75 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
| 76 | + /* |
|
| 77 | 77 | $MarineLive = new MarineLive(); |
| 78 | 78 | $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']); |
| 79 | 79 | $MarineLive->db = null; |
| 80 | 80 | */ |
| 81 | - //$real_arrival = $this->arrival($key); |
|
| 82 | - $Marine = new Marine($this->db); |
|
| 83 | - if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
| 81 | + //$real_arrival = $this->arrival($key); |
|
| 82 | + $Marine = new Marine($this->db); |
|
| 83 | + if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
| 84 | 84 | $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']); |
| 85 | 85 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 86 | - } |
|
| 87 | - // Put in archive |
|
| 86 | + } |
|
| 87 | + // Put in archive |
|
| 88 | 88 | // $Marine->db = null; |
| 89 | 89 | } |
| 90 | - } |
|
| 91 | - unset($this->all_tracked[$key]); |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - } |
|
| 95 | - } |
|
| 90 | + } |
|
| 91 | + unset($this->all_tracked[$key]); |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + } |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - public function add($line) { |
|
| 97 | + public function add($line) { |
|
| 98 | 98 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine; |
| 99 | 99 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
| 100 | 100 | date_default_timezone_set('UTC'); |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | // SBS format is CSV format |
| 105 | 105 | if(is_array($line) && isset($line['mmsi'])) { |
| 106 | - //print_r($line); |
|
| 107 | - if (isset($line['mmsi'])) { |
|
| 106 | + //print_r($line); |
|
| 107 | + if (isset($line['mmsi'])) { |
|
| 108 | 108 | |
| 109 | 109 | /* |
| 110 | 110 | // Increment message number |
@@ -121,64 +121,64 @@ discard block |
||
| 121 | 121 | |
| 122 | 122 | $Common = new Common(); |
| 123 | 123 | $AIS = new AIS(); |
| 124 | - if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
| 125 | - else $id = trim($line['id']); |
|
| 124 | + if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
| 125 | + else $id = trim($line['id']); |
|
| 126 | 126 | |
| 127 | 127 | if (!isset($this->all_tracked[$id])) { |
| 128 | - $this->all_tracked[$id] = array(); |
|
| 129 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
| 130 | - $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' => '')); |
|
| 131 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
| 132 | - if (!isset($line['id'])) { |
|
| 128 | + $this->all_tracked[$id] = array(); |
|
| 129 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
| 130 | + $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' => '')); |
|
| 131 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
| 132 | + if (!isset($line['id'])) { |
|
| 133 | 133 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
| 134 | 134 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
| 135 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 136 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
| 135 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
| 136 | + if ($globalAllTracked !== FALSE) $dataFound = true; |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
| 140 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
| 141 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 140 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
| 141 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 142 | 142 | $Marine = new Marine($this->db); |
| 143 | 143 | $identity = $Marine->getIdentity($line['mmsi']); |
| 144 | 144 | if (!empty($identity)) { |
| 145 | - $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
| 146 | - $this->all_tracked[$id]['type'] = $identity['type']; |
|
| 145 | + $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
| 146 | + $this->all_tracked[$id]['type'] = $identity['type']; |
|
| 147 | 147 | } |
| 148 | 148 | //print_r($identity); |
| 149 | 149 | unset($Marine); |
| 150 | 150 | //$dataFound = true; |
| 151 | - } |
|
| 151 | + } |
|
| 152 | 152 | } |
| 153 | 153 | if (isset($line['type_id'])) { |
| 154 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
| 154 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
| 155 | 155 | } |
| 156 | 156 | if (isset($line['type']) && $line['type'] != '') { |
| 157 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 157 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
| 158 | 158 | } |
| 159 | 159 | if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') { |
| 160 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
| 160 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
| 161 | 161 | } |
| 162 | 162 | if (isset($line['imo']) && $line['imo'] != '') { |
| 163 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
| 163 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
| 164 | 164 | } |
| 165 | 165 | if (isset($line['callsign']) && $line['callsign'] != '') { |
| 166 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
| 166 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
| 167 | 167 | } |
| 168 | 168 | if (isset($line['arrival_code']) && $line['arrival_code'] != '') { |
| 169 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
|
| 169 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
|
| 170 | 170 | } |
| 171 | 171 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
| 172 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 172 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
| 176 | 176 | //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'])) { |
| 177 | 177 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
| 178 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 179 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 178 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
| 179 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 180 | 180 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 181 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 181 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 182 | 182 | $timeelapsed = microtime(true); |
| 183 | 183 | $Marine = new Marine($this->db); |
| 184 | 184 | $fromsource = NULL; |
@@ -186,20 +186,20 @@ discard block |
||
| 186 | 186 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
| 187 | 187 | $Marine->db = null; |
| 188 | 188 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 189 | - } |
|
| 189 | + } |
|
| 190 | + } |
|
| 190 | 191 | } |
| 191 | - } |
|
| 192 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 192 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
| 193 | 193 | } |
| 194 | 194 | |
| 195 | 195 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-20*60 && strtotime($line['datetime']) < time()+20*60) { |
| 196 | - if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
| 196 | + if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
| 197 | 197 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
| 198 | - } else { |
|
| 198 | + } else { |
|
| 199 | 199 | 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"; |
| 200 | 200 | 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"; |
| 201 | 201 | return ''; |
| 202 | - } |
|
| 202 | + } |
|
| 203 | 203 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) < time()-20*60) { |
| 204 | 204 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!"; |
| 205 | 205 | return ''; |
@@ -216,24 +216,24 @@ discard block |
||
| 216 | 216 | |
| 217 | 217 | |
| 218 | 218 | if (isset($line['speed'])) { |
| 219 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
| 220 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 219 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed']))); |
|
| 220 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
| 221 | 221 | } 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'])) { |
| 222 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 223 | - if ($distance > 1000 && $distance < 10000) { |
|
| 222 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
| 223 | + if ($distance > 1000 && $distance < 10000) { |
|
| 224 | 224 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
| 225 | 225 | $speed = $speed*3.6; |
| 226 | 226 | if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed))); |
| 227 | 227 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
| 228 | - } |
|
| 228 | + } |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 232 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 233 | - else unset($timediff); |
|
| 234 | - 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')))) { |
|
| 231 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
| 232 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
| 233 | + else unset($timediff); |
|
| 234 | + 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')))) { |
|
| 235 | 235 | 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'])) { |
| 236 | - 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'])) { |
|
| 236 | + 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'])) { |
|
| 237 | 237 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 238 | 238 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 239 | 239 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -241,135 +241,135 @@ discard block |
||
| 241 | 241 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
| 242 | 242 | $timeelapsed = microtime(true); |
| 243 | 243 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 244 | - $Marine = new Marine($this->db); |
|
| 245 | - $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 246 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 247 | - $Marine->db = null; |
|
| 248 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 244 | + $Marine = new Marine($this->db); |
|
| 245 | + $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
| 246 | + if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
| 247 | + $Marine->db = null; |
|
| 248 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 249 | 249 | } |
| 250 | 250 | $this->tmd = 0; |
| 251 | 251 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
| 252 | - } |
|
| 252 | + } |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
| 256 | 256 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
| 257 | 257 | 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') { |
| 258 | - $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
| 259 | - $dataFound = true; |
|
| 260 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 258 | + $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
| 259 | + $dataFound = true; |
|
| 260 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 261 | 261 | } |
| 262 | 262 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
| 263 | 263 | } |
| 264 | 264 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
| 265 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 265 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
| 266 | 266 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
| 267 | 267 | 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') { |
| 268 | - $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
| 269 | - $dataFound = true; |
|
| 270 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 268 | + $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
| 269 | + $dataFound = true; |
|
| 270 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
| 271 | 271 | } |
| 272 | 272 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - } else if ($globalDebug && $timediff > 20) { |
|
| 275 | + } else if ($globalDebug && $timediff > 20) { |
|
| 276 | 276 | $this->tmd = $this->tmd + 1; |
| 277 | 277 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
| 278 | 278 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
| 279 | 279 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
| 280 | 280 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
| 281 | - } |
|
| 281 | + } |
|
| 282 | 282 | } |
| 283 | 283 | if (isset($line['last_update']) && $line['last_update'] != '') { |
| 284 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 285 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 284 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
| 285 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
| 286 | 286 | } |
| 287 | 287 | if (isset($line['format_source']) && $line['format_source'] != '') { |
| 288 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 288 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
| 289 | 289 | } |
| 290 | 290 | if (isset($line['source_name']) && $line['source_name'] != '') { |
| 291 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 291 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
| 292 | 292 | } |
| 293 | 293 | if (isset($line['status']) && $line['status'] != '') { |
| 294 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
| 294 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
| 295 | 295 | } |
| 296 | 296 | if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) { |
| 297 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
| 298 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 297 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
| 298 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
| 299 | 299 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 300 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 300 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 301 | 301 | $Marine = new Marine($this->db); |
| 302 | 302 | $Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']); |
| 303 | 303 | unset($Marine); |
| 304 | - } |
|
| 304 | + } |
|
| 305 | + } |
|
| 305 | 306 | } |
| 306 | - } |
|
| 307 | 307 | } |
| 308 | 308 | |
| 309 | 309 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
| 310 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 310 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | if (isset($line['heading']) && $line['heading'] != '') { |
| 314 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 315 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 316 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 317 | - //$dataFound = true; |
|
| 314 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 315 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
| 316 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
| 317 | + //$dataFound = true; |
|
| 318 | 318 | } 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']) { |
| 319 | - $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']); |
|
| 320 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
| 321 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 322 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 319 | + $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']); |
|
| 320 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
| 321 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
| 322 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
| 323 | 323 | } |
| 324 | 324 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
| 325 | 325 | |
| 326 | 326 | |
| 327 | 327 | |
| 328 | 328 | if ($dataFound === true && isset($this->all_tracked[$id]['mmsi'])) { |
| 329 | - $this->all_tracked[$id]['lastupdate'] = time(); |
|
| 330 | - if ($this->all_tracked[$id]['addedMarine'] == 0) { |
|
| 331 | - 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'])) { |
|
| 332 | - if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
| 329 | + $this->all_tracked[$id]['lastupdate'] = time(); |
|
| 330 | + if ($this->all_tracked[$id]['addedMarine'] == 0) { |
|
| 331 | + 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'])) { |
|
| 332 | + if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
| 333 | 333 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 334 | - if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
| 335 | - $timeelapsed = microtime(true); |
|
| 336 | - $MarineLive = new MarineLive($this->db); |
|
| 337 | - if (isset($line['id'])) { |
|
| 334 | + if ($globalDebug) echo "Check if aircraft is already in DB..."; |
|
| 335 | + $timeelapsed = microtime(true); |
|
| 336 | + $MarineLive = new MarineLive($this->db); |
|
| 337 | + if (isset($line['id'])) { |
|
| 338 | 338 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
| 339 | 339 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 340 | - } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
| 340 | + } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
| 341 | 341 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
| 342 | 342 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 343 | - } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
| 343 | + } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
| 344 | 344 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
| 345 | 345 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 346 | - } else $recent_ident = ''; |
|
| 347 | - $MarineLive->db=null; |
|
| 348 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 349 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 346 | + } else $recent_ident = ''; |
|
| 347 | + $MarineLive->db=null; |
|
| 348 | + if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
| 349 | + elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
| 350 | 350 | } else $recent_ident = ''; |
| 351 | - } else { |
|
| 351 | + } else { |
|
| 352 | 352 | $recent_ident = ''; |
| 353 | 353 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
| 354 | - } |
|
| 355 | - //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
| 356 | - if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
| 357 | - { |
|
| 354 | + } |
|
| 355 | + //if there was no aircraft with the same callsign within the last hour and go post it into the archive |
|
| 356 | + if($recent_ident == "" && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') |
|
| 357 | + { |
|
| 358 | 358 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
| 359 | 359 | //adds the spotter data for the archive |
| 360 | - $highlight = ''; |
|
| 361 | - 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'))); |
|
| 362 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 360 | + $highlight = ''; |
|
| 361 | + 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'))); |
|
| 362 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
| 363 | 363 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 364 | - $timeelapsed = microtime(true); |
|
| 365 | - $Marine = new Marine($this->db); |
|
| 366 | - $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']); |
|
| 367 | - $Marine->db = null; |
|
| 368 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 369 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 364 | + $timeelapsed = microtime(true); |
|
| 365 | + $Marine = new Marine($this->db); |
|
| 366 | + $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']); |
|
| 367 | + $Marine->db = null; |
|
| 368 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
| 369 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
| 370 | 370 | } |
| 371 | - } |
|
| 372 | - /* |
|
| 371 | + } |
|
| 372 | + /* |
|
| 373 | 373 | // Add source stat in DB |
| 374 | 374 | $Stats = new Stats($this->db); |
| 375 | 375 | if (!empty($this->stats)) { |
@@ -396,56 +396,56 @@ discard block |
||
| 396 | 396 | } |
| 397 | 397 | $Stats->db = null; |
| 398 | 398 | */ |
| 399 | - $this->del(); |
|
| 399 | + $this->del(); |
|
| 400 | 400 | //$ignoreImport = false; |
| 401 | 401 | $this->all_tracked[$id]['addedMarine'] = 1; |
| 402 | 402 | //print_r($this->all_tracked[$id]); |
| 403 | 403 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
| 404 | - if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
| 405 | - //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
| 406 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 404 | + if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
| 405 | + //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
| 406 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 407 | 407 | $MarineLive = new MarineLive($this->db); |
| 408 | 408 | $MarineLive->deleteLiveMarineData(); |
| 409 | 409 | $MarineLive->db=null; |
| 410 | 410 | if ($globalDebug) echo " Done\n"; |
| 411 | - } |
|
| 412 | - $this->last_delete = time(); |
|
| 411 | + } |
|
| 412 | + $this->last_delete = time(); |
|
| 413 | 413 | } |
| 414 | - } elseif ($recent_ident != '') { |
|
| 414 | + } elseif ($recent_ident != '') { |
|
| 415 | 415 | $this->all_tracked[$id]['id'] = $recent_ident; |
| 416 | 416 | $this->all_tracked[$id]['addedMarine'] = 1; |
| 417 | 417 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
| 418 | - if (isset($globalDaemon) && !$globalDaemon) { |
|
| 418 | + if (isset($globalDaemon) && !$globalDaemon) { |
|
| 419 | 419 | $Marine = new Marine($this->db); |
| 420 | 420 | $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']); |
| 421 | 421 | $Marine->db = null; |
| 422 | - } |
|
| 422 | + } |
|
| 423 | 423 | } |
| 424 | 424 | |
| 425 | - } |
|
| 425 | + } |
|
| 426 | + } |
|
| 426 | 427 | } |
| 427 | - } |
|
| 428 | - //adds the spotter LIVE data |
|
| 429 | - if ($globalDebug) { |
|
| 428 | + //adds the spotter LIVE data |
|
| 429 | + if ($globalDebug) { |
|
| 430 | 430 | 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"; |
| 431 | - } |
|
| 432 | - $ignoreImport = false; |
|
| 431 | + } |
|
| 432 | + $ignoreImport = false; |
|
| 433 | 433 | |
| 434 | - if (!$ignoreImport) { |
|
| 434 | + if (!$ignoreImport) { |
|
| 435 | 435 | 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'])) { |
| 436 | 436 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
| 437 | 437 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
| 438 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 438 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 439 | 439 | $timeelapsed = microtime(true); |
| 440 | 440 | $MarineLive = new MarineLive($this->db); |
| 441 | 441 | $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']); |
| 442 | 442 | $MarineLive->db = null; |
| 443 | 443 | if ($globalDebug) echo $result."\n"; |
| 444 | 444 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
| 445 | - } |
|
| 445 | + } |
|
| 446 | 446 | } |
| 447 | 447 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
| 448 | - $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']); |
|
| 448 | + $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']); |
|
| 449 | 449 | } |
| 450 | 450 | $this->all_tracked[$id]['putinarchive'] = false; |
| 451 | 451 | |
@@ -510,24 +510,24 @@ discard block |
||
| 510 | 510 | |
| 511 | 511 | |
| 512 | 512 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
| 513 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 513 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
| 514 | 514 | if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
| 515 | 515 | $MarineLive = new MarineLive($this->db); |
| 516 | 516 | $MarineLive->deleteLiveMarineDataNotUpdated(); |
| 517 | 517 | $MarineLive->db = null; |
| 518 | 518 | //MarineLive->deleteLiveMarineData(); |
| 519 | 519 | if ($globalDebug) echo " Done\n"; |
| 520 | - } |
|
| 521 | - $this->last_delete_hourly = time(); |
|
| 520 | + } |
|
| 521 | + $this->last_delete_hourly = time(); |
|
| 522 | 522 | } |
| 523 | 523 | |
| 524 | - } |
|
| 525 | - //$ignoreImport = false; |
|
| 524 | + } |
|
| 525 | + //$ignoreImport = false; |
|
| 526 | 526 | } |
| 527 | 527 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
| 528 | 528 | if ($send) return $this->all_tracked[$id]; |
| 529 | - } |
|
| 529 | + } |
|
| 530 | + } |
|
| 530 | 531 | } |
| 531 | - } |
|
| 532 | 532 | } |
| 533 | 533 | ?> |
@@ -11,10 +11,10 @@ discard block |
||
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - * Get SQL query part for filter used |
|
| 15 | - * @param Array $filter the filter |
|
| 16 | - * @return Array the SQL part |
|
| 17 | - */ |
|
| 14 | + * Get SQL query part for filter used |
|
| 15 | + * @param Array $filter the filter |
|
| 16 | + * @return Array the SQL part |
|
| 17 | + */ |
|
| 18 | 18 | |
| 19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
| 20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -78,14 +78,14 @@ discard block |
||
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | /** |
| 81 | - * Executes the SQL statements to get the spotter information |
|
| 82 | - * |
|
| 83 | - * @param String $query the SQL query |
|
| 84 | - * @param Array $params parameter of the query |
|
| 85 | - * @param String $limitQuery the limit query |
|
| 86 | - * @return Array the spotter information |
|
| 87 | - * |
|
| 88 | - */ |
|
| 81 | + * Executes the SQL statements to get the spotter information |
|
| 82 | + * |
|
| 83 | + * @param String $query the SQL query |
|
| 84 | + * @param Array $params parameter of the query |
|
| 85 | + * @param String $limitQuery the limit query |
|
| 86 | + * @return Array the spotter information |
|
| 87 | + * |
|
| 88 | + */ |
|
| 89 | 89 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
| 90 | 90 | { |
| 91 | 91 | date_default_timezone_set('UTC'); |
@@ -213,11 +213,11 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | |
| 215 | 215 | /** |
| 216 | - * Gets all the spotter information based on the latest data entry |
|
| 217 | - * |
|
| 218 | - * @return Array the spotter information |
|
| 219 | - * |
|
| 220 | - */ |
|
| 216 | + * Gets all the spotter information based on the latest data entry |
|
| 217 | + * |
|
| 218 | + * @return Array the spotter information |
|
| 219 | + * |
|
| 220 | + */ |
|
| 221 | 221 | public function getLatestMarineData($limit = '', $sort = '', $filter = array()) |
| 222 | 222 | { |
| 223 | 223 | global $global_query; |
@@ -266,11 +266,11 @@ discard block |
||
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | /** |
| 269 | - * Gets all the spotter information based on the callsign |
|
| 270 | - * |
|
| 271 | - * @return Array the spotter information |
|
| 272 | - * |
|
| 273 | - */ |
|
| 269 | + * Gets all the spotter information based on the callsign |
|
| 270 | + * |
|
| 271 | + * @return Array the spotter information |
|
| 272 | + * |
|
| 273 | + */ |
|
| 274 | 274 | public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
| 275 | 275 | { |
| 276 | 276 | global $global_query; |
@@ -381,12 +381,12 @@ discard block |
||
| 381 | 381 | |
| 382 | 382 | |
| 383 | 383 | /** |
| 384 | - * Gets all source name |
|
| 385 | - * |
|
| 386 | - * @param String type format of source |
|
| 387 | - * @return Array list of source name |
|
| 388 | - * |
|
| 389 | - */ |
|
| 384 | + * Gets all source name |
|
| 385 | + * |
|
| 386 | + * @param String type format of source |
|
| 387 | + * @return Array list of source name |
|
| 388 | + * |
|
| 389 | + */ |
|
| 390 | 390 | public function getAllSourceName($type = '',$filters = array()) |
| 391 | 391 | { |
| 392 | 392 | $filter_query = $this->getFilter($filters,true,true); |
@@ -416,11 +416,11 @@ discard block |
||
| 416 | 416 | |
| 417 | 417 | |
| 418 | 418 | /** |
| 419 | - * Gets a list of all idents/callsigns |
|
| 420 | - * |
|
| 421 | - * @return Array list of ident/callsign names |
|
| 422 | - * |
|
| 423 | - */ |
|
| 419 | + * Gets a list of all idents/callsigns |
|
| 420 | + * |
|
| 421 | + * @return Array list of ident/callsign names |
|
| 422 | + * |
|
| 423 | + */ |
|
| 424 | 424 | public function getAllIdents($filters = array()) |
| 425 | 425 | { |
| 426 | 426 | $filter_query = $this->getFilter($filters,true,true); |
@@ -444,11 +444,11 @@ discard block |
||
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | /** |
| 447 | - * Gets all info from a mmsi |
|
| 448 | - * |
|
| 449 | - * @return Array list of mmsi info |
|
| 450 | - * |
|
| 451 | - */ |
|
| 447 | + * Gets all info from a mmsi |
|
| 448 | + * |
|
| 449 | + * @return Array list of mmsi info |
|
| 450 | + * |
|
| 451 | + */ |
|
| 452 | 452 | public function getIdentity($mmsi) |
| 453 | 453 | { |
| 454 | 454 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -505,18 +505,18 @@ discard block |
||
| 505 | 505 | |
| 506 | 506 | |
| 507 | 507 | /** |
| 508 | - * Update ident tracker data |
|
| 509 | - * |
|
| 510 | - * @param String $fammarine_id the ID |
|
| 511 | - * @param String $ident the marine ident |
|
| 512 | - * @return String success or false |
|
| 513 | - * |
|
| 514 | - */ |
|
| 508 | + * Update ident tracker data |
|
| 509 | + * |
|
| 510 | + * @param String $fammarine_id the ID |
|
| 511 | + * @param String $ident the marine ident |
|
| 512 | + * @return String success or false |
|
| 513 | + * |
|
| 514 | + */ |
|
| 515 | 515 | public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
| 516 | 516 | { |
| 517 | 517 | |
| 518 | 518 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
| 519 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident); |
|
| 519 | + $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident); |
|
| 520 | 520 | |
| 521 | 521 | try { |
| 522 | 522 | $sth = $this->db->prepare($query); |
@@ -530,19 +530,19 @@ discard block |
||
| 530 | 530 | } |
| 531 | 531 | |
| 532 | 532 | /** |
| 533 | - * Update Status data |
|
| 534 | - * |
|
| 535 | - * @param String $fammarine_id the ID |
|
| 536 | - * @param String $status_id the marine status id |
|
| 537 | - * @param String $status the marine status |
|
| 538 | - * @return String success or false |
|
| 539 | - * |
|
| 540 | - */ |
|
| 533 | + * Update Status data |
|
| 534 | + * |
|
| 535 | + * @param String $fammarine_id the ID |
|
| 536 | + * @param String $status_id the marine status id |
|
| 537 | + * @param String $status the marine status |
|
| 538 | + * @return String success or false |
|
| 539 | + * |
|
| 540 | + */ |
|
| 541 | 541 | public function updateStatusMarineData($fammarine_id = '', $status_id = '',$status = '') |
| 542 | 542 | { |
| 543 | 543 | |
| 544 | 544 | $query = 'UPDATE marine_output SET status = :status, status_id = :status_id WHERE fammarine_id = :fammarine_id'; |
| 545 | - $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
| 545 | + $query_values = array(':fammarine_id' => $fammarine_id,':status' => $status,':status_id' => $status_id); |
|
| 546 | 546 | |
| 547 | 547 | try { |
| 548 | 548 | $sth = $this->db->prepare($query); |
@@ -555,17 +555,17 @@ discard block |
||
| 555 | 555 | |
| 556 | 556 | } |
| 557 | 557 | /** |
| 558 | - * Update latest marine data |
|
| 559 | - * |
|
| 560 | - * @param String $fammarine_id the ID |
|
| 561 | - * @param String $ident the marine ident |
|
| 562 | - * @return String success or false |
|
| 563 | - * |
|
| 564 | - */ |
|
| 558 | + * Update latest marine data |
|
| 559 | + * |
|
| 560 | + * @param String $fammarine_id the ID |
|
| 561 | + * @param String $ident the marine ident |
|
| 562 | + * @return String success or false |
|
| 563 | + * |
|
| 564 | + */ |
|
| 565 | 565 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '') |
| 566 | 566 | { |
| 567 | 567 | $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'; |
| 568 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 568 | + $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
| 569 | 569 | |
| 570 | 570 | try { |
| 571 | 571 | $sth = $this->db->prepare($query); |
@@ -579,30 +579,30 @@ discard block |
||
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | /** |
| 582 | - * Adds a new spotter data |
|
| 583 | - * |
|
| 584 | - * @param String $fammarine_id the ID |
|
| 585 | - * @param String $ident the marine ident |
|
| 586 | - * @param String $departure_airport_icao the departure airport |
|
| 587 | - * @param String $arrival_airport_icao the arrival airport |
|
| 588 | - * @param String $latitude latitude of flight |
|
| 589 | - * @param String $longitude latitude of flight |
|
| 590 | - * @param String $waypoints waypoints of flight |
|
| 591 | - * @param String $heading heading of flight |
|
| 592 | - * @param String $groundspeed speed of flight |
|
| 593 | - * @param String $date date of flight |
|
| 594 | - * @param String $departure_airport_time departure time of flight |
|
| 595 | - * @param String $arrival_airport_time arrival time of flight |
|
| 596 | - * @param String $squawk squawk code of flight |
|
| 597 | - * @param String $route_stop route stop of flight |
|
| 598 | - * @param String $highlight highlight or not |
|
| 599 | - * @param String $ModeS ModesS code of flight |
|
| 600 | - * @param String $registration registration code of flight |
|
| 601 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 602 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 603 | - * @param String $verticalrate vertival rate of flight |
|
| 604 | - * @return String success or false |
|
| 605 | - */ |
|
| 582 | + * Adds a new spotter data |
|
| 583 | + * |
|
| 584 | + * @param String $fammarine_id the ID |
|
| 585 | + * @param String $ident the marine ident |
|
| 586 | + * @param String $departure_airport_icao the departure airport |
|
| 587 | + * @param String $arrival_airport_icao the arrival airport |
|
| 588 | + * @param String $latitude latitude of flight |
|
| 589 | + * @param String $longitude latitude of flight |
|
| 590 | + * @param String $waypoints waypoints of flight |
|
| 591 | + * @param String $heading heading of flight |
|
| 592 | + * @param String $groundspeed speed of flight |
|
| 593 | + * @param String $date date of flight |
|
| 594 | + * @param String $departure_airport_time departure time of flight |
|
| 595 | + * @param String $arrival_airport_time arrival time of flight |
|
| 596 | + * @param String $squawk squawk code of flight |
|
| 597 | + * @param String $route_stop route stop of flight |
|
| 598 | + * @param String $highlight highlight or not |
|
| 599 | + * @param String $ModeS ModesS code of flight |
|
| 600 | + * @param String $registration registration code of flight |
|
| 601 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
| 602 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
| 603 | + * @param String $verticalrate vertival rate of flight |
|
| 604 | + * @return String success or false |
|
| 605 | + */ |
|
| 606 | 606 | 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 = '') |
| 607 | 607 | { |
| 608 | 608 | global $globalURL, $globalMarineImageFetch; |
@@ -699,13 +699,13 @@ discard block |
||
| 699 | 699 | unset($Image); |
| 700 | 700 | } |
| 701 | 701 | |
| 702 | - if ($latitude == '' && $longitude == '') { |
|
| 703 | - $latitude = 0; |
|
| 704 | - $longitude = 0; |
|
| 705 | - } |
|
| 706 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 707 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 708 | - if ($arrival_date == '') $arrival_date = NULL; |
|
| 702 | + if ($latitude == '' && $longitude == '') { |
|
| 703 | + $latitude = 0; |
|
| 704 | + $longitude = 0; |
|
| 705 | + } |
|
| 706 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
| 707 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
| 708 | + if ($arrival_date == '') $arrival_date = NULL; |
|
| 709 | 709 | $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) |
| 710 | 710 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)"; |
| 711 | 711 | |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | $sth->execute($query_values); |
| 717 | 717 | $this->db = null; |
| 718 | 718 | } catch (PDOException $e) { |
| 719 | - return "error : ".$e->getMessage(); |
|
| 719 | + return "error : ".$e->getMessage(); |
|
| 720 | 720 | } |
| 721 | 721 | |
| 722 | 722 | return "success"; |
@@ -725,11 +725,11 @@ discard block |
||
| 725 | 725 | |
| 726 | 726 | |
| 727 | 727 | /** |
| 728 | - * Gets the aircraft ident within the last hour |
|
| 729 | - * |
|
| 730 | - * @return String the ident |
|
| 731 | - * |
|
| 732 | - */ |
|
| 728 | + * Gets the aircraft ident within the last hour |
|
| 729 | + * |
|
| 730 | + * @return String the ident |
|
| 731 | + * |
|
| 732 | + */ |
|
| 733 | 733 | public function getIdentFromLastHour($ident) |
| 734 | 734 | { |
| 735 | 735 | global $globalDBdriver, $globalTimezone; |
@@ -745,11 +745,11 @@ discard block |
||
| 745 | 745 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
| 746 | 746 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
| 747 | 747 | $query_data = array(':ident' => $ident); |
| 748 | - } |
|
| 748 | + } |
|
| 749 | 749 | |
| 750 | 750 | $sth = $this->db->prepare($query); |
| 751 | 751 | $sth->execute($query_data); |
| 752 | - $ident_result=''; |
|
| 752 | + $ident_result=''; |
|
| 753 | 753 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
| 754 | 754 | { |
| 755 | 755 | $ident_result = $row['ident']; |
@@ -760,11 +760,11 @@ discard block |
||
| 760 | 760 | |
| 761 | 761 | |
| 762 | 762 | /** |
| 763 | - * Gets the aircraft data from the last 20 seconds |
|
| 764 | - * |
|
| 765 | - * @return Array the spotter data |
|
| 766 | - * |
|
| 767 | - */ |
|
| 763 | + * Gets the aircraft data from the last 20 seconds |
|
| 764 | + * |
|
| 765 | + * @return Array the spotter data |
|
| 766 | + * |
|
| 767 | + */ |
|
| 768 | 768 | public function getRealTimeData($q = '') |
| 769 | 769 | { |
| 770 | 770 | global $globalDBdriver; |
@@ -802,11 +802,11 @@ discard block |
||
| 802 | 802 | |
| 803 | 803 | |
| 804 | 804 | /** |
| 805 | - * Gets all number of flight over countries |
|
| 806 | - * |
|
| 807 | - * @return Array the airline country list |
|
| 808 | - * |
|
| 809 | - */ |
|
| 805 | + * Gets all number of flight over countries |
|
| 806 | + * |
|
| 807 | + * @return Array the airline country list |
|
| 808 | + * |
|
| 809 | + */ |
|
| 810 | 810 | /* |
| 811 | 811 | public function countAllTrackedOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
| 812 | 812 | { |
@@ -857,11 +857,11 @@ discard block |
||
| 857 | 857 | |
| 858 | 858 | |
| 859 | 859 | /** |
| 860 | - * Gets all callsigns that have flown over |
|
| 861 | - * |
|
| 862 | - * @return Array the callsign list |
|
| 863 | - * |
|
| 864 | - */ |
|
| 860 | + * Gets all callsigns that have flown over |
|
| 861 | + * |
|
| 862 | + * @return Array the callsign list |
|
| 863 | + * |
|
| 864 | + */ |
|
| 865 | 865 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
| 866 | 866 | { |
| 867 | 867 | global $globalDBdriver; |
@@ -928,11 +928,11 @@ discard block |
||
| 928 | 928 | |
| 929 | 929 | |
| 930 | 930 | /** |
| 931 | - * Counts all dates |
|
| 932 | - * |
|
| 933 | - * @return Array the date list |
|
| 934 | - * |
|
| 935 | - */ |
|
| 931 | + * Counts all dates |
|
| 932 | + * |
|
| 933 | + * @return Array the date list |
|
| 934 | + * |
|
| 935 | + */ |
|
| 936 | 936 | public function countAllDates($filters = array()) |
| 937 | 937 | { |
| 938 | 938 | global $globalTimezone, $globalDBdriver; |
@@ -978,11 +978,11 @@ discard block |
||
| 978 | 978 | |
| 979 | 979 | |
| 980 | 980 | /** |
| 981 | - * Counts all dates during the last 7 days |
|
| 982 | - * |
|
| 983 | - * @return Array the date list |
|
| 984 | - * |
|
| 985 | - */ |
|
| 981 | + * Counts all dates during the last 7 days |
|
| 982 | + * |
|
| 983 | + * @return Array the date list |
|
| 984 | + * |
|
| 985 | + */ |
|
| 986 | 986 | public function countAllDatesLast7Days($filters = array()) |
| 987 | 987 | { |
| 988 | 988 | global $globalTimezone, $globalDBdriver; |
@@ -1004,7 +1004,7 @@ discard block |
||
| 1004 | 1004 | $query .= " GROUP BY date_name |
| 1005 | 1005 | ORDER BY date_name ASC"; |
| 1006 | 1006 | $query_data = array(':offset' => $offset); |
| 1007 | - } |
|
| 1007 | + } |
|
| 1008 | 1008 | |
| 1009 | 1009 | $sth = $this->db->prepare($query); |
| 1010 | 1010 | $sth->execute($query_data); |
@@ -1024,11 +1024,11 @@ discard block |
||
| 1024 | 1024 | } |
| 1025 | 1025 | |
| 1026 | 1026 | /** |
| 1027 | - * Counts all dates during the last month |
|
| 1028 | - * |
|
| 1029 | - * @return Array the date list |
|
| 1030 | - * |
|
| 1031 | - */ |
|
| 1027 | + * Counts all dates during the last month |
|
| 1028 | + * |
|
| 1029 | + * @return Array the date list |
|
| 1030 | + * |
|
| 1031 | + */ |
|
| 1032 | 1032 | public function countAllDatesLastMonth($filters = array()) |
| 1033 | 1033 | { |
| 1034 | 1034 | global $globalTimezone, $globalDBdriver; |
@@ -1050,7 +1050,7 @@ discard block |
||
| 1050 | 1050 | $query .= " GROUP BY date_name |
| 1051 | 1051 | ORDER BY date_name ASC"; |
| 1052 | 1052 | $query_data = array(':offset' => $offset); |
| 1053 | - } |
|
| 1053 | + } |
|
| 1054 | 1054 | |
| 1055 | 1055 | $sth = $this->db->prepare($query); |
| 1056 | 1056 | $sth->execute($query_data); |
@@ -1072,11 +1072,11 @@ discard block |
||
| 1072 | 1072 | |
| 1073 | 1073 | |
| 1074 | 1074 | /** |
| 1075 | - * Counts all month |
|
| 1076 | - * |
|
| 1077 | - * @return Array the month list |
|
| 1078 | - * |
|
| 1079 | - */ |
|
| 1075 | + * Counts all month |
|
| 1076 | + * |
|
| 1077 | + * @return Array the month list |
|
| 1078 | + * |
|
| 1079 | + */ |
|
| 1080 | 1080 | public function countAllMonths($filters = array()) |
| 1081 | 1081 | { |
| 1082 | 1082 | global $globalTimezone, $globalDBdriver; |
@@ -1121,11 +1121,11 @@ discard block |
||
| 1121 | 1121 | |
| 1122 | 1122 | |
| 1123 | 1123 | /** |
| 1124 | - * Counts all dates during the last year |
|
| 1125 | - * |
|
| 1126 | - * @return Array the date list |
|
| 1127 | - * |
|
| 1128 | - */ |
|
| 1124 | + * Counts all dates during the last year |
|
| 1125 | + * |
|
| 1126 | + * @return Array the date list |
|
| 1127 | + * |
|
| 1128 | + */ |
|
| 1129 | 1129 | public function countAllMonthsLastYear($filters) |
| 1130 | 1130 | { |
| 1131 | 1131 | global $globalTimezone, $globalDBdriver; |
@@ -1147,7 +1147,7 @@ discard block |
||
| 1147 | 1147 | $query .= " GROUP BY year_name, month_name |
| 1148 | 1148 | ORDER BY year_name, month_name ASC"; |
| 1149 | 1149 | $query_data = array(':offset' => $offset); |
| 1150 | - } |
|
| 1150 | + } |
|
| 1151 | 1151 | |
| 1152 | 1152 | $sth = $this->db->prepare($query); |
| 1153 | 1153 | $sth->execute($query_data); |
@@ -1170,11 +1170,11 @@ discard block |
||
| 1170 | 1170 | |
| 1171 | 1171 | |
| 1172 | 1172 | /** |
| 1173 | - * Counts all hours |
|
| 1174 | - * |
|
| 1175 | - * @return Array the hour list |
|
| 1176 | - * |
|
| 1177 | - */ |
|
| 1173 | + * Counts all hours |
|
| 1174 | + * |
|
| 1175 | + * @return Array the hour list |
|
| 1176 | + * |
|
| 1177 | + */ |
|
| 1178 | 1178 | public function countAllHours($orderby,$filters = array()) |
| 1179 | 1179 | { |
| 1180 | 1180 | global $globalTimezone, $globalDBdriver; |
@@ -1237,11 +1237,11 @@ discard block |
||
| 1237 | 1237 | |
| 1238 | 1238 | |
| 1239 | 1239 | /** |
| 1240 | - * Counts all hours by date |
|
| 1241 | - * |
|
| 1242 | - * @return Array the hour list |
|
| 1243 | - * |
|
| 1244 | - */ |
|
| 1240 | + * Counts all hours by date |
|
| 1241 | + * |
|
| 1242 | + * @return Array the hour list |
|
| 1243 | + * |
|
| 1244 | + */ |
|
| 1245 | 1245 | public function countAllHoursByDate($date, $filters = array()) |
| 1246 | 1246 | { |
| 1247 | 1247 | global $globalTimezone, $globalDBdriver; |
@@ -1285,11 +1285,11 @@ discard block |
||
| 1285 | 1285 | |
| 1286 | 1286 | |
| 1287 | 1287 | /** |
| 1288 | - * Counts all hours by a ident/callsign |
|
| 1289 | - * |
|
| 1290 | - * @return Array the hour list |
|
| 1291 | - * |
|
| 1292 | - */ |
|
| 1288 | + * Counts all hours by a ident/callsign |
|
| 1289 | + * |
|
| 1290 | + * @return Array the hour list |
|
| 1291 | + * |
|
| 1292 | + */ |
|
| 1293 | 1293 | public function countAllHoursByIdent($ident, $filters = array()) |
| 1294 | 1294 | { |
| 1295 | 1295 | global $globalTimezone, $globalDBdriver; |
@@ -1334,11 +1334,11 @@ discard block |
||
| 1334 | 1334 | |
| 1335 | 1335 | |
| 1336 | 1336 | /** |
| 1337 | - * Counts all flights that have flown over |
|
| 1338 | - * |
|
| 1339 | - * @return Integer the number of flights |
|
| 1340 | - * |
|
| 1341 | - */ |
|
| 1337 | + * Counts all flights that have flown over |
|
| 1338 | + * |
|
| 1339 | + * @return Integer the number of flights |
|
| 1340 | + * |
|
| 1341 | + */ |
|
| 1342 | 1342 | public function countOverallTracked($filters = array(),$year = '',$month = '') |
| 1343 | 1343 | { |
| 1344 | 1344 | global $globalDBdriver; |
@@ -1373,11 +1373,11 @@ discard block |
||
| 1373 | 1373 | |
| 1374 | 1374 | |
| 1375 | 1375 | /** |
| 1376 | - * Counts all hours of today |
|
| 1377 | - * |
|
| 1378 | - * @return Array the hour list |
|
| 1379 | - * |
|
| 1380 | - */ |
|
| 1376 | + * Counts all hours of today |
|
| 1377 | + * |
|
| 1378 | + * @return Array the hour list |
|
| 1379 | + * |
|
| 1380 | + */ |
|
| 1381 | 1381 | public function countAllHoursFromToday($filters = array()) |
| 1382 | 1382 | { |
| 1383 | 1383 | global $globalTimezone, $globalDBdriver; |
@@ -1417,12 +1417,12 @@ discard block |
||
| 1417 | 1417 | } |
| 1418 | 1418 | |
| 1419 | 1419 | |
| 1420 | - /** |
|
| 1421 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1422 | - * |
|
| 1423 | - * @return Integer the Barrie Spotter ID |
|
| 1420 | + /** |
|
| 1421 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
| 1422 | + * |
|
| 1423 | + * @return Integer the Barrie Spotter ID |
|
| 1424 | 1424 | q * |
| 1425 | - */ |
|
| 1425 | + */ |
|
| 1426 | 1426 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
| 1427 | 1427 | { |
| 1428 | 1428 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -1443,13 +1443,13 @@ discard block |
||
| 1443 | 1443 | |
| 1444 | 1444 | |
| 1445 | 1445 | /** |
| 1446 | - * Parses a date string |
|
| 1447 | - * |
|
| 1448 | - * @param String $dateString the date string |
|
| 1449 | - * @param String $timezone the timezone of a user |
|
| 1450 | - * @return Array the time information |
|
| 1451 | - * |
|
| 1452 | - */ |
|
| 1446 | + * Parses a date string |
|
| 1447 | + * |
|
| 1448 | + * @param String $dateString the date string |
|
| 1449 | + * @param String $timezone the timezone of a user |
|
| 1450 | + * @return Array the time information |
|
| 1451 | + * |
|
| 1452 | + */ |
|
| 1453 | 1453 | public function parseDateString($dateString, $timezone = '') |
| 1454 | 1454 | { |
| 1455 | 1455 | $time_array = array(); |
@@ -1482,12 +1482,12 @@ discard block |
||
| 1482 | 1482 | } |
| 1483 | 1483 | |
| 1484 | 1484 | /** |
| 1485 | - * Parses the direction degrees to working |
|
| 1486 | - * |
|
| 1487 | - * @param Float $direction the direction in degrees |
|
| 1488 | - * @return Array the direction information |
|
| 1489 | - * |
|
| 1490 | - */ |
|
| 1485 | + * Parses the direction degrees to working |
|
| 1486 | + * |
|
| 1487 | + * @param Float $direction the direction in degrees |
|
| 1488 | + * @return Array the direction information |
|
| 1489 | + * |
|
| 1490 | + */ |
|
| 1491 | 1491 | public function parseDirection($direction = 0) |
| 1492 | 1492 | { |
| 1493 | 1493 | if ($direction == '') $direction = 0; |
@@ -1566,12 +1566,12 @@ discard block |
||
| 1566 | 1566 | |
| 1567 | 1567 | |
| 1568 | 1568 | /** |
| 1569 | - * Gets Country from latitude/longitude |
|
| 1570 | - * |
|
| 1571 | - * @param Float $latitude latitute of the flight |
|
| 1572 | - * @param Float $longitude longitute of the flight |
|
| 1573 | - * @return String the countrie |
|
| 1574 | - */ |
|
| 1569 | + * Gets Country from latitude/longitude |
|
| 1570 | + * |
|
| 1571 | + * @param Float $latitude latitute of the flight |
|
| 1572 | + * @param Float $longitude longitute of the flight |
|
| 1573 | + * @return String the countrie |
|
| 1574 | + */ |
|
| 1575 | 1575 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
| 1576 | 1576 | { |
| 1577 | 1577 | global $globalDBdriver, $globalDebug; |
@@ -1608,11 +1608,11 @@ discard block |
||
| 1608 | 1608 | } |
| 1609 | 1609 | |
| 1610 | 1610 | /** |
| 1611 | - * Gets Country from iso2 |
|
| 1612 | - * |
|
| 1613 | - * @param String $iso2 ISO2 country code |
|
| 1614 | - * @return String the countrie |
|
| 1615 | - */ |
|
| 1611 | + * Gets Country from iso2 |
|
| 1612 | + * |
|
| 1613 | + * @param String $iso2 ISO2 country code |
|
| 1614 | + * @return String the countrie |
|
| 1615 | + */ |
|
| 1616 | 1616 | public function getCountryFromISO2($iso2) |
| 1617 | 1617 | { |
| 1618 | 1618 | global $globalDBdriver, $globalDebug; |
@@ -1641,12 +1641,12 @@ discard block |
||
| 1641 | 1641 | |
| 1642 | 1642 | |
| 1643 | 1643 | /** |
| 1644 | - * Gets the short url from bit.ly |
|
| 1645 | - * |
|
| 1646 | - * @param String $url the full url |
|
| 1647 | - * @return String the bit.ly url |
|
| 1648 | - * |
|
| 1649 | - */ |
|
| 1644 | + * Gets the short url from bit.ly |
|
| 1645 | + * |
|
| 1646 | + * @param String $url the full url |
|
| 1647 | + * @return String the bit.ly url |
|
| 1648 | + * |
|
| 1649 | + */ |
|
| 1650 | 1650 | public function getBitlyURL($url) |
| 1651 | 1651 | { |
| 1652 | 1652 | global $globalBitlyAccessToken; |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | // When button "Remove all filters" is clicked |
| 29 | 29 | if (isset($_POST['removefilters'])) { |
| 30 | 30 | $allfilters = array_filter(array_keys($_COOKIE),function($key) { |
| 31 | - return strpos($key,'filter_') === 0; |
|
| 31 | + return strpos($key,'filter_') === 0; |
|
| 32 | 32 | }); |
| 33 | 33 | foreach ($allfilters as $filt) { |
| 34 | 34 | unset($_COOKIE[$filt]); |
@@ -168,17 +168,17 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | ?> |
| 170 | 170 | <?php |
| 171 | - if (isset($_POST['archive'])) { |
|
| 171 | + if (isset($_POST['archive'])) { |
|
| 172 | 172 | ?> |
| 173 | 173 | <script src="<?php print $globalURL; ?>/js/map.common.js"></script> |
| 174 | 174 | <?php |
| 175 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 175 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 176 | 176 | ?> |
| 177 | 177 | |
| 178 | 178 | <script src="<?php print $globalURL; ?>/js/map.js.php?<?php print time(); ?>&archive&begindate=<?php print strtotime($_POST['start_date']); ?>&enddate=<?php print strtotime($_POST['end_date']); ?>&archivespeed=<?php print $_POST['archivespeed']; ?>"></script> |
| 179 | 179 | <?php |
| 180 | - } |
|
| 181 | - } else { |
|
| 180 | + } |
|
| 181 | + } else { |
|
| 182 | 182 | ?> |
| 183 | 183 | <?php |
| 184 | 184 | /* if (isset($globalBeta) && $globalBeta) { |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | */ |
| 191 | 191 | ?> |
| 192 | 192 | <?php |
| 193 | - if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 193 | + if ((!isset($_COOKIE['MapFormat']) && (!isset($globalMap3Ddefault) || !$globalMap3Ddefault)) || (isset($_COOKIE['MapFormat']) && $_COOKIE['MapFormat'] != '3d')) { |
|
| 194 | 194 | ?> |
| 195 | 195 | <?php |
| 196 | 196 | // if (isset($globalBeta) && $globalBeta) { |
@@ -217,13 +217,13 @@ discard block |
||
| 217 | 217 | <script src="<?php print $globalURL; ?>/js/map-marine.2d.js.php?<?php print time(); ?>"></script> |
| 218 | 218 | <?php |
| 219 | 219 | } |
| 220 | - } |
|
| 220 | + } |
|
| 221 | 221 | ?> |
| 222 | 222 | <?php |
| 223 | 223 | // } |
| 224 | 224 | ?> |
| 225 | 225 | <?php |
| 226 | - } |
|
| 226 | + } |
|
| 227 | 227 | } |
| 228 | 228 | ?> |
| 229 | 229 | <?php |
@@ -376,24 +376,24 @@ discard block |
||
| 376 | 376 | <ul class="nav navbar-nav"> |
| 377 | 377 | |
| 378 | 378 | <?php |
| 379 | - $sub = false; |
|
| 380 | - if (((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE)) || (isset($globalTracker) && $globalTracker === TRUE)) || (isset($globalMarine) && $globalMarine === TRUE && isset($globalTracker) && $globalTracker === TRUE)) { |
|
| 379 | + $sub = false; |
|
| 380 | + if (((!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE)) || (isset($globalTracker) && $globalTracker === TRUE)) || (isset($globalMarine) && $globalMarine === TRUE && isset($globalTracker) && $globalTracker === TRUE)) { |
|
| 381 | 381 | $sub = true; |
| 382 | - } |
|
| 382 | + } |
|
| 383 | 383 | ?> |
| 384 | 384 | <?php |
| 385 | - if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
| 385 | + if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
| 386 | 386 | ?> |
| 387 | 387 | <li class="dropdown"> |
| 388 | 388 | <?php |
| 389 | - if ($sub) { |
|
| 389 | + if ($sub) { |
|
| 390 | 390 | ?> |
| 391 | 391 | <li class="dropdown"> |
| 392 | 392 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Aircrafts"); ?> <b class="caret"></b></a> |
| 393 | 393 | <ul class="dropdown-menu multi-level"> |
| 394 | 394 | <li class="dropdown-submenu"> |
| 395 | 395 | <?php |
| 396 | - } |
|
| 396 | + } |
|
| 397 | 397 | ?> |
| 398 | 398 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Explore"); ?> <b class="<?php if ($sub) echo 'right-'; ?>caret"></b></a> |
| 399 | 399 | <ul class="dropdown-menu"> |
@@ -401,15 +401,15 @@ discard block |
||
| 401 | 401 | <li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li> |
| 402 | 402 | <li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li> |
| 403 | 403 | <?php |
| 404 | - if ((!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 404 | + if ((!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM)) { |
|
| 405 | 405 | ?> |
| 406 | 406 | <li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li> |
| 407 | 407 | <?php |
| 408 | - } else { |
|
| 408 | + } else { |
|
| 409 | 409 | ?> |
| 410 | 410 | <li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li> |
| 411 | 411 | <?php |
| 412 | - } |
|
| 412 | + } |
|
| 413 | 413 | ?> |
| 414 | 414 | <li><hr /></li> |
| 415 | 415 | <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li> |
@@ -417,34 +417,34 @@ discard block |
||
| 417 | 417 | <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li> |
| 418 | 418 | <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li> |
| 419 | 419 | <?php |
| 420 | - if ($globalACARS) { |
|
| 421 | - if (isset($globalDemo) && $globalDemo) { |
|
| 422 | - ?> |
|
| 420 | + if ($globalACARS) { |
|
| 421 | + if (isset($globalDemo) && $globalDemo) { |
|
| 422 | + ?> |
|
| 423 | 423 | <li><hr /></li> |
| 424 | 424 | <li><i><?php echo _('ACARS data not available publicly'); ?></i></li> |
| 425 | 425 | <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li> |
| 426 | 426 | <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li> |
| 427 | 427 | <?php |
| 428 | - } else { |
|
| 429 | - ?> |
|
| 428 | + } else { |
|
| 429 | + ?> |
|
| 430 | 430 | <li><hr /></li> |
| 431 | 431 | <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li> |
| 432 | 432 | <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li> |
| 433 | 433 | <?php |
| 434 | - } |
|
| 435 | - } |
|
| 436 | - ?> |
|
| 434 | + } |
|
| 435 | + } |
|
| 436 | + ?> |
|
| 437 | 437 | <?php |
| 438 | - if (isset($globalAccidents) && $globalAccidents) { |
|
| 439 | - ?> |
|
| 438 | + if (isset($globalAccidents) && $globalAccidents) { |
|
| 439 | + ?> |
|
| 440 | 440 | <li><hr /></li> |
| 441 | 441 | <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li> |
| 442 | 442 | <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li> |
| 443 | 443 | <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li> |
| 444 | 444 | <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li> |
| 445 | 445 | <?php |
| 446 | - } |
|
| 447 | - ?> |
|
| 446 | + } |
|
| 447 | + ?> |
|
| 448 | 448 | <li><hr /></li> |
| 449 | 449 | <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li> |
| 450 | 450 | <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li> |
@@ -467,14 +467,14 @@ discard block |
||
| 467 | 467 | </ul> |
| 468 | 468 | <?php |
| 469 | 469 | } |
| 470 | - } |
|
| 470 | + } |
|
| 471 | 471 | ?> |
| 472 | 472 | <?php |
| 473 | - if (isset($globalMarine) && $globalMarine) { |
|
| 473 | + if (isset($globalMarine) && $globalMarine) { |
|
| 474 | 474 | ?> |
| 475 | 475 | <li class="dropdown"> |
| 476 | 476 | <?php |
| 477 | - if ($sub) { |
|
| 477 | + if ($sub) { |
|
| 478 | 478 | ?> |
| 479 | 479 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Vessels"); ?> <b class="caret"></b></a> |
| 480 | 480 | <ul class="dropdown-menu multi-level"> |
@@ -498,14 +498,14 @@ discard block |
||
| 498 | 498 | } |
| 499 | 499 | ?> |
| 500 | 500 | <?php |
| 501 | - } |
|
| 501 | + } |
|
| 502 | 502 | ?> |
| 503 | 503 | <?php |
| 504 | - if (isset($globalTracker) && $globalTracker) { |
|
| 504 | + if (isset($globalTracker) && $globalTracker) { |
|
| 505 | 505 | ?> |
| 506 | 506 | <li class="dropdown"> |
| 507 | 507 | <?php |
| 508 | - if ($sub) { |
|
| 508 | + if ($sub) { |
|
| 509 | 509 | ?> |
| 510 | 510 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Trackers"); ?> <b class="caret"></b></a> |
| 511 | 511 | <ul class="dropdown-menu multi-level"> |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | } |
| 530 | 530 | ?> |
| 531 | 531 | <?php |
| 532 | - } |
|
| 532 | + } |
|
| 533 | 533 | ?> |
| 534 | 534 | |
| 535 | 535 | <li class="dropdown"> |
@@ -558,14 +558,14 @@ discard block |
||
| 558 | 558 | <form> |
| 559 | 559 | <select class="selectpicker" data-width="120px" onchange="language(this);"> |
| 560 | 560 | <?php |
| 561 | - $Language = new Language(); |
|
| 562 | - $alllang = $Language->getLanguages(); |
|
| 563 | - foreach ($alllang as $key => $lang) { |
|
| 564 | - print '<option value="'.$key.'"'; |
|
| 565 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
| 566 | - print '>'.$lang[0].'</option>'; |
|
| 567 | - } |
|
| 568 | - ?> |
|
| 561 | + $Language = new Language(); |
|
| 562 | + $alllang = $Language->getLanguages(); |
|
| 563 | + foreach ($alllang as $key => $lang) { |
|
| 564 | + print '<option value="'.$key.'"'; |
|
| 565 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
| 566 | + print '>'.$lang[0].'</option>'; |
|
| 567 | + } |
|
| 568 | + ?> |
|
| 569 | 569 | </select> |
| 570 | 570 | </form> |
| 571 | 571 | </div> |
@@ -596,18 +596,18 @@ discard block |
||
| 596 | 596 | ?> |
| 597 | 597 | <div class="top-header clear" role="main"> |
| 598 | 598 | <?php |
| 599 | - if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
| 599 | + if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
| 600 | 600 | ?> |
| 601 | 601 | <div id="archive-map"></div> |
| 602 | 602 | <?php |
| 603 | - } |
|
| 603 | + } |
|
| 604 | 604 | ?> |
| 605 | 605 | </div> |
| 606 | 606 | <?php |
| 607 | 607 | } |
| 608 | 608 | if ((strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) || (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false)) |
| 609 | 609 | { |
| 610 | - ?> |
|
| 610 | + ?> |
|
| 611 | 611 | <div class="top-header clear" role="main"> |
| 612 | 612 | <div id="map"></div> |
| 613 | 613 | <link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" /> |
@@ -618,15 +618,15 @@ discard block |
||
| 618 | 618 | var zoom = 13; |
| 619 | 619 | //create the map |
| 620 | 620 | <?php |
| 621 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
| 621 | + if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
| 622 | 622 | ?> |
| 623 | 623 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
| 624 | 624 | <?php |
| 625 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
| 625 | + } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
| 626 | 626 | ?> |
| 627 | 627 | map = L.map('map', { zoomControl:true }); |
| 628 | 628 | <?php |
| 629 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 629 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 630 | 630 | ?> |
| 631 | 631 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
| 632 | 632 | var line = L.polyline([[<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>],[<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>]]).addTo(map); |
@@ -634,22 +634,22 @@ discard block |
||
| 634 | 634 | var departure_airport = L.marker([<?php print $spotter_array[0]['departure_airport_latitude']; ?>, <?php print $spotter_array[0]['departure_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/departure_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
| 635 | 635 | var arrival_airport = L.marker([<?php print $spotter_array[0]['arrival_airport_latitude']; ?>, <?php print $spotter_array[0]['arrival_airport_longitude']; ?>], {icon: L.icon({iconUrl: '<?php print $globalURL; ?>/images/arrival_airport.png',iconSize: [16,18],iconAnchor: [8,16]})}).addTo(map); |
| 636 | 636 | <?php |
| 637 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 637 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude'])) { |
|
| 638 | 638 | ?> |
| 639 | 639 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
| 640 | 640 | <?php |
| 641 | - } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
| 641 | + } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
| 642 | 642 | ?> |
| 643 | 643 | map = L.map('map', { zoomControl:true }); |
| 644 | 644 | <?php |
| 645 | - } |
|
| 645 | + } |
|
| 646 | 646 | ?> |
| 647 | 647 | //initialize the layer group for the aircrft markers |
| 648 | 648 | var layer_data = L.layerGroup(); |
| 649 | 649 | |
| 650 | 650 | //a few title layers |
| 651 | 651 | <?php |
| 652 | - if ($globalMapProvider == 'Mapbox') { |
|
| 652 | + if ($globalMapProvider == 'Mapbox') { |
|
| 653 | 653 | ?> |
| 654 | 654 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
| 655 | 655 | maxZoom: 18, |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | token : '<?php print $globalMapboxToken; ?>' |
| 661 | 661 | }).addTo(map); |
| 662 | 662 | <?php |
| 663 | - } elseif ($globalMapProvider == 'OpenStreetMap') { |
|
| 663 | + } elseif ($globalMapProvider == 'OpenStreetMap') { |
|
| 664 | 664 | ?> |
| 665 | 665 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
| 666 | 666 | maxZoom: 18, |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | '<a href="http://www.openstreetmap.org/copyright">Open Database Licence</a>' |
| 669 | 669 | }).addTo(map); |
| 670 | 670 | <?php |
| 671 | - } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
| 671 | + } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
| 672 | 672 | ?> |
| 673 | 673 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', { |
| 674 | 674 | maxZoom: 18, |
@@ -677,7 +677,7 @@ discard block |
||
| 677 | 677 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>' |
| 678 | 678 | }).addTo(map); |
| 679 | 679 | <?php |
| 680 | - } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
| 680 | + } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
| 681 | 681 | ?> |
| 682 | 682 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', { |
| 683 | 683 | maxZoom: 18, |
@@ -686,27 +686,27 @@ discard block |
||
| 686 | 686 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency"' |
| 687 | 687 | }).addTo(map); |
| 688 | 688 | <?php |
| 689 | - } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
| 689 | + } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
| 690 | 690 | ?> |
| 691 | 691 | var googleLayer = new L.Google('ROADMAP'); |
| 692 | 692 | map.addLayer(googleLayer); |
| 693 | 693 | <?php |
| 694 | - } elseif ($globalMapProvider == 'Google-Satellite') { |
|
| 694 | + } elseif ($globalMapProvider == 'Google-Satellite') { |
|
| 695 | 695 | ?> |
| 696 | 696 | var googleLayer = new L.Google('SATELLITE'); |
| 697 | 697 | map.addLayer(googleLayer); |
| 698 | 698 | <?php |
| 699 | - } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
| 699 | + } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
| 700 | 700 | ?> |
| 701 | 701 | var googleLayer = new L.Google('HYBRID'); |
| 702 | 702 | map.addLayer(googleLayer); |
| 703 | 703 | <?php |
| 704 | - } elseif ($globalMapProvider == 'Google-Terrain') { |
|
| 704 | + } elseif ($globalMapProvider == 'Google-Terrain') { |
|
| 705 | 705 | ?> |
| 706 | 706 | var googleLayer = new L.Google('Terrain'); |
| 707 | 707 | map.addLayer(googleLayer); |
| 708 | 708 | <?php |
| 709 | - } |
|
| 709 | + } |
|
| 710 | 710 | ?> |
| 711 | 711 | </script> |
| 712 | 712 | </div> |