@@ -16,25 +16,25 @@ discard block |
||
16 | 16 | require_once(dirname(__FILE__).'/class.Stats.php'); |
17 | 17 | require_once(dirname(__FILE__).'/class.Source.php'); |
18 | 18 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
19 | - require_once(dirname(__FILE__).'/class.APRS.php'); |
|
19 | + require_once(dirname(__FILE__).'/class.APRS.php'); |
|
20 | 20 | } |
21 | 21 | |
22 | 22 | class MarineImport { |
23 | - private $all_tracked = array(); |
|
24 | - private $last_delete_hourly = 0; |
|
25 | - private $last_delete = 0; |
|
26 | - private $stats = array(); |
|
27 | - private $tmd = 0; |
|
28 | - private $source_location = array(); |
|
29 | - public $db = null; |
|
30 | - public $nb = 0; |
|
23 | + private $all_tracked = array(); |
|
24 | + private $last_delete_hourly = 0; |
|
25 | + private $last_delete = 0; |
|
26 | + private $stats = array(); |
|
27 | + private $tmd = 0; |
|
28 | + private $source_location = array(); |
|
29 | + public $db = null; |
|
30 | + public $nb = 0; |
|
31 | 31 | |
32 | - public function __construct($dbc = null) { |
|
32 | + public function __construct($dbc = null) { |
|
33 | 33 | global $globalBeta, $globalServerAPRS, $APRSMarine, $globalNoDB; |
34 | 34 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
35 | - $Connection = new Connection($dbc); |
|
36 | - $this->db = $Connection->db(); |
|
37 | - date_default_timezone_set('UTC'); |
|
35 | + $Connection = new Connection($dbc); |
|
36 | + $this->db = $Connection->db(); |
|
37 | + date_default_timezone_set('UTC'); |
|
38 | 38 | } |
39 | 39 | // Get previous source stats |
40 | 40 | /* |
@@ -53,79 +53,79 @@ discard block |
||
53 | 53 | } |
54 | 54 | */ |
55 | 55 | if (isset($globalServerAPRS) && $globalServerAPRS) { |
56 | - $APRSMarine = new APRSMarine(); |
|
57 | - //$APRSSpotter->connect(); |
|
56 | + $APRSMarine = new APRSMarine(); |
|
57 | + //$APRSSpotter->connect(); |
|
58 | + } |
|
58 | 59 | } |
59 | - } |
|
60 | 60 | |
61 | - public function checkAll() { |
|
61 | + public function checkAll() { |
|
62 | 62 | global $globalDebug, $globalNoDB, $globalVM; |
63 | 63 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
64 | - if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
65 | - foreach ($this->all_tracked as $key => $flight) { |
|
64 | + if ($globalDebug) echo "Update last seen tracked data...\n"; |
|
65 | + foreach ($this->all_tracked as $key => $flight) { |
|
66 | 66 | if (isset($this->all_tracked[$key]['id'])) { |
67 | - //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
|
68 | - $Marine = new Marine($this->db); |
|
69 | - if (isset($globalVM) && $globalVM) { |
|
67 | + //echo $this->all_tracked[$key]['id'].' - '.$this->all_tracked[$key]['latitude'].' '.$this->all_tracked[$key]['longitude']."\n"; |
|
68 | + $Marine = new Marine($this->db); |
|
69 | + if (isset($globalVM) && $globalVM) { |
|
70 | 70 | if ($this->all_tracked[$key]['status'] == 'Racing') { |
71 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
72 | - } else { |
|
73 | - $timerace = (strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']); |
|
74 | - if ($timerace > time()) $finaldatetime = NULL; |
|
75 | - else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
76 | - $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
77 | - } |
|
78 | - } else { |
|
71 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
72 | + } else { |
|
73 | + $timerace = (strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']); |
|
74 | + if ($timerace > time()) $finaldatetime = NULL; |
|
75 | + else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
|
76 | + $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
|
77 | + } |
|
78 | + } else { |
|
79 | 79 | $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
80 | - } |
|
80 | + } |
|
81 | + } |
|
81 | 82 | } |
82 | - } |
|
83 | 83 | } |
84 | - } |
|
84 | + } |
|
85 | 85 | |
86 | - public function del() { |
|
86 | + public function del() { |
|
87 | 87 | global $globalDebug, $globalNoDB, $globalNoImport; |
88 | 88 | // Delete old infos |
89 | 89 | if ($globalDebug) echo 'Delete old values and update latest data...'."\n"; |
90 | 90 | foreach ($this->all_tracked as $key => $flight) { |
91 | - if (isset($flight['lastupdate'])) { |
|
92 | - if ($flight['lastupdate'] < (time()-3000)) { |
|
93 | - if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
94 | - if (isset($this->all_tracked[$key]['id'])) { |
|
95 | - if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
96 | - /* |
|
91 | + if (isset($flight['lastupdate'])) { |
|
92 | + if ($flight['lastupdate'] < (time()-3000)) { |
|
93 | + if ((!isset($globalNoImport) || $globalNoImport !== TRUE) && (!isset($globalNoDB) || $globalNoDB !== TRUE)) { |
|
94 | + if (isset($this->all_tracked[$key]['id'])) { |
|
95 | + if ($globalDebug) echo "--- Delete old values with id ".$this->all_tracked[$key]['id']."\n"; |
|
96 | + /* |
|
97 | 97 | $MarineLive = new MarineLive(); |
98 | 98 | $MarineLive->deleteLiveMarineDataById($this->all_tracked[$key]['id']); |
99 | 99 | $MarineLive->db = null; |
100 | 100 | */ |
101 | - //$real_arrival = $this->arrival($key); |
|
102 | - $Marine = new Marine($this->db); |
|
103 | - if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
101 | + //$real_arrival = $this->arrival($key); |
|
102 | + $Marine = new Marine($this->db); |
|
103 | + if ($this->all_tracked[$key]['latitude'] != '' && $this->all_tracked[$key]['longitude'] != '') { |
|
104 | 104 | if (isset($globalVM) && $globalVM) { |
105 | - if ($this->all_tracked[$key]['status'] == 'Racing') { |
|
105 | + if ($this->all_tracked[$key]['status'] == 'Racing') { |
|
106 | 106 | $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
107 | - } else { |
|
107 | + } else { |
|
108 | 108 | $timerace = strtotime($this->all_tracked[$key]['race_begin'])+$this->all_tracked[$key]['race_time']; |
109 | - if ($timerace > time()) $finaldatetime = NULL; |
|
109 | + if ($timerace > time()) $finaldatetime = NULL; |
|
110 | 110 | else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
111 | 111 | $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$finaldatetime,$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
112 | - } |
|
112 | + } |
|
113 | 113 | } else { |
114 | 114 | $result = $Marine->updateLatestMarineData($this->all_tracked[$key]['id'],$this->all_tracked[$key]['ident'],$this->all_tracked[$key]['latitude'],$this->all_tracked[$key]['longitude'],$this->all_tracked[$key]['speed'],$this->all_tracked[$key]['datetime'],$this->all_tracked[$key]['distance'],$this->all_tracked[$key]['race_rank'],$this->all_tracked[$key]['race_time'],$this->all_tracked[$key]['status'],$this->all_tracked[$key]['race_begin']); |
115 | 115 | } |
116 | 116 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
117 | - } |
|
118 | - // Put in archive |
|
117 | + } |
|
118 | + // Put in archive |
|
119 | 119 | // $Marine->db = null; |
120 | 120 | } |
121 | - } |
|
122 | - unset($this->all_tracked[$key]); |
|
123 | - } |
|
124 | - } |
|
125 | - } |
|
126 | - } |
|
121 | + } |
|
122 | + unset($this->all_tracked[$key]); |
|
123 | + } |
|
124 | + } |
|
125 | + } |
|
126 | + } |
|
127 | 127 | |
128 | - public function add($line) { |
|
128 | + public function add($line) { |
|
129 | 129 | global $globalFork, $globalDistanceIgnore, $globalDaemon, $globalDebug, $globalCoordMinChange, $globalDebugTimeElapsed, $globalCenterLatitude, $globalCenterLongitude, $globalBeta, $globalSourcesupdate, $globalAllTracked, $globalNoImport, $globalNoDB, $globalServerAPRS,$APRSMarine, $globalLiveInterval, $globalVM; |
130 | 130 | if (!isset($globalCoordMinChange) || $globalCoordMinChange == '') $globalCoordMinChange = '0.02'; |
131 | 131 | date_default_timezone_set('UTC'); |
@@ -134,106 +134,106 @@ discard block |
||
134 | 134 | |
135 | 135 | // SBS format is CSV format |
136 | 136 | if(is_array($line) && (isset($line['mmsi']) || isset($line['id']))) { |
137 | - //print_r($line); |
|
138 | - if (isset($line['mmsi']) || isset($line['id'])) { |
|
137 | + //print_r($line); |
|
138 | + if (isset($line['mmsi']) || isset($line['id'])) { |
|
139 | 139 | |
140 | 140 | |
141 | 141 | // Increment message number |
142 | 142 | if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE) { |
143 | - $current_date = date('Y-m-d'); |
|
144 | - if (isset($line['source_name'])) $source = $line['source_name']; |
|
145 | - else $source = ''; |
|
146 | - if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
147 | - if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
148 | - $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
149 | - $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
150 | - } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
143 | + $current_date = date('Y-m-d'); |
|
144 | + if (isset($line['source_name'])) $source = $line['source_name']; |
|
145 | + else $source = ''; |
|
146 | + if ($source == '' || $line['format_source'] == 'aprs') $source = $line['format_source']; |
|
147 | + if (!isset($this->stats[$current_date][$source]['msg'])) { |
|
148 | + $this->stats[$current_date][$source]['msg']['date'] = time(); |
|
149 | + $this->stats[$current_date][$source]['msg']['nb'] = 1; |
|
150 | + } else $this->stats[$current_date][$source]['msg']['nb'] += 1; |
|
151 | 151 | } |
152 | 152 | |
153 | 153 | |
154 | 154 | $Common = new Common(); |
155 | 155 | $AIS = new AIS(); |
156 | - if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
157 | - else $id = trim($line['id']); |
|
156 | + if (!isset($line['id'])) $id = trim($line['mmsi']); |
|
157 | + else $id = trim($line['id']); |
|
158 | 158 | |
159 | 159 | if (!isset($this->all_tracked[$id])) { |
160 | - $this->all_tracked[$id] = array(); |
|
161 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
162 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '','captain_id' => '','captain_name' => '','race_id' => '','race_name' => '','distance' => NULL,'race_rank' => NULL,'race_time' => NULL,'race_begin' => '')); |
|
163 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
164 | - if (!isset($line['id'])) { |
|
160 | + $this->all_tracked[$id] = array(); |
|
161 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('addedMarine' => 0)); |
|
162 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => '','latitude' => '', 'longitude' => '', 'speed' => '0', 'heading' => '', 'format_source' => '','source_name' => '','comment'=> '','type' => '','typeid' => '','noarchive' => false,'putinarchive' => true,'over_country' => '','mmsi' => '','status' => '','status_id' => '','imo' => '','callsign' => '','arrival_code' => '','arrival_date' => '','mmsi_type' => '','captain_id' => '','captain_name' => '','race_id' => '','race_name' => '','distance' => NULL,'race_rank' => NULL,'race_time' => NULL,'race_begin' => '')); |
|
163 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('lastupdate' => time())); |
|
164 | + if (!isset($line['id'])) { |
|
165 | 165 | if (!isset($globalDaemon)) $globalDaemon = TRUE; |
166 | 166 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $id.'-'.date('YmdHi'))); |
167 | - } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
168 | - if ($globalAllTracked !== FALSE) $dataFound = true; |
|
167 | + } else $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $line['id'])); |
|
168 | + if ($globalAllTracked !== FALSE) $dataFound = true; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | if (isset($line['mmsi']) && $line['mmsi'] != '' && $line['mmsi'] != $this->all_tracked[$id]['mmsi']) { |
172 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
173 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
172 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi' => $line['mmsi'])); |
|
173 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
174 | 174 | $Marine = new Marine($this->db); |
175 | 175 | $identity = $Marine->getIdentity($line['mmsi']); |
176 | 176 | if (!empty($identity)) { |
177 | - $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
178 | - $this->all_tracked[$id]['type'] = $identity['type']; |
|
179 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type']))); |
|
177 | + $this->all_tracked[$id]['ident'] = $identity['ship_name']; |
|
178 | + $this->all_tracked[$id]['type'] = $identity['type']; |
|
179 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($identity['type']))); |
|
180 | 180 | } |
181 | 181 | //print_r($identity); |
182 | 182 | unset($Marine); |
183 | 183 | //$dataFound = true; |
184 | - } |
|
184 | + } |
|
185 | 185 | } |
186 | 186 | if (isset($line['type_id'])) { |
187 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
188 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id'])); |
|
187 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $AIS->getShipType($line['type_id']))); |
|
188 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $line['type_id'])); |
|
189 | 189 | } |
190 | 190 | if (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] == '') { |
191 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
192 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type']))); |
|
191 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
192 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('typeid' => $AIS->getShipTypeID($line['type']))); |
|
193 | 193 | } elseif (isset($line['type']) && $line['type'] != '' && $this->all_tracked[$id]['type'] != '') { |
194 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
194 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('type' => $line['type'])); |
|
195 | 195 | } |
196 | 196 | if (isset($line['status']) && $line['status'] != '') { |
197 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
197 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status' => $line['status'])); |
|
198 | 198 | } |
199 | 199 | if (isset($line['status_id']) && (!isset($this->all_tracked[$id]['status_id']) || $this->all_tracked[$id]['status_id'] != $line['status_id'])) { |
200 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
201 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
200 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('status_id' => $line['status_id'])); |
|
201 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
202 | 202 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
203 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
203 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
204 | 204 | $Marine = new Marine($this->db); |
205 | 205 | $Marine->updateStatusMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['status']); |
206 | 206 | unset($Marine); |
207 | - } |
|
207 | + } |
|
208 | + } |
|
208 | 209 | } |
209 | - } |
|
210 | 210 | } |
211 | 211 | |
212 | 212 | |
213 | 213 | if (isset($line['mmsi_type']) && $line['mmsi_type'] != '') { |
214 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
214 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('mmsi_type' => $line['mmsi_type'])); |
|
215 | 215 | } |
216 | 216 | if (isset($line['imo']) && $line['imo'] != '') { |
217 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
217 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('imo' => $line['imo'])); |
|
218 | 218 | } |
219 | 219 | if (isset($line['callsign']) && $line['callsign'] != '') { |
220 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
220 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('callsign' => $line['callsign'])); |
|
221 | 221 | } |
222 | 222 | if (isset($line['arrival_code']) && $line['arrival_code'] != '') { |
223 | - if (!isset($this->all_tracked[$id]['arrival_code'])) { |
|
223 | + if (!isset($this->all_tracked[$id]['arrival_code'])) { |
|
224 | 224 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_code' => $line['arrival_code'])); |
225 | 225 | if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
226 | 226 | if ($this->all_tracked[$id]['addedMarine'] != 0) { |
227 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
227 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
228 | 228 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
229 | - $Marine = new Marine($this->db); |
|
230 | - $fromsource = NULL; |
|
231 | - $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource); |
|
232 | - $Marine->db = null; |
|
229 | + $Marine = new Marine($this->db); |
|
230 | + $fromsource = NULL; |
|
231 | + $Marine->updateArrivalPortNameMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['arrival_code'],$fromsource); |
|
232 | + $Marine->db = null; |
|
233 | + } |
|
233 | 234 | } |
234 | - } |
|
235 | 235 | } |
236 | - } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) { |
|
236 | + } elseif ($this->all_tracked[$id]['arrival_code'] != $line['arrival_code']) { |
|
237 | 237 | $this->all_tracked[$id]['arrival_code'] = $line['arrival_code']; |
238 | 238 | if ($globalDebug) echo $this->all_tracked[$id]['id'].' => New arrival: '.$line['arrival_code']."\n"; |
239 | 239 | if (!isset($line['id'])) { |
@@ -241,50 +241,50 @@ discard block |
||
241 | 241 | $this->all_tracked[$id]['forcenew'] = 1; |
242 | 242 | $this->all_tracked[$id]['addedMarine'] = 0; |
243 | 243 | } |
244 | - } |
|
244 | + } |
|
245 | 245 | } |
246 | 246 | if (isset($line['arrival_date']) && $line['arrival_date'] != '') { |
247 | - if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
247 | + if (strtotime($line['arrival_date']) > time()) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('arrival_date' => $line['arrival_date'])); |
|
248 | 248 | } |
249 | 249 | if (isset($line['captain_id']) && $line['captain_id'] != '') { |
250 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_id' => $line['captain_id'])); |
|
250 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_id' => $line['captain_id'])); |
|
251 | 251 | } |
252 | 252 | if (isset($line['captain_name']) && $line['captain_name'] != '') { |
253 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_name' => $line['captain_name'])); |
|
253 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('captain_name' => $line['captain_name'])); |
|
254 | 254 | } |
255 | 255 | if (isset($line['race_id']) && $line['race_id'] != '') { |
256 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_id' => $line['race_id'])); |
|
256 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_id' => $line['race_id'])); |
|
257 | 257 | } |
258 | 258 | if (isset($line['race_name']) && $line['race_name'] != '') { |
259 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_name' => $line['race_name'])); |
|
259 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_name' => $line['race_name'])); |
|
260 | 260 | } |
261 | 261 | if (isset($line['race_rank']) && $line['race_rank'] != '') { |
262 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_rank' => $line['race_rank'])); |
|
262 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_rank' => $line['race_rank'])); |
|
263 | 263 | } |
264 | 264 | if (isset($line['race_time']) && $line['race_time'] != '') { |
265 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_time' => $line['race_time'])); |
|
265 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_time' => $line['race_time'])); |
|
266 | 266 | } |
267 | 267 | if (isset($line['race_begin']) && $line['race_begin'] != '') { |
268 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_begin' => $line['race_begin'])); |
|
268 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('race_begin' => $line['race_begin'])); |
|
269 | 269 | } |
270 | 270 | if (isset($line['distance']) && $line['distance'] != '') { |
271 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('distance' => $line['distance'])); |
|
271 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('distance' => $line['distance'])); |
|
272 | 272 | } |
273 | 273 | |
274 | 274 | //if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident'])) && preg_match('/^[a-zA-Z0-9-]+$/', $line['ident'])) { |
275 | 275 | if (isset($line['ident']) && $line['ident'] != '' && $line['ident'] != '????????' && $line['ident'] != '00000000' && ($this->all_tracked[$id]['ident'] != trim($line['ident']))) { |
276 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
276 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
277 | 277 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
278 | - $timeelapsed = microtime(true); |
|
279 | - $Marine = new Marine($this->db); |
|
280 | - $Marine->addIdentity($this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['type']); |
|
281 | - $Marine->db = null; |
|
278 | + $timeelapsed = microtime(true); |
|
279 | + $Marine = new Marine($this->db); |
|
280 | + $Marine->addIdentity($this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['type']); |
|
281 | + $Marine->db = null; |
|
282 | + } |
|
282 | 283 | } |
283 | - } |
|
284 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
285 | - if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
284 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('ident' => trim($line['ident']))); |
|
285 | + if ($this->all_tracked[$id]['addedMarine'] == 1) { |
|
286 | 286 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
287 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
287 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
288 | 288 | $timeelapsed = microtime(true); |
289 | 289 | $Marine = new Marine($this->db); |
290 | 290 | $fromsource = NULL; |
@@ -292,20 +292,20 @@ discard block |
||
292 | 292 | if ($globalDebug && $result != 'success') echo '!!! ERROR : '.$result."\n"; |
293 | 293 | $Marine->db = null; |
294 | 294 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update identspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
295 | - } |
|
295 | + } |
|
296 | + } |
|
296 | 297 | } |
297 | - } |
|
298 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
298 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['ident'])); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | if (isset($line['datetime']) && strtotime($line['datetime']) > time()-30*60 && strtotime($line['datetime']) < time()+20*60) { |
302 | - if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
302 | + if (!isset($this->all_tracked[$id]['datetime']) || strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime'])) { |
|
303 | 303 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('datetime' => $line['datetime'])); |
304 | - } else { |
|
304 | + } else { |
|
305 | 305 | if (strtotime($line['datetime']) == strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date is the same as previous data for ".$this->all_tracked[$id]['mmsi']."\n"; |
306 | 306 | elseif (strtotime($line['datetime']) > strtotime($this->all_tracked[$id]['datetime']) && $globalDebug) echo "!!! Date previous latest data (".$line['datetime']." > ".$this->all_tracked[$id]['datetime'].") !!! for ".$this->all_tracked[$id]['hex']." - format : ".$line['format_source']."\n"; |
307 | 307 | return ''; |
308 | - } |
|
308 | + } |
|
309 | 309 | } elseif (isset($line['datetime']) && strtotime($line['datetime']) <= time()-30*60) { |
310 | 310 | if ($globalDebug) echo "!!! Date is too old ".$this->all_tracked[$id]['mmsi']." - format : ".$line['format_source']."!!!\n"; |
311 | 311 | return ''; |
@@ -322,33 +322,33 @@ discard block |
||
322 | 322 | |
323 | 323 | |
324 | 324 | if (isset($line['speed'])) { |
325 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'],2))); |
|
326 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
325 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($line['speed'],2))); |
|
326 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed_fromsrc' => true)); |
|
327 | 327 | } else if (!isset($this->all_tracked[$id]['speed_fromsrc']) && isset($this->all_tracked[$id]['time_last_coord']) && $this->all_tracked[$id]['time_last_coord'] != time() && isset($line['latitude']) && isset($line['longitude'])) { |
328 | - $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
329 | - if ($distance > 1000 && $distance < 10000) { |
|
328 | + $distance = $Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m'); |
|
329 | + if ($distance > 1000 && $distance < 10000) { |
|
330 | 330 | $speed = $distance/(time() - $this->all_tracked[$id]['time_last_coord']); |
331 | 331 | $speed = $speed*3.6; |
332 | 332 | if ($speed < 1000) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('speed' => round($speed,2))); |
333 | 333 | if ($globalDebug) echo "ø Calculated Speed for ".$this->all_tracked[$id]['hex']." : ".$speed." - distance : ".$distance."\n"; |
334 | - } |
|
334 | + } |
|
335 | 335 | } |
336 | 336 | |
337 | - if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
338 | - if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
339 | - else unset($timediff); |
|
340 | - if ($this->tmd > 5 || |
|
341 | - !isset($timediff) || |
|
342 | - $timediff > $globalLiveInterval || |
|
343 | - ( |
|
344 | - $timediff > 30 && |
|
345 | - isset($this->all_tracked[$id]['latitude']) && |
|
346 | - isset($this->all_tracked[$id]['longitude']) && |
|
347 | - $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')) |
|
348 | - ) |
|
349 | - ) { |
|
337 | + if (isset($line['latitude']) && isset($line['longitude']) && $line['latitude'] != '' && $line['longitude'] != '' && is_numeric($line['latitude']) && is_numeric($line['longitude'])) { |
|
338 | + if (isset($this->all_tracked[$id]['time_last_coord'])) $timediff = round(time()-$this->all_tracked[$id]['time_last_coord']); |
|
339 | + else unset($timediff); |
|
340 | + if ($this->tmd > 5 || |
|
341 | + !isset($timediff) || |
|
342 | + $timediff > $globalLiveInterval || |
|
343 | + ( |
|
344 | + $timediff > 30 && |
|
345 | + isset($this->all_tracked[$id]['latitude']) && |
|
346 | + isset($this->all_tracked[$id]['longitude']) && |
|
347 | + $Common->withinThreshold($timediff,$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')) |
|
348 | + ) |
|
349 | + ) { |
|
350 | 350 | if (isset($this->all_tracked[$id]['archive_latitude']) && isset($this->all_tracked[$id]['archive_longitude']) && isset($this->all_tracked[$id]['livedb_latitude']) && isset($this->all_tracked[$id]['livedb_longitude'])) { |
351 | - if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
351 | + if (!$Common->checkLine($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['livedb_latitude'],$this->all_tracked[$id]['livedb_longitude'],$line['latitude'],$line['longitude'])) { |
|
352 | 352 | $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
353 | 353 | $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
354 | 354 | $this->all_tracked[$id]['putinarchive'] = true; |
@@ -356,217 +356,217 @@ discard block |
||
356 | 356 | if ($globalDebug) echo "\n".' ------- Check Country for '.$this->all_tracked[$id]['ident'].' with latitude : '.$line['latitude'].' and longitude : '.$line['longitude'].'.... '; |
357 | 357 | $timeelapsed = microtime(true); |
358 | 358 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
359 | - $Marine = new Marine($this->db); |
|
360 | - $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
361 | - if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
362 | - $Marine->db = null; |
|
363 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
359 | + $Marine = new Marine($this->db); |
|
360 | + $all_country = $Marine->getCountryFromLatitudeLongitude($line['latitude'],$line['longitude']); |
|
361 | + if (!empty($all_country)) $this->all_tracked[$id]['over_country'] = $all_country['iso2']; |
|
362 | + $Marine->db = null; |
|
363 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update getCountryFromlatitudeLongitude : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
364 | 364 | } |
365 | 365 | $this->tmd = 0; |
366 | 366 | if ($globalDebug) echo 'FOUND : '.$this->all_tracked[$id]['over_country'].' ---------------'."\n"; |
367 | - } |
|
367 | + } |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | if (isset($line['latitude']) && $line['latitude'] != '' && $line['latitude'] != 0 && $line['latitude'] < 91 && $line['latitude'] > -90) { |
371 | 371 | if (!isset($this->all_tracked[$id]['archive_latitude'])) $this->all_tracked[$id]['archive_latitude'] = $line['latitude']; |
372 | 372 | if (!isset($this->all_tracked[$id]['livedb_latitude']) || abs($this->all_tracked[$id]['livedb_latitude']-$line['latitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
373 | - $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
374 | - $dataFound = true; |
|
375 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
373 | + $this->all_tracked[$id]['livedb_latitude'] = $line['latitude']; |
|
374 | + $dataFound = true; |
|
375 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
376 | 376 | } |
377 | 377 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('latitude' => $line['latitude'])); |
378 | 378 | } |
379 | 379 | if (isset($line['longitude']) && $line['longitude'] != '' && $line['longitude'] != 0 && $line['longitude'] < 360 && $line['longitude'] > -180) { |
380 | - if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
380 | + if ($line['longitude'] > 180) $line['longitude'] = $line['longitude'] - 360; |
|
381 | 381 | if (!isset($this->all_tracked[$id]['archive_longitude'])) $this->all_tracked[$id]['archive_longitude'] = $line['longitude']; |
382 | 382 | if (!isset($this->all_tracked[$id]['livedb_longitude']) || abs($this->all_tracked[$id]['livedb_longitude']-$line['longitude']) > $globalCoordMinChange || $this->all_tracked[$id]['format_source'] == 'aprs') { |
383 | - $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
384 | - $dataFound = true; |
|
385 | - $this->all_tracked[$id]['time_last_coord'] = time(); |
|
383 | + $this->all_tracked[$id]['livedb_longitude'] = $line['longitude']; |
|
384 | + $dataFound = true; |
|
385 | + $this->all_tracked[$id]['time_last_coord'] = time(); |
|
386 | 386 | } |
387 | 387 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('longitude' => $line['longitude'])); |
388 | 388 | } |
389 | 389 | |
390 | - } else if ($globalDebug && $timediff > 20) { |
|
390 | + } else if ($globalDebug && $timediff > 20) { |
|
391 | 391 | $this->tmd = $this->tmd + 1; |
392 | 392 | echo '!!! Too much distance in short time... for '.$this->all_tracked[$id]['ident']."\n"; |
393 | 393 | echo 'Time : '.$timediff.'s - Distance : '.$Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')."m -"; |
394 | 394 | echo 'Speed : '.(($Common->distance($line['latitude'],$line['longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],'m')/$timediff)*3.6)." km/h - "; |
395 | 395 | echo 'Lat : '.$line['latitude'].' - long : '.$line['longitude'].' - prev lat : '.$this->all_tracked[$id]['latitude'].' - prev long : '.$this->all_tracked[$id]['longitude']." \n"; |
396 | - } |
|
396 | + } |
|
397 | 397 | } |
398 | 398 | if (isset($line['last_update']) && $line['last_update'] != '') { |
399 | - if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
400 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
399 | + if (isset($this->all_tracked[$id]['last_update']) && $this->all_tracked[$id]['last_update'] != $line['last_update']) $dataFound = true; |
|
400 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('last_update' => $line['last_update'])); |
|
401 | 401 | } |
402 | 402 | if (isset($line['format_source']) && $line['format_source'] != '') { |
403 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
403 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('format_source' => $line['format_source'])); |
|
404 | 404 | } |
405 | 405 | if (isset($line['source_name']) && $line['source_name'] != '') { |
406 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
406 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('source_name' => $line['source_name'])); |
|
407 | 407 | } |
408 | 408 | if (isset($line['noarchive']) && $line['noarchive'] === true) { |
409 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
409 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('noarchive' => true)); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | if (isset($line['heading']) && $line['heading'] != '') { |
413 | - if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
414 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
415 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
416 | - //$dataFound = true; |
|
413 | + if (is_int($this->all_tracked[$id]['heading']) && abs($this->all_tracked[$id]['heading']-round($line['heading'])) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
414 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($line['heading']))); |
|
415 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading_fromsrc' => true)); |
|
416 | + //$dataFound = true; |
|
417 | 417 | } elseif (!isset($this->all_tracked[$id]['heading_fromsrc']) && isset($this->all_tracked[$id]['archive_latitude']) && $this->all_tracked[$id]['archive_latitude'] != $this->all_tracked[$id]['latitude'] && isset($this->all_tracked[$id]['archive_longitude']) && $this->all_tracked[$id]['archive_longitude'] != $this->all_tracked[$id]['longitude']) { |
418 | - $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
419 | - $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
420 | - if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
421 | - if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
418 | + $heading = $Common->getHeading($this->all_tracked[$id]['archive_latitude'],$this->all_tracked[$id]['archive_longitude'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude']); |
|
419 | + $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('heading' => round($heading))); |
|
420 | + if (abs($this->all_tracked[$id]['heading']-round($heading)) > 10) $this->all_tracked[$id]['putinarchive'] = true; |
|
421 | + if ($globalDebug) echo "ø Calculated Heading for ".$this->all_tracked[$id]['ident']." : ".$heading."\n"; |
|
422 | 422 | } |
423 | 423 | //if (isset($globalSourcesupdate) && $globalSourcesupdate != '' && isset($this->all_tracked[$id]['lastupdate']) && time()-$this->all_tracked[$id]['lastupdate'] < $globalSourcesupdate) $dataFound = false; |
424 | 424 | |
425 | 425 | |
426 | 426 | |
427 | 427 | if ($dataFound === true && (isset($this->all_tracked[$id]['mmsi']) || isset($this->all_tracked[$id]['id']))) { |
428 | - $this->all_tracked[$id]['lastupdate'] = time(); |
|
429 | - if ($this->all_tracked[$id]['addedMarine'] == 0 || (isset($globalVM) && $globalVM)) { |
|
430 | - if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
431 | - if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
428 | + $this->all_tracked[$id]['lastupdate'] = time(); |
|
429 | + if ($this->all_tracked[$id]['addedMarine'] == 0 || (isset($globalVM) && $globalVM)) { |
|
430 | + if (!isset($globalDistanceIgnore['latitude']) || $this->all_tracked[$id]['longitude'] == '' || $this->all_tracked[$id]['latitude'] == '' || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
|
431 | + if (!isset($this->all_tracked[$id]['forcenew']) || $this->all_tracked[$id]['forcenew'] == 0) { |
|
432 | 432 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
433 | - if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
434 | - $timeelapsed = microtime(true); |
|
435 | - $MarineLive = new MarineLive($this->db); |
|
436 | - if (isset($line['id']) && isset($globalVM) && $globalVM) { |
|
433 | + if ($globalDebug) echo "Check if vessel is already in DB..."; |
|
434 | + $timeelapsed = microtime(true); |
|
435 | + $MarineLive = new MarineLive($this->db); |
|
436 | + if (isset($line['id']) && isset($globalVM) && $globalVM) { |
|
437 | 437 | $Marine = new Marine($this->db); |
438 | 438 | $recent_ident = $Marine->checkId($line['id']); |
439 | 439 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkId : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
440 | 440 | $Marine->db=null; |
441 | - } elseif (isset($line['id'])) { |
|
441 | + } elseif (isset($line['id'])) { |
|
442 | 442 | $recent_ident = $MarineLive->checkIdRecent($line['id']); |
443 | 443 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
444 | - } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
444 | + } elseif (isset($this->all_tracked[$id]['mmsi']) && $this->all_tracked[$id]['mmsi'] != '') { |
|
445 | 445 | $recent_ident = $MarineLive->checkMMSIRecent($this->all_tracked[$id]['mmsi']); |
446 | 446 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
447 | - } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
447 | + } elseif (isset($this->all_tracked[$id]['ident']) && $this->all_tracked[$id]['ident'] != '') { |
|
448 | 448 | $recent_ident = $MarineLive->checkIdentRecent($this->all_tracked[$id]['ident']); |
449 | 449 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update checkIdentRecent : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
450 | - } else $recent_ident = ''; |
|
451 | - $MarineLive->db=null; |
|
452 | - if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
453 | - elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
450 | + } else $recent_ident = ''; |
|
451 | + $MarineLive->db=null; |
|
452 | + if ($globalDebug && $recent_ident == '') echo " Not in DB.\n"; |
|
453 | + elseif ($globalDebug && $recent_ident != '') echo " Already in DB.\n"; |
|
454 | 454 | } else $recent_ident = ''; |
455 | - } else { |
|
455 | + } else { |
|
456 | 456 | $recent_ident = ''; |
457 | 457 | $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('forcenew' => 0)); |
458 | - } |
|
459 | - //if there was no vessel with the same callsign within the last hour and go post it into the archive |
|
460 | - if($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM))) |
|
461 | - { |
|
458 | + } |
|
459 | + //if there was no vessel with the same callsign within the last hour and go post it into the archive |
|
460 | + if($recent_ident == "" && (($this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') || (isset($globalVM) && $globalVM))) |
|
461 | + { |
|
462 | 462 | if ($globalDebug) { |
463 | 463 | if ($this->all_tracked[$id]['mmsi'] == '') echo "\o/ Add ".$this->all_tracked[$id]['mmsi']." in archive DB : "; |
464 | 464 | else echo "\o/ Add ".$this->all_tracked[$id]['ident']." in archive DB : "; |
465 | 465 | } |
466 | 466 | //adds the spotter data for the archive |
467 | - $highlight = ''; |
|
468 | - if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
469 | - if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
467 | + $highlight = ''; |
|
468 | + if (!isset($this->all_tracked[$id]['id'])) $this->all_tracked[$id] = array_merge($this->all_tracked[$id],array('id' => $this->all_tracked[$id]['mmsi'].'-'.date('YmdHi'))); |
|
469 | + if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
|
470 | 470 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
471 | - $timeelapsed = microtime(true); |
|
472 | - $Marine = new Marine($this->db); |
|
473 | - if (isset($globalVM) && $globalVM && $this->all_tracked[$id]['race_begin'] != '') { |
|
471 | + $timeelapsed = microtime(true); |
|
472 | + $Marine = new Marine($this->db); |
|
473 | + if (isset($globalVM) && $globalVM && $this->all_tracked[$id]['race_begin'] != '') { |
|
474 | 474 | $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['race_begin'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
475 | - } else { |
|
475 | + } else { |
|
476 | 476 | $result = $Marine->addMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'], $this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['mmsi'], $this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'], $this->all_tracked[$id]['status'], $this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
477 | - } |
|
478 | - $Marine->db = null; |
|
479 | - if ($globalDebug && isset($result)) echo $result."\n"; |
|
480 | - if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
477 | + } |
|
478 | + $Marine->db = null; |
|
479 | + if ($globalDebug && isset($result)) echo $result."\n"; |
|
480 | + if ($globalDebugTimeElapsed) echo 'Time elapsed for update addspotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
|
481 | 481 | } |
482 | - } |
|
483 | - if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
482 | + } |
|
483 | + if (isset($line['sourcestats']) && $line['sourcestats'] == TRUE && $this->all_tracked[$id]['latitude'] != '' && $this->all_tracked[$id]['longitude'] != '') { |
|
484 | 484 | // Add source stat in DB |
485 | 485 | $Stats = new Stats($this->db); |
486 | 486 | if (!empty($this->stats)) { |
487 | - if ($globalDebug) echo 'Add source stats : '; |
|
488 | - foreach($this->stats as $date => $data) { |
|
487 | + if ($globalDebug) echo 'Add source stats : '; |
|
488 | + foreach($this->stats as $date => $data) { |
|
489 | 489 | foreach($data as $source => $sourced) { |
490 | - //print_r($sourced); |
|
491 | - if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
492 | - if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
493 | - if (isset($sourced['msg'])) { |
|
494 | - if (time() - $sourced['msg']['date'] > 10) { |
|
495 | - $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
496 | - echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
497 | - unset($this->stats[$date][$source]['msg']); |
|
498 | - } |
|
499 | - } |
|
500 | - } |
|
501 | - if ($date != date('Y-m-d')) { |
|
502 | - unset($this->stats[$date]); |
|
503 | - } |
|
504 | - } |
|
505 | - if ($globalDebug) echo 'Done'."\n"; |
|
490 | + //print_r($sourced); |
|
491 | + if (isset($sourced['polar'])) echo $Stats->addStatSource(json_encode($sourced['polar']),$source,'polar_marine',$date); |
|
492 | + if (isset($sourced['hist'])) echo $Stats->addStatSource(json_encode($sourced['hist']),$source,'hist_marine',$date); |
|
493 | + if (isset($sourced['msg'])) { |
|
494 | + if (time() - $sourced['msg']['date'] > 10) { |
|
495 | + $nbmsg = round($sourced['msg']['nb']/(time() - $sourced['msg']['date'])); |
|
496 | + echo $Stats->addStatSource($nbmsg,$source,'msg_marine',$date); |
|
497 | + unset($this->stats[$date][$source]['msg']); |
|
498 | + } |
|
499 | + } |
|
500 | + } |
|
501 | + if ($date != date('Y-m-d')) { |
|
502 | + unset($this->stats[$date]); |
|
503 | + } |
|
504 | + } |
|
505 | + if ($globalDebug) echo 'Done'."\n"; |
|
506 | 506 | } |
507 | 507 | $Stats->db = null; |
508 | - } |
|
508 | + } |
|
509 | 509 | |
510 | - $this->del(); |
|
510 | + $this->del(); |
|
511 | 511 | //$ignoreImport = false; |
512 | 512 | $this->all_tracked[$id]['addedMarine'] = 1; |
513 | 513 | //print_r($this->all_tracked[$id]); |
514 | 514 | if ($this->last_delete == 0 || time() - $this->last_delete > 1800) { |
515 | - if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
516 | - //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
517 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
515 | + if ($globalDebug) echo "---- Deleting Live Marine data older than 9 hours..."; |
|
516 | + //MarineLive->deleteLiveMarineDataNotUpdated(); |
|
517 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
518 | 518 | $MarineLive = new MarineLive($this->db); |
519 | 519 | $MarineLive->deleteLiveMarineData(); |
520 | 520 | $MarineLive->db=null; |
521 | 521 | if ($globalDebug) echo " Done\n"; |
522 | - } |
|
523 | - $this->last_delete = time(); |
|
522 | + } |
|
523 | + $this->last_delete = time(); |
|
524 | 524 | } |
525 | - } elseif ($recent_ident != '') { |
|
525 | + } elseif ($recent_ident != '') { |
|
526 | 526 | $this->all_tracked[$id]['id'] = $recent_ident; |
527 | 527 | $this->all_tracked[$id]['addedMarine'] = 1; |
528 | 528 | if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
529 | - if ((isset($globalDaemon) && !$globalDaemon) || (isset($globalVM) && $globalVM)) { |
|
529 | + if ((isset($globalDaemon) && !$globalDaemon) || (isset($globalVM) && $globalVM)) { |
|
530 | 530 | $Marine = new Marine($this->db); |
531 | 531 | if (isset($globalVM) && $globalVM) { |
532 | - if ($this->all_tracked[$id]['status'] == 'Racing') { |
|
532 | + if ($this->all_tracked[$id]['status'] == 'Racing') { |
|
533 | 533 | $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
534 | - } else { |
|
534 | + } else { |
|
535 | 535 | //$finaldatetime = date('Y-m-d H:i:s',strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']); |
536 | 536 | $timerace = (strtotime($this->all_tracked[$id]['race_begin'])+$this->all_tracked[$id]['race_time']); |
537 | 537 | if ($timerace > time()) $finaldatetime = NULL; |
538 | 538 | else $finaldatetime = date('Y-m-d H:i:s',$timerace); |
539 | 539 | |
540 | 540 | $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$finaldatetime,$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
541 | - } |
|
541 | + } |
|
542 | 542 | } else { |
543 | - $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
|
543 | + $Marine->updateLatestMarineData($this->all_tracked[$id]['id'],$this->all_tracked[$id]['ident'],$this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['race_begin']); |
|
544 | 544 | } |
545 | 545 | $Marine->db = null; |
546 | - } |
|
546 | + } |
|
547 | 547 | } |
548 | 548 | |
549 | - } |
|
549 | + } |
|
550 | 550 | } |
551 | - } |
|
552 | - //adds the spotter LIVE data |
|
553 | - if ($globalDebug) { |
|
551 | + } |
|
552 | + //adds the spotter LIVE data |
|
553 | + if ($globalDebug) { |
|
554 | 554 | echo 'DATA : ident : '.$this->all_tracked[$id]['ident'].' - type : '.$this->all_tracked[$id]['type'].' - Latitude : '.$this->all_tracked[$id]['latitude'].' - Longitude : '.$this->all_tracked[$id]['longitude'].' - Heading : '.$this->all_tracked[$id]['heading'].' - Speed : '.$this->all_tracked[$id]['speed']."\n"; |
555 | - } |
|
556 | - $ignoreImport = false; |
|
557 | - if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] != 'Racing') $ignoreImport = true; |
|
558 | - if (!$ignoreImport) { |
|
555 | + } |
|
556 | + $ignoreImport = false; |
|
557 | + if ((isset($globalVM) && $globalVM) && $this->all_tracked[$id]['status'] != 'Racing') $ignoreImport = true; |
|
558 | + if (!$ignoreImport) { |
|
559 | 559 | if (!isset($globalDistanceIgnore['latitude']) || (isset($globalDistanceIgnore['latitude']) && $Common->distance($this->all_tracked[$id]['latitude'],$this->all_tracked[$id]['longitude'],$globalDistanceIgnore['latitude'],$globalDistanceIgnore['longitude']) < $globalDistanceIgnore['distance'])) { |
560 | 560 | if ($globalDebug) echo "\o/ Add ".$this->all_tracked[$id]['ident']." from ".$this->all_tracked[$id]['format_source']." in Live DB : "; |
561 | 561 | if (!isset($globalNoImport) || $globalNoImport !== TRUE) { |
562 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
562 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
563 | 563 | $timeelapsed = microtime(true); |
564 | 564 | $MarineLive = new MarineLive($this->db); |
565 | 565 | $result = $MarineLive->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country'],$this->all_tracked[$id]['captain_id'],$this->all_tracked[$id]['captain_name'],$this->all_tracked[$id]['race_id'],$this->all_tracked[$id]['race_name'],$this->all_tracked[$id]['distance'],$this->all_tracked[$id]['race_rank'],$this->all_tracked[$id]['race_time']); |
566 | 566 | $MarineLive->db = null; |
567 | 567 | if ($globalDebug) echo $result."\n"; |
568 | 568 | if ($globalDebugTimeElapsed) echo 'Time elapsed for update addlivespotterdata : '.round(microtime(true)-$timeelapsed,2).'s'."\n"; |
569 | - } |
|
569 | + } |
|
570 | 570 | } |
571 | 571 | if (isset($globalServerAPRS) && $globalServerAPRS && $this->all_tracked[$id]['putinarchive']) { |
572 | 572 | $APRSMarine->addLiveMarineData($this->all_tracked[$id]['id'], $this->all_tracked[$id]['ident'], $this->all_tracked[$id]['latitude'], $this->all_tracked[$id]['longitude'], $this->all_tracked[$id]['heading'], $this->all_tracked[$id]['speed'],$this->all_tracked[$id]['datetime'], $this->all_tracked[$id]['putinarchive'],$this->all_tracked[$id]['mmsi'],$this->all_tracked[$id]['type'],$this->all_tracked[$id]['typeid'],$this->all_tracked[$id]['imo'],$this->all_tracked[$id]['callsign'],$this->all_tracked[$id]['arrival_code'],$this->all_tracked[$id]['arrival_date'],$this->all_tracked[$id]['status'],$this->all_tracked[$id]['status_id'],$this->all_tracked[$id]['noarchive'],$this->all_tracked[$id]['format_source'],$this->all_tracked[$id]['source_name'],$this->all_tracked[$id]['over_country']); |
@@ -601,7 +601,7 @@ discard block |
||
601 | 601 | if ($stats_heading == 16) $stats_heading = 0; |
602 | 602 | if (!isset($this->stats[$current_date][$source]['polar'][1])) { |
603 | 603 | for ($i=0;$i<=15;$i++) { |
604 | - $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
604 | + $this->stats[$current_date][$source]['polar'][$i] = 0; |
|
605 | 605 | } |
606 | 606 | $this->stats[$current_date][$source]['polar'][$stats_heading] = $stats_distance; |
607 | 607 | } else { |
@@ -614,11 +614,11 @@ discard block |
||
614 | 614 | //var_dump($this->stats); |
615 | 615 | if (!isset($this->stats[$current_date][$source]['hist'][$distance])) { |
616 | 616 | if (isset($this->stats[$current_date][$source]['hist'][0])) { |
617 | - end($this->stats[$current_date][$source]['hist']); |
|
618 | - $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
617 | + end($this->stats[$current_date][$source]['hist']); |
|
618 | + $mini = key($this->stats[$current_date][$source]['hist'])+10; |
|
619 | 619 | } else $mini = 0; |
620 | 620 | for ($i=$mini;$i<=$distance;$i+=10) { |
621 | - $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
621 | + $this->stats[$current_date][$source]['hist'][$i] = 0; |
|
622 | 622 | } |
623 | 623 | $this->stats[$current_date][$source]['hist'][$distance] = 1; |
624 | 624 | } else { |
@@ -634,30 +634,30 @@ discard block |
||
634 | 634 | |
635 | 635 | |
636 | 636 | if ($this->last_delete_hourly == 0 || time() - $this->last_delete_hourly > 900) { |
637 | - if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
637 | + if (!isset($globalNoDB) || $globalNoDB !== TRUE) { |
|
638 | 638 | if ($globalDebug) echo "---- Deleting Live Marine data Not updated since 2 hour..."; |
639 | 639 | $MarineLive = new MarineLive($this->db); |
640 | 640 | $MarineLive->deleteLiveMarineDataNotUpdated(); |
641 | 641 | $MarineLive->db = null; |
642 | 642 | //MarineLive->deleteLiveMarineData(); |
643 | 643 | if ($globalDebug) echo " Done\n"; |
644 | - } |
|
645 | - $this->last_delete_hourly = time(); |
|
644 | + } |
|
645 | + $this->last_delete_hourly = time(); |
|
646 | 646 | } |
647 | 647 | |
648 | - } |
|
649 | - //$ignoreImport = false; |
|
648 | + } |
|
649 | + //$ignoreImport = false; |
|
650 | 650 | } |
651 | 651 | //if (function_exists('pcntl_fork') && $globalFork) pcntl_signal(SIGCHLD, SIG_IGN); |
652 | 652 | if ($send) return $this->all_tracked[$id]; |
653 | - } |
|
653 | + } |
|
654 | + } |
|
654 | 655 | } |
655 | - } |
|
656 | 656 | |
657 | - public function race_add($data) { |
|
658 | - $Marine = new Marine(); |
|
659 | - $Marine->addRace($data['id'],$data['name'],$data['creator'],$data['desc'],$data['startdate'],$data['markers']); |
|
660 | - $Marine->db = null; |
|
661 | - } |
|
657 | + public function race_add($data) { |
|
658 | + $Marine = new Marine(); |
|
659 | + $Marine->addRace($data['id'],$data['name'],$data['creator'],$data['desc'],$data['startdate'],$data['markers']); |
|
660 | + $Marine->db = null; |
|
661 | + } |
|
662 | 662 | } |
663 | 663 | ?> |
@@ -91,32 +91,32 @@ |
||
91 | 91 | $limit_previous_2 = $limit_end - $absolute_difference; |
92 | 92 | |
93 | 93 | if ( |
94 | - (isset($_GET['q']) && $_GET['q'] != '') || |
|
95 | - (isset($_GET['registration']) && $_GET['registration'] != '') || |
|
96 | - (isset($_GET['aircraft']) && $_GET['aircraft'] != '') || |
|
97 | - (isset($_GET['manufacturer']) && $_GET['manufacturer'] != '') || |
|
98 | - (isset($_GET['highlights']) && $_GET['highlights'] != '') || |
|
99 | - (isset($_GET['airline']) && $_GET['airline'] != '') || |
|
100 | - (isset($_GET['airline_country']) && $_GET['airline_country'] != '') || |
|
101 | - (isset($_GET['airline_type']) && $_GET['airline_type'] != '') || |
|
102 | - (isset($_GET['airport']) && $_GET['airport'] != '') || |
|
103 | - (isset($_GET['airport_country']) && $_GET['airport_country'] != '') || |
|
104 | - (isset($_GET['callsign']) && $_GET['callsign'] != '') || |
|
105 | - (isset($_GET['captain_id']) && $_GET['captain_id'] != '') || |
|
106 | - (isset($_GET['race_id']) && $_GET['race_id'] != '') || |
|
107 | - (isset($_GET['captain_name']) && $_GET['captain_name'] != '') || |
|
108 | - (isset($_GET['race_name']) && $_GET['race_name'] != '') || |
|
109 | - (isset($_GET['owner']) && $_GET['owner'] != '') || |
|
110 | - (isset($_GET['pilot_name']) && $_GET['pilot_name'] != '') || |
|
111 | - (isset($_GET['pilot_id']) && $_GET['pilot_id'] != '') || |
|
112 | - (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != '') || |
|
113 | - (isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != '') || |
|
114 | - (isset($_GET['mmsi']) && $_GET['mmsi'] != '') || |
|
115 | - (isset($_GET['imo']) && $_GET['imo'] != '') || |
|
116 | - ((isset($_GET['origlat']) && $_GET['origlat'] != '') && |
|
117 | - (isset($_GET['origlon']) && $_GET['origlon'] != '') && |
|
118 | - (isset($_GET['dist']) && $_GET['dist'] != '')) |
|
119 | - ){ |
|
94 | + (isset($_GET['q']) && $_GET['q'] != '') || |
|
95 | + (isset($_GET['registration']) && $_GET['registration'] != '') || |
|
96 | + (isset($_GET['aircraft']) && $_GET['aircraft'] != '') || |
|
97 | + (isset($_GET['manufacturer']) && $_GET['manufacturer'] != '') || |
|
98 | + (isset($_GET['highlights']) && $_GET['highlights'] != '') || |
|
99 | + (isset($_GET['airline']) && $_GET['airline'] != '') || |
|
100 | + (isset($_GET['airline_country']) && $_GET['airline_country'] != '') || |
|
101 | + (isset($_GET['airline_type']) && $_GET['airline_type'] != '') || |
|
102 | + (isset($_GET['airport']) && $_GET['airport'] != '') || |
|
103 | + (isset($_GET['airport_country']) && $_GET['airport_country'] != '') || |
|
104 | + (isset($_GET['callsign']) && $_GET['callsign'] != '') || |
|
105 | + (isset($_GET['captain_id']) && $_GET['captain_id'] != '') || |
|
106 | + (isset($_GET['race_id']) && $_GET['race_id'] != '') || |
|
107 | + (isset($_GET['captain_name']) && $_GET['captain_name'] != '') || |
|
108 | + (isset($_GET['race_name']) && $_GET['race_name'] != '') || |
|
109 | + (isset($_GET['owner']) && $_GET['owner'] != '') || |
|
110 | + (isset($_GET['pilot_name']) && $_GET['pilot_name'] != '') || |
|
111 | + (isset($_GET['pilot_id']) && $_GET['pilot_id'] != '') || |
|
112 | + (isset($_GET['departure_airport_route']) && $_GET['departure_airport_route'] != '') || |
|
113 | + (isset($_GET['arrival_airport_route']) && $_GET['arrival_airport_route'] != '') || |
|
114 | + (isset($_GET['mmsi']) && $_GET['mmsi'] != '') || |
|
115 | + (isset($_GET['imo']) && $_GET['imo'] != '') || |
|
116 | + ((isset($_GET['origlat']) && $_GET['origlat'] != '') && |
|
117 | + (isset($_GET['origlon']) && $_GET['origlon'] != '') && |
|
118 | + (isset($_GET['dist']) && $_GET['dist'] != '')) |
|
119 | + ){ |
|
120 | 120 | $q = filter_input(INPUT_GET, 'q',FILTER_SANITIZE_STRING); |
121 | 121 | $registration = filter_input(INPUT_GET, 'registration',FILTER_SANITIZE_STRING); |
122 | 122 | $aircraft = filter_input(INPUT_GET, 'aircraft',FILTER_SANITIZE_STRING); |
@@ -267,16 +267,16 @@ discard block |
||
267 | 267 | <div class="more"> |
268 | 268 | <?php |
269 | 269 | |
270 | - if ($year != '' && $month != '') { |
|
271 | - ?> |
|
270 | + if ($year != '' && $month != '') { |
|
271 | + ?> |
|
272 | 272 | <a href="<?php print $globalURL; ?>/marine/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
273 | 273 | <?php |
274 | - } else { |
|
275 | - ?> |
|
274 | + } else { |
|
275 | + ?> |
|
276 | 276 | <a href="<?php print $globalURL; ?>/marine/statistics/type" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
277 | 277 | <?php |
278 | - } |
|
279 | - ?> |
|
278 | + } |
|
279 | + ?> |
|
280 | 280 | </div> |
281 | 281 | </div> |
282 | 282 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -308,16 +308,16 @@ discard block |
||
308 | 308 | ?> |
309 | 309 | <div class="more"> |
310 | 310 | <?php |
311 | - if ($year != '' && $month != '') { |
|
312 | - ?> |
|
311 | + if ($year != '' && $month != '') { |
|
312 | + ?> |
|
313 | 313 | <a href="<?php print $globalURL; ?>/marine/statistics/race/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
314 | 314 | <?php |
315 | - } else { |
|
316 | - ?> |
|
315 | + } else { |
|
316 | + ?> |
|
317 | 317 | <a href="<?php print $globalURL; ?>/marine/statistics/race" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
318 | 318 | <?php |
319 | - } |
|
320 | - ?> |
|
319 | + } |
|
320 | + ?> |
|
321 | 321 | </div> |
322 | 322 | </div> |
323 | 323 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | ?> |
355 | 355 | <div class="more"> |
356 | 356 | <?php |
357 | - /* |
|
357 | + /* |
|
358 | 358 | if ($year != '' && $month != '') { |
359 | 359 | ?> |
360 | 360 | <a href="<?php print $globalURL; ?>/tracker/statistics/type/<?php echo $year; ?>/<?php echo $month ?>/" class="btn btn-default btn" role="button"><?php echo _("See full statistic"); ?>»</a> |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | <?php |
366 | 366 | } |
367 | 367 | */ |
368 | - ?> |
|
368 | + ?> |
|
369 | 369 | </div> |
370 | 370 | </div> |
371 | 371 | <!-- <?php print 'Time elapsed : '.(microtime(true)-$beginpage).'s' ?> --> |
@@ -6,12 +6,12 @@ |
||
6 | 6 | </div> |
7 | 7 | <footer class="container"> |
8 | 8 | <?php |
9 | - if (isset($sql_time)) { |
|
9 | + if (isset($sql_time)) { |
|
10 | 10 | ?> |
11 | 11 | <i><?php echo _("Page generated in").' '.round($sql_time+$page_time,2); ?>s (<?php print round($page_time,2); ?>ms PHP - <?php print round($sql_time,2); ?>ms SQL)</i> |
12 | 12 | <br /> |
13 | 13 | <?php |
14 | - } |
|
14 | + } |
|
15 | 15 | ?> |
16 | 16 | <span>Developed in Barrie by <a href="http://www.mariotrunz.me/" target="_blank">Mario Trunz</a> & at <a href="http://www.zugaina.com" target="_blank">Zugaina</a> by Ycarus</span> - <span><a href="<?php if (isset($globalURL)) print $globalURL; ?>/about#source">Source & Credits</a></span> - <span><a href="https://www.flightairmap.com/" target="_blank">Get source code</a></span> |
17 | 17 | </footer> |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | // When button "Remove all filters" is clicked |
39 | 39 | if (isset($_POST['removefilters'])) { |
40 | 40 | $allfilters = array_filter(array_keys($_COOKIE),function($key) { |
41 | - return strpos($key,'filter_') === 0; |
|
41 | + return strpos($key,'filter_') === 0; |
|
42 | 42 | }); |
43 | 43 | foreach ($allfilters as $filt) { |
44 | 44 | unset($_COOKIE[$filt]); |
@@ -409,34 +409,34 @@ discard block |
||
409 | 409 | |
410 | 410 | <ul class="nav navbar-nav"> |
411 | 411 | <?php |
412 | - if (isset($globalNewsFeeds['global']) && !empty($globalNewsFeeds['global'])) { |
|
412 | + if (isset($globalNewsFeeds['global']) && !empty($globalNewsFeeds['global'])) { |
|
413 | 413 | ?> |
414 | 414 | <li><a href="<?php print $globalURL; ?>/news"><?php echo _("News"); ?></a></li> |
415 | 415 | <?php |
416 | - } |
|
416 | + } |
|
417 | 417 | ?> |
418 | 418 | |
419 | 419 | <?php |
420 | - $sub = false; |
|
421 | - if ( |
|
420 | + $sub = false; |
|
421 | + if ( |
|
422 | 422 | ( |
423 | - (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
423 | + (!isset($globalAircraft) || (isset($globalAircraft) && $globalAircraft === TRUE)) && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
424 | 424 | ) || |
425 | 425 | ( |
426 | - isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
426 | + isset($globalMarine) && $globalMarine === TRUE && ((isset($globalTracker) && $globalTracker === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
427 | 427 | ) || |
428 | 428 | ( |
429 | - isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
429 | + isset($globalTracker) && $globalTracker === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalSatellite) && $globalSatellite === TRUE)) |
|
430 | 430 | ) || |
431 | 431 | ( |
432 | - isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE)) |
|
432 | + isset($globalSatellite) && $globalSatellite === TRUE && ((isset($globalMarine) && $globalMarine === TRUE) || (isset($globalTracker) && $globalTracker === TRUE)) |
|
433 | 433 | ) |
434 | - ) { |
|
434 | + ) { |
|
435 | 435 | $sub = true; |
436 | - } |
|
436 | + } |
|
437 | 437 | ?> |
438 | 438 | <?php |
439 | - if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
439 | + if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
440 | 440 | ?> |
441 | 441 | <li class="dropdown"> |
442 | 442 | <?php |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | <ul class="dropdown-menu multi-level"> |
448 | 448 | <li class="dropdown-submenu"> |
449 | 449 | <?php |
450 | - } |
|
450 | + } |
|
451 | 451 | ?> |
452 | 452 | <?php |
453 | 453 | if (isset($globalNewsFeeds['aircraft']) && !empty($globalNewsFeeds['aircraft'])) { |
@@ -462,25 +462,25 @@ discard block |
||
462 | 462 | <ul class="dropdown-menu"> |
463 | 463 | <li><a href="<?php print $globalURL; ?>/aircraft"><?php echo _("Aircraft Types"); ?></a></li> |
464 | 464 | <?php |
465 | - if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
|
465 | + if (!isset($globalNoAirlines) || $globalNoAirlines === FALSE) { |
|
466 | 466 | ?> |
467 | 467 | <li><a href="<?php print $globalURL; ?>/airline"><?php echo _("Airlines"); ?></a></li> |
468 | 468 | <?php |
469 | - } |
|
469 | + } |
|
470 | 470 | ?> |
471 | 471 | <li><a href="<?php print $globalURL; ?>/airport"><?php echo _("Airports"); ?></a></li> |
472 | 472 | <?php |
473 | - if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
473 | + if ((isset($globalUseOwner) && $globalUseOwner) || (!isset($globalUseOwner) && (!isset($globalVA) || !$globalVA) && (!isset($globalIVAO) || !$globalIVAO) && (!isset($globalVATSIM) || !$globalVATSIM) && (!isset($globalphpVMS) || !$globalphpVMS) && (!isset($globalVAM) || !$globalVAM))) { |
|
474 | 474 | ?> |
475 | 475 | <li><a href="<?php print $globalURL; ?>/owner"><?php echo _("Owners"); ?></a></li> |
476 | 476 | <?php |
477 | - } |
|
478 | - if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
477 | + } |
|
478 | + if ((isset($globalUsePilot) && $globalUsePilot) || !isset($globalUsePilot) && ((isset($globalVA) && $globalVA) || (isset($globalIVAO) && $globalIVAO) || (isset($globalVATSIM) && $globalVATSIM) || (isset($globalphpVMS) && $globalphpVMS) || (isset($globalVAM) && $globalVAM))) { |
|
479 | 479 | |
480 | 480 | ?> |
481 | 481 | <li><a href="<?php print $globalURL; ?>/pilot"><?php echo _("Pilots"); ?></a></li> |
482 | 482 | <?php |
483 | - } |
|
483 | + } |
|
484 | 484 | ?> |
485 | 485 | <li><hr /></li> |
486 | 486 | <li><a href="<?php print $globalURL; ?>/currently"><?php echo _("Current Activity"); ?></a></li> |
@@ -488,43 +488,43 @@ discard block |
||
488 | 488 | <li><a href="<?php print $globalURL; ?>/date/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Activity"); ?></a></li> |
489 | 489 | <li><a href="<?php print $globalURL; ?>/newest"><?php echo _("Newest by Category"); ?></a></li> |
490 | 490 | <?php |
491 | - if ($globalACARS) { |
|
492 | - if (isset($globalDemo) && $globalDemo) { |
|
493 | - ?> |
|
491 | + if ($globalACARS) { |
|
492 | + if (isset($globalDemo) && $globalDemo) { |
|
493 | + ?> |
|
494 | 494 | <li><hr /></li> |
495 | 495 | <li><i><?php echo _('ACARS data not available publicly'); ?></i></li> |
496 | 496 | <li><a href=""><?php echo _('Latest ACARS messages'); ?></a></li> |
497 | 497 | <li><a href=""><?php echo _('Archive ACARS messages'); ?></a></li> |
498 | 498 | <?php |
499 | - } else { |
|
500 | - ?> |
|
499 | + } else { |
|
500 | + ?> |
|
501 | 501 | <li><hr /></li> |
502 | 502 | <li><a href="<?php print $globalURL; ?>/acars-latest"><?php echo _("Latest ACARS messages"); ?></a></li> |
503 | 503 | <li><a href="<?php print $globalURL; ?>/acars-archive"><?php echo _("Archive ACARS messages"); ?></a></li> |
504 | 504 | <?php |
505 | - } |
|
506 | - } |
|
507 | - ?> |
|
505 | + } |
|
506 | + } |
|
507 | + ?> |
|
508 | 508 | <?php |
509 | - if (isset($globalAccidents) && $globalAccidents) { |
|
510 | - ?> |
|
509 | + if (isset($globalAccidents) && $globalAccidents) { |
|
510 | + ?> |
|
511 | 511 | <li><hr /></li> |
512 | 512 | <li><a href="<?php print $globalURL; ?>/accident-latest"><?php echo _("Latest accident"); ?></a></li> |
513 | 513 | <li><a href="<?php print $globalURL; ?>/accident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Accident"); ?></a></li> |
514 | 514 | <li><a href="<?php print $globalURL; ?>/incident-latest"><?php echo _("Latest incident"); ?></a></li> |
515 | 515 | <li><a href="<?php print $globalURL; ?>/incident/<?php print date("Y-m-d"); ?>"><?php echo _("Today's Incident"); ?></a></li> |
516 | 516 | <?php |
517 | - } |
|
518 | - ?> |
|
517 | + } |
|
518 | + ?> |
|
519 | 519 | <li><hr /></li> |
520 | 520 | <li><a href="<?php print $globalURL; ?>/highlights/table"><?php echo _("Special Highlights"); ?></a></li> |
521 | 521 | <?php |
522 | 522 | if (!isset($globalNoUpcoming) || $globalNoUpcoming === FALSE) { |
523 | - ?> |
|
523 | + ?> |
|
524 | 524 | <li><a href="<?php print $globalURL; ?>/upcoming"><?php echo _("Upcoming Flights"); ?></a></li> |
525 | 525 | <?php |
526 | 526 | } |
527 | - ?> |
|
527 | + ?> |
|
528 | 528 | </ul> |
529 | 529 | </li> |
530 | 530 | <li><a href="<?php print $globalURL; ?>/search"><?php echo _("Search"); ?></a></li> |
@@ -551,14 +551,14 @@ discard block |
||
551 | 551 | </ul> |
552 | 552 | <?php |
553 | 553 | } |
554 | - } |
|
554 | + } |
|
555 | 555 | ?> |
556 | 556 | <?php |
557 | - if (isset($globalMarine) && $globalMarine) { |
|
557 | + if (isset($globalMarine) && $globalMarine) { |
|
558 | 558 | ?> |
559 | 559 | <li class="dropdown"> |
560 | 560 | <?php |
561 | - if ($sub) { |
|
561 | + if ($sub) { |
|
562 | 562 | ?> |
563 | 563 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Marines"); ?> <b class="caret"></b></a> |
564 | 564 | <ul class="dropdown-menu multi-level"> |
@@ -601,14 +601,14 @@ discard block |
||
601 | 601 | } |
602 | 602 | ?> |
603 | 603 | <?php |
604 | - } |
|
604 | + } |
|
605 | 605 | ?> |
606 | 606 | <?php |
607 | - if (isset($globalTracker) && $globalTracker) { |
|
607 | + if (isset($globalTracker) && $globalTracker) { |
|
608 | 608 | ?> |
609 | 609 | <li class="dropdown"> |
610 | 610 | <?php |
611 | - if ($sub) { |
|
611 | + if ($sub) { |
|
612 | 612 | ?> |
613 | 613 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Trackers"); ?> <b class="caret"></b></a> |
614 | 614 | <ul class="dropdown-menu multi-level"> |
@@ -642,14 +642,14 @@ discard block |
||
642 | 642 | } |
643 | 643 | ?> |
644 | 644 | <?php |
645 | - } |
|
645 | + } |
|
646 | 646 | ?> |
647 | 647 | <?php |
648 | - if (isset($globalSatellite) && $globalSatellite) { |
|
648 | + if (isset($globalSatellite) && $globalSatellite) { |
|
649 | 649 | ?> |
650 | 650 | <li class="dropdown"> |
651 | 651 | <?php |
652 | - if ($sub) { |
|
652 | + if ($sub) { |
|
653 | 653 | ?> |
654 | 654 | <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo _("Satellites"); ?> <b class="caret"></b></a> |
655 | 655 | <ul class="dropdown-menu multi-level"> |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | } |
686 | 686 | ?> |
687 | 687 | <?php |
688 | - } |
|
688 | + } |
|
689 | 689 | ?> |
690 | 690 | |
691 | 691 | <li class="dropdown"> |
@@ -693,13 +693,13 @@ discard block |
||
693 | 693 | <ul class="dropdown-menu"> |
694 | 694 | <li><a href="<?php print $globalURL; ?>/about"><?php echo _("About The Project"); ?></a></li> |
695 | 695 | <?php |
696 | - if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
696 | + if (!isset($globalAircraft) || $globalAircraft === TRUE) { |
|
697 | 697 | ?> |
698 | 698 | <li><a href="<?php print $globalURL; ?>/about/export"><?php echo _("Exporting Data"); ?></a></li> |
699 | 699 | <li><hr /></li> |
700 | 700 | <li><a href="<?php print $globalURL; ?>/about/tv"><?php echo _("Spotter TV"); ?></a></li> |
701 | 701 | <?php |
702 | - } |
|
702 | + } |
|
703 | 703 | ?> |
704 | 704 | <?php if (isset($globalContribute) && $globalContribute) { ?> |
705 | 705 | <li><hr /></li> |
@@ -723,13 +723,13 @@ discard block |
||
723 | 723 | <form> |
724 | 724 | <select class="selectpicker" data-width="120px" onchange="language(this);"> |
725 | 725 | <?php |
726 | - foreach ($alllang as $key => $lang) { |
|
727 | - print '<option value="'.$key.'"'; |
|
728 | - if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
729 | - if ($lang[0] == 'Deutsch') print '>'.$lang[0].' (βeta)</option>'; |
|
730 | - else print '>'.$lang[0].'</option>'; |
|
731 | - } |
|
732 | - ?> |
|
726 | + foreach ($alllang as $key => $lang) { |
|
727 | + print '<option value="'.$key.'"'; |
|
728 | + if (isset($_COOKIE['language']) && $_COOKIE['language'] == $key) print ' selected '; |
|
729 | + if ($lang[0] == 'Deutsch') print '>'.$lang[0].' (βeta)</option>'; |
|
730 | + else print '>'.$lang[0].'</option>'; |
|
731 | + } |
|
732 | + ?> |
|
733 | 733 | </select> |
734 | 734 | </form> |
735 | 735 | </div> |
@@ -762,18 +762,18 @@ discard block |
||
762 | 762 | ?> |
763 | 763 | <div class="top-header clear" role="main"> |
764 | 764 | <?php |
765 | - if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
765 | + if (isset($longitude) && isset($latitude) && $longitude != 0 && $latitude != 0) { |
|
766 | 766 | ?> |
767 | 767 | <div id="archive-map"></div> |
768 | 768 | <?php |
769 | - } |
|
769 | + } |
|
770 | 770 | ?> |
771 | 771 | </div> |
772 | 772 | <?php |
773 | 773 | } |
774 | 774 | 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)) |
775 | 775 | { |
776 | - ?> |
|
776 | + ?> |
|
777 | 777 | <div class="top-header clear" role="main"> |
778 | 778 | <div id="map"></div> |
779 | 779 | <link rel="stylesheet" href="<?php print $globalURL; ?>/css/leaflet.css" /> |
@@ -784,15 +784,15 @@ discard block |
||
784 | 784 | var zoom = 13; |
785 | 785 | //create the map |
786 | 786 | <?php |
787 | - if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
787 | + if (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($airport_array[0]['latitude'])) { |
|
788 | 788 | ?> |
789 | 789 | map = L.map('map', { zoomControl:true }).setView([<?php print $airport_array[0]['latitude']; ?>,<?php print $airport_array[0]['longitude']; ?>], zoom); |
790 | 790 | <?php |
791 | - } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
791 | + } elseif (strpos(strtolower($current_page),'airport-') !== false && strpos(strtolower($current_page),'statistics-') === false) { |
|
792 | 792 | ?> |
793 | 793 | map = L.map('map', { zoomControl:true }); |
794 | 794 | <?php |
795 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
795 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && isset($spotter_array[0]['departure_airport_latitude'])) { |
|
796 | 796 | ?> |
797 | 797 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['departure_airport_latitude']; ?>,<?php print $spotter_array[0]['arrival_airport_longitude']; ?>]); |
798 | 798 | 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); |
@@ -800,22 +800,22 @@ discard block |
||
800 | 800 | 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); |
801 | 801 | 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); |
802 | 802 | <?php |
803 | - } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
803 | + } elseif (strpos(strtolower($current_page),'route-') !== false && strpos(strtolower($current_page),'statistics-') === false && !isset($spotter_array[0]['departure_airport_latitude']) && isset($spotter_array[0]['latitude'])) { |
|
804 | 804 | ?> |
805 | 805 | map = L.map('map', { zoomControl:true }).setView([<?php print $spotter_array[0]['latitude']; ?>,<?php print $spotter_array[0]['longitude']; ?>]); |
806 | 806 | <?php |
807 | - } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
807 | + } elseif (!isset($spotter_array[0]['latitude']) && !isset($spotter_array[0]['longitude'])) { |
|
808 | 808 | ?> |
809 | 809 | map = L.map('map', { zoomControl:true }); |
810 | 810 | <?php |
811 | - } |
|
811 | + } |
|
812 | 812 | ?> |
813 | 813 | //initialize the layer group for the aircrft markers |
814 | 814 | var layer_data = L.layerGroup(); |
815 | 815 | |
816 | 816 | //a few title layers |
817 | 817 | <?php |
818 | - if ($globalMapProvider == 'Mapbox') { |
|
818 | + if ($globalMapProvider == 'Mapbox') { |
|
819 | 819 | ?> |
820 | 820 | L.tileLayer('https://{s}.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={token}', { |
821 | 821 | maxZoom: 18, |
@@ -826,14 +826,14 @@ discard block |
||
826 | 826 | token : '<?php print $globalMapboxToken; ?>' |
827 | 827 | }).addTo(map); |
828 | 828 | <?php |
829 | - } elseif ($globalMapProvider == 'Mapbox-GL') { |
|
829 | + } elseif ($globalMapProvider == 'Mapbox-GL') { |
|
830 | 830 | ?> |
831 | 831 | L.mapboxGL({ |
832 | 832 | accessToken: '<?php print $globalMapboxToken; ?>', |
833 | 833 | style: 'mapbox://styles/mapbox/bright-v8' |
834 | 834 | }).addTo(map); |
835 | 835 | <?php |
836 | - } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
836 | + } elseif ($globalMapProvider == 'MapQuest-OSM') { |
|
837 | 837 | ?> |
838 | 838 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', { |
839 | 839 | maxZoom: 18, |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | 'Tiles Courtesy of <a href="http://www.mapquest.com">MapQuest</a>' |
843 | 843 | }).addTo(map); |
844 | 844 | <?php |
845 | - } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
845 | + } elseif ($globalMapProvider == 'MapQuest-Aerial') { |
|
846 | 846 | ?> |
847 | 847 | L.tileLayer('http://otile1.mqcdn.com/tiles/1.0.0/sat/{z}/{x}/{y}.png', { |
848 | 848 | maxZoom: 18, |
@@ -851,27 +851,27 @@ discard block |
||
851 | 851 | '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"' |
852 | 852 | }).addTo(map); |
853 | 853 | <?php |
854 | - } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
854 | + } elseif ($globalMapProvider == 'Google-Roadmap') { |
|
855 | 855 | ?> |
856 | 856 | var googleLayer = new L.Google('ROADMAP'); |
857 | 857 | map.addLayer(googleLayer); |
858 | 858 | <?php |
859 | - } elseif ($globalMapProvider == 'Google-Satellite') { |
|
859 | + } elseif ($globalMapProvider == 'Google-Satellite') { |
|
860 | 860 | ?> |
861 | 861 | var googleLayer = new L.Google('SATELLITE'); |
862 | 862 | map.addLayer(googleLayer); |
863 | 863 | <?php |
864 | - } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
864 | + } elseif ($globalMapProvider == 'Google-Hybrid') { |
|
865 | 865 | ?> |
866 | 866 | var googleLayer = new L.Google('HYBRID'); |
867 | 867 | map.addLayer(googleLayer); |
868 | 868 | <?php |
869 | - } elseif ($globalMapProvider == 'Google-Terrain') { |
|
869 | + } elseif ($globalMapProvider == 'Google-Terrain') { |
|
870 | 870 | ?> |
871 | 871 | var googleLayer = new L.Google('Terrain'); |
872 | 872 | map.addLayer(googleLayer); |
873 | 873 | <?php |
874 | - } elseif (isset($globalMapCustomLayer[$globalMapProvider])) { |
|
874 | + } elseif (isset($globalMapCustomLayer[$globalMapProvider])) { |
|
875 | 875 | $customid = $globalMapProvider; |
876 | 876 | ?> |
877 | 877 | L.tileLayer('<?php print $globalMapCustomLayer[$customid]['url']; ?>/{z}/{x}/{y}.png', { |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | attribution: '<?php print $globalMapCustomLayer[$customid]['attribution']; ?>' |
882 | 882 | }).addTo(map); |
883 | 883 | <?php |
884 | - } elseif ($globalMapProvider == 'offline' || (isset($globalMapOffline) && $globalMapOffline === TRUE)) { |
|
884 | + } elseif ($globalMapProvider == 'offline' || (isset($globalMapOffline) && $globalMapOffline === TRUE)) { |
|
885 | 885 | ?> |
886 | 886 | var center = map.getCenter(); |
887 | 887 | map.options.crs = L.CRS.EPSG4326; |
@@ -896,8 +896,8 @@ discard block |
||
896 | 896 | attribution: 'Natural Earth' |
897 | 897 | }).addTo(map); |
898 | 898 | <?php |
899 | - //} elseif ($globalMapProvider == 'OpenStreetMap') { |
|
900 | - } else { |
|
899 | + //} elseif ($globalMapProvider == 'OpenStreetMap') { |
|
900 | + } else { |
|
901 | 901 | ?> |
902 | 902 | L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { |
903 | 903 | maxZoom: 18, |
@@ -906,7 +906,7 @@ discard block |
||
906 | 906 | }).addTo(map); |
907 | 907 | |
908 | 908 | <?php |
909 | - } |
|
909 | + } |
|
910 | 910 | ?> |
911 | 911 | </script> |
912 | 912 | </div> |
@@ -13,20 +13,20 @@ discard block |
||
13 | 13 | { |
14 | 14 | $coords = explode(',',$_GET['coord']); |
15 | 15 | if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') |
16 | - || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
16 | + || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
17 | 17 | //$spotter_array = $Source->getAllLocationInfo(); |
18 | 18 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs',$coords)); |
19 | 19 | } |
20 | 20 | if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') |
21 | - || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
21 | + || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
22 | 22 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx',$coords)); |
23 | 23 | } |
24 | 24 | if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') |
25 | - || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
25 | + || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
26 | 26 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning',$coords)); |
27 | 27 | } |
28 | 28 | if ((isset($_COOKIE['show_Fires']) && $_COOKIE['show_Fires'] == 'true') |
29 | - || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
29 | + || (!isset($_COOKIE['show_Fires']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
30 | 30 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',$coords,true)); |
31 | 31 | } |
32 | 32 | if (!isset($globalDemo)) { |
@@ -34,20 +34,20 @@ discard block |
||
34 | 34 | } |
35 | 35 | } else { |
36 | 36 | if ((isset($_COOKIE['show_GroundStation']) && $_COOKIE['show_GroundStation'] == 'true') |
37 | - || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
37 | + || (!isset($_COOKIE['show_GroundStation']) && (isset($globalMapGroundStation) && $globalMapGroundStation === TRUE))) { |
|
38 | 38 | //$spotter_array = $Source->getAllLocationInfo(); |
39 | 39 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('gs')); |
40 | 40 | } |
41 | 41 | if ((isset($_COOKIE['show_WeatherStation']) && $_COOKIE['show_WeatherStation'] == 'true') |
42 | - || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
42 | + || (!isset($_COOKIE['show_WeatherStation']) && (isset($globalMapWeatherStation) && $globalMapWeatherStation === TRUE))) { |
|
43 | 43 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('wx')); |
44 | 44 | } |
45 | 45 | if ((isset($_COOKIE['show_Lightning']) && $_COOKIE['show_Lightning'] == 'true') |
46 | - || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
46 | + || (!isset($_COOKIE['show_Lightning']) && (isset($globalMapLightning) && $globalMapLightning === TRUE))) { |
|
47 | 47 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('lightning')); |
48 | 48 | } |
49 | 49 | if ((isset($_COOKIE['show_Fire']) && $_COOKIE['show_Fire'] == 'true') |
50 | - || (!isset($_COOKIE['show_Fire']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
50 | + || (!isset($_COOKIE['show_Fire']) && (isset($globalMapFires) && $globalMapFires === TRUE))) { |
|
51 | 51 | $spotter_array = array_merge($spotter_array,$Source->getLocationInfoByType('fires',array(),true)); |
52 | 52 | } |
53 | 53 | if (!isset($globalDemo)) { |
@@ -11,27 +11,27 @@ discard block |
||
11 | 11 | require_once(dirname(__FILE__).'/../require/class.Connection.php'); |
12 | 12 | $schema = new Connection(); |
13 | 13 | if ($schema->latest() === false) { |
14 | - echo "You MUST update to latest schema. Run install/index.php"; |
|
15 | - exit(); |
|
14 | + echo "You MUST update to latest schema. Run install/index.php"; |
|
15 | + exit(); |
|
16 | 16 | } |
17 | 17 | if ($globalInstalled === FALSE) { |
18 | - echo "Install script MUST be run before this script. Use you web browser to run install/index.php"; |
|
19 | - die(); |
|
18 | + echo "Install script MUST be run before this script. Use you web browser to run install/index.php"; |
|
19 | + die(); |
|
20 | 20 | } |
21 | 21 | if (!isset($globalACARSHost) || !isset($globalACARSPort) || $globalACARSHost == '' || $globalACARSPort == '') { |
22 | - echo 'You MUST define $globalACARSHost and $globalACARSPort in require/settings.php'; |
|
23 | - die(); |
|
22 | + echo 'You MUST define $globalACARSHost and $globalACARSPort in require/settings.php'; |
|
23 | + die(); |
|
24 | 24 | } |
25 | 25 | |
26 | 26 | $ACARS=new ACARS(null,true); |
27 | 27 | date_default_timezone_set('UTC'); |
28 | 28 | // signal handler - playing nice with sockets and dump1090 |
29 | 29 | pcntl_signal(SIGINT, function($signo) { |
30 | - global $sock; |
|
31 | - echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
32 | - socket_shutdown($sock, 0); |
|
33 | - socket_close($sock); |
|
34 | - die("Bye!\n"); |
|
30 | + global $sock; |
|
31 | + echo "\n\nctrl-c or kill signal received. Tidying up ... "; |
|
32 | + socket_shutdown($sock, 0); |
|
33 | + socket_close($sock); |
|
34 | + die("Bye!\n"); |
|
35 | 35 | }); |
36 | 36 | pcntl_signal_dispatch(); |
37 | 37 | |
@@ -44,24 +44,24 @@ discard block |
||
44 | 44 | // Bind the source address |
45 | 45 | if( !socket_bind($sock, $globalACARSHost , $globalACARSPort) ) |
46 | 46 | { |
47 | - $errorcode = socket_last_error(); |
|
48 | - $errormsg = socket_strerror($errorcode); |
|
47 | + $errorcode = socket_last_error(); |
|
48 | + $errormsg = socket_strerror($errorcode); |
|
49 | 49 | |
50 | - die("Could not bind socket : [$errorcode] $errormsg \n"); |
|
50 | + die("Could not bind socket : [$errorcode] $errormsg \n"); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | if ($globalDebug) echo "LISTEN UDP MODE \n\n"; |
54 | 54 | while(1) { |
55 | - $r = socket_recvfrom($sock, $buffer, 512, 0, $remote_ip, $remote_port); |
|
55 | + $r = socket_recvfrom($sock, $buffer, 512, 0, $remote_ip, $remote_port); |
|
56 | 56 | |
57 | - // lets play nice and handle signals such as ctrl-c/kill properly |
|
58 | - pcntl_signal_dispatch(); |
|
59 | - $dataFound = false; |
|
60 | - // (null) 2 23/02/2015 14:46:06 0 -16 X .D-AIPW ! 1L 7 M82A LH077P 010952342854:VP-MIBI+W+0)-V+(),GB1 |
|
61 | - if ($globalDebug) echo $buffer."\n"; |
|
62 | - $ACARS->add(trim($buffer)); |
|
63 | - socket_sendto($sock, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
64 | - $ACARS->deleteLiveAcarsData(); |
|
57 | + // lets play nice and handle signals such as ctrl-c/kill properly |
|
58 | + pcntl_signal_dispatch(); |
|
59 | + $dataFound = false; |
|
60 | + // (null) 2 23/02/2015 14:46:06 0 -16 X .D-AIPW ! 1L 7 M82A LH077P 010952342854:VP-MIBI+W+0)-V+(),GB1 |
|
61 | + if ($globalDebug) echo $buffer."\n"; |
|
62 | + $ACARS->add(trim($buffer)); |
|
63 | + socket_sendto($sock, "OK " . $buffer , 100 , 0 , $remote_ip , $remote_port); |
|
64 | + $ACARS->deleteLiveAcarsData(); |
|
65 | 65 | } |
66 | 66 | pcntl_exec($_,$argv); |
67 | 67 | ?> |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | <meta property="og:site_name" content="<?php print $globalName; ?>"/> |
46 | 46 | |
47 | 47 | <?php |
48 | - if (!isset($_SESSION['install']) && !isset($_POST['dbtype'])) { |
|
48 | + if (!isset($_SESSION['install']) && !isset($_POST['dbtype'])) { |
|
49 | 49 | ?> |
50 | 50 | <script language="JavaScript" type="text/javascript"> |
51 | 51 | function datasource_js() { |
@@ -154,22 +154,22 @@ discard block |
||
154 | 154 | } |
155 | 155 | </script> |
156 | 156 | <?php |
157 | - } |
|
157 | + } |
|
158 | 158 | ?> |
159 | 159 | |
160 | 160 | </head> |
161 | 161 | |
162 | 162 | <?php |
163 | - if (!isset($_SESSION['install']) && !isset($_POST['dbtype']) && isset($_SESSION['identified'])) { |
|
163 | + if (!isset($_SESSION['install']) && !isset($_POST['dbtype']) && isset($_SESSION['identified'])) { |
|
164 | 164 | ?> |
165 | 165 | |
166 | 166 | <body class="page-<?php print strtolower($current_page); ?>" onload="datasource_js(); metarcycle_js(); create_database_js(); daemon_js(); schedule_js()"> |
167 | 167 | <?php |
168 | - } else { |
|
168 | + } else { |
|
169 | 169 | ?> |
170 | 170 | <body class="page-<?php print strtolower($current_page); ?>"> |
171 | 171 | <?php |
172 | - } |
|
172 | + } |
|
173 | 173 | ?> |
174 | 174 | <div class="navbar navbar-fixed-top" role="navigation"> |
175 | 175 | <div class="container"> |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | <a class="navbar-brand" href="../"><img src="<?php print '../'.$logoURL; ?>" height="30px" /></a> |
184 | 184 | </div> |
185 | 185 | <?php |
186 | - if (!isset($_SESSION['install']) && !isset($_POST['dbtype']) && isset($_SESSION['identified'])) { |
|
186 | + if (!isset($_SESSION['install']) && !isset($_POST['dbtype']) && isset($_SESSION['identified'])) { |
|
187 | 187 | ?> |
188 | 188 | <div class="collapse navbar-collapse"> |
189 | 189 | <ul class="nav navbar-nav"> |
@@ -213,19 +213,19 @@ discard block |
||
213 | 213 | </ul> |
214 | 214 | </div> |
215 | 215 | <?php |
216 | - } |
|
216 | + } |
|
217 | 217 | ?> |
218 | 218 | </div> |
219 | 219 | </div> |
220 | 220 | |
221 | 221 | <?php |
222 | 222 | if (isset($top_header)) { |
223 | - if ($top_header != "") |
|
224 | - { |
|
223 | + if ($top_header != "") |
|
224 | + { |
|
225 | 225 | print '<div class="top-header container clear" role="main">'; |
226 | 226 | print '<img src="../images/'.$top_header.'" alt="'.$title.'" title="'.$title.'" />'; |
227 | 227 | print '</div>'; |
228 | - } |
|
228 | + } |
|
229 | 229 | } |
230 | 230 | ?> |
231 | 231 |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | }; |
449 | 449 | |
450 | 450 | <?php |
451 | - if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) { |
|
451 | + if (isset($globalTSK) && $globalTSK && isset($_GET['tsk'])) { |
|
452 | 452 | ?> |
453 | 453 | function tskPopup (feature, layer) { |
454 | 454 | var output = ''; |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | }; |
484 | 484 | update_tsk(); |
485 | 485 | <?php |
486 | - } |
|
486 | + } |
|
487 | 487 | ?> |
488 | 488 | map.on('moveend', function() { |
489 | 489 | if (map.hasLayer(locationsLayer) == true) { |
@@ -504,10 +504,10 @@ discard block |
||
504 | 504 | update_santaLayer(false); |
505 | 505 | } |
506 | 506 | <?php |
507 | - // Add support for custom json via $globalMapJson |
|
508 | - if (isset($globalMapJson) && is_array($globalMapJson)) { |
|
507 | + // Add support for custom json via $globalMapJson |
|
508 | + if (isset($globalMapJson) && is_array($globalMapJson)) { |
|
509 | 509 | foreach ($globalMapJson as $json) { |
510 | - if (isset($json['url'])) { |
|
510 | + if (isset($json['url'])) { |
|
511 | 511 | ?> |
512 | 512 | update_genLayer('<?php print $json['url']; ?>'); |
513 | 513 | <?php |
@@ -516,9 +516,9 @@ discard block |
||
516 | 516 | setInterval(function(){if (noTimeout) update_genLayer('<?php print $json['url']; ?>')}, <?php print $json['refresh']; ?>); |
517 | 517 | <?php |
518 | 518 | } |
519 | - } |
|
519 | + } |
|
520 | + } |
|
520 | 521 | } |
521 | - } |
|
522 | 522 | |
523 | 523 | ?> |
524 | 524 | //adds the bootstrap tooltip to the map icons |