@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | require_once('require/class.Spotter.php'); |
4 | 4 | require_once('require/class.Language.php'); |
5 | 5 | if (!isset($_GET['country'])) { |
6 | - header('Location: '.$globalURL.'/country'); |
|
7 | - die(); |
|
6 | + header('Location: '.$globalURL.'/country'); |
|
7 | + die(); |
|
8 | 8 | } |
9 | 9 | $Spotter = new Spotter(); |
10 | 10 | $country = ucwords(str_replace("-", " ", filter_input(INPUT_GET,'country',FILTER_SANITIZE_STRING))); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | include('country-sub-menu.php'); |
52 | 52 | print '<div class="column">'; |
53 | 53 | print '<h2>'._("Most Common Arrival Airports by Country").'</h2>'; |
54 | - print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights of airports & airlines from <strong>%s</strong>."),$country).'</p>'; |
|
54 | + print '<p>'.sprintf(_("The statistic below shows all arrival airports by Country of origin of flights of airports & airlines from <strong>%s</strong>."),$country).'</p>'; |
|
55 | 55 | |
56 | 56 | $airport_country_array = $Spotter->countAllArrivalAirportCountriesByCountry($country); |
57 | 57 | print '<script type="text/javascript" src="'.$globalURL.'/js/d3.min.js"></script>'; |
@@ -7,13 +7,13 @@ discard block |
||
7 | 7 | //protected $cookies = array(); |
8 | 8 | |
9 | 9 | /** |
10 | - * Get data from form result |
|
11 | - * @param String $url form URL |
|
12 | - * @param String $type type of submit form method (get or post) |
|
13 | - * @param String|Array $data values form post method |
|
14 | - * @param Array $headers header to submit with the form |
|
15 | - * @return String the result |
|
16 | - */ |
|
10 | + * Get data from form result |
|
11 | + * @param String $url form URL |
|
12 | + * @param String $type type of submit form method (get or post) |
|
13 | + * @param String|Array $data values form post method |
|
14 | + * @param Array $headers header to submit with the form |
|
15 | + * @return String the result |
|
16 | + */ |
|
17 | 17 | public function getData($url, $type = 'get', $data = '', $headers = '',$cookie = '',$referer = '',$timeout = '',$useragent = '') { |
18 | 18 | global $globalProxy, $globalForceIPv4; |
19 | 19 | $ch = curl_init(); |
@@ -107,10 +107,10 @@ discard block |
||
107 | 107 | } |
108 | 108 | |
109 | 109 | /** |
110 | - * Convert a HTML table to an array |
|
111 | - * @param String $data HTML page |
|
112 | - * @return Array array of the tables in HTML page |
|
113 | - */ |
|
110 | + * Convert a HTML table to an array |
|
111 | + * @param String $data HTML page |
|
112 | + * @return Array array of the tables in HTML page |
|
113 | + */ |
|
114 | 114 | public function table2array($data) { |
115 | 115 | if (!is_string($data)) return array(); |
116 | 116 | if ($data == '') return array(); |
@@ -144,10 +144,10 @@ discard block |
||
144 | 144 | } |
145 | 145 | |
146 | 146 | /** |
147 | - * Convert <p> part of a HTML page to an array |
|
148 | - * @param String $data HTML page |
|
149 | - * @return Array array of the <p> in HTML page |
|
150 | - */ |
|
147 | + * Convert <p> part of a HTML page to an array |
|
148 | + * @param String $data HTML page |
|
149 | + * @return Array array of the <p> in HTML page |
|
150 | + */ |
|
151 | 151 | public function text2array($data) { |
152 | 152 | $html = str_get_html($data); |
153 | 153 | if ($html === false) return array(); |
@@ -162,14 +162,14 @@ discard block |
||
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
165 | - * Give distance between 2 coordonnates |
|
166 | - * @param Float $lat latitude of first point |
|
167 | - * @param Float $lon longitude of first point |
|
168 | - * @param Float $latc latitude of second point |
|
169 | - * @param Float $lonc longitude of second point |
|
170 | - * @param String $unit km else no unit used |
|
171 | - * @return Float Distance in $unit |
|
172 | - */ |
|
165 | + * Give distance between 2 coordonnates |
|
166 | + * @param Float $lat latitude of first point |
|
167 | + * @param Float $lon longitude of first point |
|
168 | + * @param Float $latc latitude of second point |
|
169 | + * @param Float $lonc longitude of second point |
|
170 | + * @param String $unit km else no unit used |
|
171 | + * @return Float Distance in $unit |
|
172 | + */ |
|
173 | 173 | public function distance($lat, $lon, $latc, $lonc, $unit = 'km') { |
174 | 174 | if ($lat == $latc && $lon == $lonc) return 0; |
175 | 175 | $dist = rad2deg(acos(sin(deg2rad(floatval($lat)))*sin(deg2rad(floatval($latc)))+ cos(deg2rad(floatval($lat)))*cos(deg2rad(floatval($latc)))*cos(deg2rad(floatval($lon)-floatval($lonc)))))*60*1.1515; |
@@ -187,11 +187,11 @@ discard block |
||
187 | 187 | } |
188 | 188 | |
189 | 189 | /** |
190 | - * Check is distance realistic |
|
191 | - * @param int $timeDifference the time between the reception of both messages |
|
192 | - * @param float $distance distance covered |
|
193 | - * @return whether distance is realistic |
|
194 | - */ |
|
190 | + * Check is distance realistic |
|
191 | + * @param int $timeDifference the time between the reception of both messages |
|
192 | + * @param float $distance distance covered |
|
193 | + * @return whether distance is realistic |
|
194 | + */ |
|
195 | 195 | public function withinThreshold ($timeDifference, $distance) { |
196 | 196 | $x = abs($timeDifference); |
197 | 197 | $d = abs($distance); |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } |
210 | 210 | |
211 | 211 | public function isInteger($input){ |
212 | - return(ctype_digit(strval($input))); |
|
212 | + return(ctype_digit(strval($input))); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | |
@@ -240,11 +240,11 @@ discard block |
||
240 | 240 | } |
241 | 241 | |
242 | 242 | /** |
243 | - * Copy folder contents |
|
244 | - * @param string $source Source path |
|
245 | - * @param string $dest Destination path |
|
246 | - * @return bool Returns true on success, false on failure |
|
247 | - */ |
|
243 | + * Copy folder contents |
|
244 | + * @param string $source Source path |
|
245 | + * @param string $dest Destination path |
|
246 | + * @return bool Returns true on success, false on failure |
|
247 | + */ |
|
248 | 248 | public function xcopy($source, $dest) |
249 | 249 | { |
250 | 250 | $files = glob($source.'*.*'); |
@@ -256,20 +256,20 @@ discard block |
||
256 | 256 | } |
257 | 257 | |
258 | 258 | /** |
259 | - * Check if an url exist |
|
260 | - * @param String $url url to check |
|
261 | - * @return bool Return true on succes false on failure |
|
262 | - */ |
|
259 | + * Check if an url exist |
|
260 | + * @param String $url url to check |
|
261 | + * @return bool Return true on succes false on failure |
|
262 | + */ |
|
263 | 263 | public function urlexist($url){ |
264 | 264 | $headers=get_headers($url); |
265 | 265 | return stripos($headers[0],"200 OK")?true:false; |
266 | 266 | } |
267 | 267 | |
268 | 268 | /** |
269 | - * Convert hexa to string |
|
270 | - * @param String $hex data in hexa |
|
271 | - * @return String Return result |
|
272 | - */ |
|
269 | + * Convert hexa to string |
|
270 | + * @param String $hex data in hexa |
|
271 | + * @return String Return result |
|
272 | + */ |
|
273 | 273 | public function hex2str($hex) { |
274 | 274 | $str = ''; |
275 | 275 | $hexln = strlen($hex); |
@@ -278,10 +278,10 @@ discard block |
||
278 | 278 | } |
279 | 279 | |
280 | 280 | /** |
281 | - * Convert hexa color to rgb |
|
282 | - * @param String $hex data in hexa |
|
283 | - * @return String Return result |
|
284 | - */ |
|
281 | + * Convert hexa color to rgb |
|
282 | + * @param String $hex data in hexa |
|
283 | + * @return String Return result |
|
284 | + */ |
|
285 | 285 | public function hex2rgb($hex) { |
286 | 286 | $hex = str_replace('#','',$hex); |
287 | 287 | return sscanf($hex, "%02x%02x%02x"); |
@@ -359,9 +359,9 @@ discard block |
||
359 | 359 | } |
360 | 360 | |
361 | 361 | /** |
362 | - * Returns list of available locales |
|
363 | - * |
|
364 | - * @return array |
|
362 | + * Returns list of available locales |
|
363 | + * |
|
364 | + * @return array |
|
365 | 365 | */ |
366 | 366 | public function listLocaleDir() |
367 | 367 | { |
@@ -456,100 +456,100 @@ discard block |
||
456 | 456 | public function remove_accents($string) { |
457 | 457 | if ( !preg_match('/[\x80-\xff]/', $string) ) return $string; |
458 | 458 | $chars = array( |
459 | - // Decompositions for Latin-1 Supplement |
|
460 | - chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
|
461 | - chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', |
|
462 | - chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', |
|
463 | - chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', |
|
464 | - chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', |
|
465 | - chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', |
|
466 | - chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', |
|
467 | - chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', |
|
468 | - chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', |
|
469 | - chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', |
|
470 | - chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', |
|
471 | - chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', |
|
472 | - chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', |
|
473 | - chr(195).chr(159) => 's', chr(195).chr(160) => 'a', |
|
474 | - chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', |
|
475 | - chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', |
|
476 | - chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', |
|
477 | - chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', |
|
478 | - chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', |
|
479 | - chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', |
|
480 | - chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', |
|
481 | - chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', |
|
482 | - chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', |
|
483 | - chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', |
|
484 | - chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', |
|
485 | - chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', |
|
486 | - chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', |
|
487 | - chr(195).chr(191) => 'y', |
|
488 | - // Decompositions for Latin Extended-A |
|
489 | - chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', |
|
490 | - chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', |
|
491 | - chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', |
|
492 | - chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', |
|
493 | - chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', |
|
494 | - chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', |
|
495 | - chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', |
|
496 | - chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', |
|
497 | - chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', |
|
498 | - chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', |
|
499 | - chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', |
|
500 | - chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', |
|
501 | - chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', |
|
502 | - chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', |
|
503 | - chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', |
|
504 | - chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', |
|
505 | - chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', |
|
506 | - chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', |
|
507 | - chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', |
|
508 | - chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', |
|
509 | - chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', |
|
510 | - chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', |
|
511 | - chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
|
512 | - chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
|
513 | - chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
|
514 | - chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
515 | - chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
|
516 | - chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
|
517 | - chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
|
518 | - chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', |
|
519 | - chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', |
|
520 | - chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', |
|
521 | - chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', |
|
522 | - chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', |
|
523 | - chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', |
|
524 | - chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', |
|
525 | - chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', |
|
526 | - chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', |
|
527 | - chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
|
528 | - chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
|
529 | - chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
|
530 | - chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
531 | - chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
532 | - chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
533 | - chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
534 | - chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
535 | - chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
536 | - chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
537 | - chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
|
538 | - chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
|
539 | - chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
|
540 | - chr(197).chr(166) => 'T', chr(197).chr(167) => 't', |
|
541 | - chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', |
|
542 | - chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', |
|
543 | - chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', |
|
544 | - chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', |
|
545 | - chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', |
|
546 | - chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', |
|
547 | - chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', |
|
548 | - chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', |
|
549 | - chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', |
|
550 | - chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', |
|
551 | - chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', |
|
552 | - chr(197).chr(190) => 'z', chr(197).chr(191) => 's' |
|
459 | + // Decompositions for Latin-1 Supplement |
|
460 | + chr(195).chr(128) => 'A', chr(195).chr(129) => 'A', |
|
461 | + chr(195).chr(130) => 'A', chr(195).chr(131) => 'A', |
|
462 | + chr(195).chr(132) => 'A', chr(195).chr(133) => 'A', |
|
463 | + chr(195).chr(135) => 'C', chr(195).chr(136) => 'E', |
|
464 | + chr(195).chr(137) => 'E', chr(195).chr(138) => 'E', |
|
465 | + chr(195).chr(139) => 'E', chr(195).chr(140) => 'I', |
|
466 | + chr(195).chr(141) => 'I', chr(195).chr(142) => 'I', |
|
467 | + chr(195).chr(143) => 'I', chr(195).chr(145) => 'N', |
|
468 | + chr(195).chr(146) => 'O', chr(195).chr(147) => 'O', |
|
469 | + chr(195).chr(148) => 'O', chr(195).chr(149) => 'O', |
|
470 | + chr(195).chr(150) => 'O', chr(195).chr(153) => 'U', |
|
471 | + chr(195).chr(154) => 'U', chr(195).chr(155) => 'U', |
|
472 | + chr(195).chr(156) => 'U', chr(195).chr(157) => 'Y', |
|
473 | + chr(195).chr(159) => 's', chr(195).chr(160) => 'a', |
|
474 | + chr(195).chr(161) => 'a', chr(195).chr(162) => 'a', |
|
475 | + chr(195).chr(163) => 'a', chr(195).chr(164) => 'a', |
|
476 | + chr(195).chr(165) => 'a', chr(195).chr(167) => 'c', |
|
477 | + chr(195).chr(168) => 'e', chr(195).chr(169) => 'e', |
|
478 | + chr(195).chr(170) => 'e', chr(195).chr(171) => 'e', |
|
479 | + chr(195).chr(172) => 'i', chr(195).chr(173) => 'i', |
|
480 | + chr(195).chr(174) => 'i', chr(195).chr(175) => 'i', |
|
481 | + chr(195).chr(177) => 'n', chr(195).chr(178) => 'o', |
|
482 | + chr(195).chr(179) => 'o', chr(195).chr(180) => 'o', |
|
483 | + chr(195).chr(181) => 'o', chr(195).chr(182) => 'o', |
|
484 | + chr(195).chr(182) => 'o', chr(195).chr(185) => 'u', |
|
485 | + chr(195).chr(186) => 'u', chr(195).chr(187) => 'u', |
|
486 | + chr(195).chr(188) => 'u', chr(195).chr(189) => 'y', |
|
487 | + chr(195).chr(191) => 'y', |
|
488 | + // Decompositions for Latin Extended-A |
|
489 | + chr(196).chr(128) => 'A', chr(196).chr(129) => 'a', |
|
490 | + chr(196).chr(130) => 'A', chr(196).chr(131) => 'a', |
|
491 | + chr(196).chr(132) => 'A', chr(196).chr(133) => 'a', |
|
492 | + chr(196).chr(134) => 'C', chr(196).chr(135) => 'c', |
|
493 | + chr(196).chr(136) => 'C', chr(196).chr(137) => 'c', |
|
494 | + chr(196).chr(138) => 'C', chr(196).chr(139) => 'c', |
|
495 | + chr(196).chr(140) => 'C', chr(196).chr(141) => 'c', |
|
496 | + chr(196).chr(142) => 'D', chr(196).chr(143) => 'd', |
|
497 | + chr(196).chr(144) => 'D', chr(196).chr(145) => 'd', |
|
498 | + chr(196).chr(146) => 'E', chr(196).chr(147) => 'e', |
|
499 | + chr(196).chr(148) => 'E', chr(196).chr(149) => 'e', |
|
500 | + chr(196).chr(150) => 'E', chr(196).chr(151) => 'e', |
|
501 | + chr(196).chr(152) => 'E', chr(196).chr(153) => 'e', |
|
502 | + chr(196).chr(154) => 'E', chr(196).chr(155) => 'e', |
|
503 | + chr(196).chr(156) => 'G', chr(196).chr(157) => 'g', |
|
504 | + chr(196).chr(158) => 'G', chr(196).chr(159) => 'g', |
|
505 | + chr(196).chr(160) => 'G', chr(196).chr(161) => 'g', |
|
506 | + chr(196).chr(162) => 'G', chr(196).chr(163) => 'g', |
|
507 | + chr(196).chr(164) => 'H', chr(196).chr(165) => 'h', |
|
508 | + chr(196).chr(166) => 'H', chr(196).chr(167) => 'h', |
|
509 | + chr(196).chr(168) => 'I', chr(196).chr(169) => 'i', |
|
510 | + chr(196).chr(170) => 'I', chr(196).chr(171) => 'i', |
|
511 | + chr(196).chr(172) => 'I', chr(196).chr(173) => 'i', |
|
512 | + chr(196).chr(174) => 'I', chr(196).chr(175) => 'i', |
|
513 | + chr(196).chr(176) => 'I', chr(196).chr(177) => 'i', |
|
514 | + chr(196).chr(178) => 'IJ',chr(196).chr(179) => 'ij', |
|
515 | + chr(196).chr(180) => 'J', chr(196).chr(181) => 'j', |
|
516 | + chr(196).chr(182) => 'K', chr(196).chr(183) => 'k', |
|
517 | + chr(196).chr(184) => 'k', chr(196).chr(185) => 'L', |
|
518 | + chr(196).chr(186) => 'l', chr(196).chr(187) => 'L', |
|
519 | + chr(196).chr(188) => 'l', chr(196).chr(189) => 'L', |
|
520 | + chr(196).chr(190) => 'l', chr(196).chr(191) => 'L', |
|
521 | + chr(197).chr(128) => 'l', chr(197).chr(129) => 'L', |
|
522 | + chr(197).chr(130) => 'l', chr(197).chr(131) => 'N', |
|
523 | + chr(197).chr(132) => 'n', chr(197).chr(133) => 'N', |
|
524 | + chr(197).chr(134) => 'n', chr(197).chr(135) => 'N', |
|
525 | + chr(197).chr(136) => 'n', chr(197).chr(137) => 'N', |
|
526 | + chr(197).chr(138) => 'n', chr(197).chr(139) => 'N', |
|
527 | + chr(197).chr(140) => 'O', chr(197).chr(141) => 'o', |
|
528 | + chr(197).chr(142) => 'O', chr(197).chr(143) => 'o', |
|
529 | + chr(197).chr(144) => 'O', chr(197).chr(145) => 'o', |
|
530 | + chr(197).chr(146) => 'OE',chr(197).chr(147) => 'oe', |
|
531 | + chr(197).chr(148) => 'R',chr(197).chr(149) => 'r', |
|
532 | + chr(197).chr(150) => 'R',chr(197).chr(151) => 'r', |
|
533 | + chr(197).chr(152) => 'R',chr(197).chr(153) => 'r', |
|
534 | + chr(197).chr(154) => 'S',chr(197).chr(155) => 's', |
|
535 | + chr(197).chr(156) => 'S',chr(197).chr(157) => 's', |
|
536 | + chr(197).chr(158) => 'S',chr(197).chr(159) => 's', |
|
537 | + chr(197).chr(160) => 'S', chr(197).chr(161) => 's', |
|
538 | + chr(197).chr(162) => 'T', chr(197).chr(163) => 't', |
|
539 | + chr(197).chr(164) => 'T', chr(197).chr(165) => 't', |
|
540 | + chr(197).chr(166) => 'T', chr(197).chr(167) => 't', |
|
541 | + chr(197).chr(168) => 'U', chr(197).chr(169) => 'u', |
|
542 | + chr(197).chr(170) => 'U', chr(197).chr(171) => 'u', |
|
543 | + chr(197).chr(172) => 'U', chr(197).chr(173) => 'u', |
|
544 | + chr(197).chr(174) => 'U', chr(197).chr(175) => 'u', |
|
545 | + chr(197).chr(176) => 'U', chr(197).chr(177) => 'u', |
|
546 | + chr(197).chr(178) => 'U', chr(197).chr(179) => 'u', |
|
547 | + chr(197).chr(180) => 'W', chr(197).chr(181) => 'w', |
|
548 | + chr(197).chr(182) => 'Y', chr(197).chr(183) => 'y', |
|
549 | + chr(197).chr(184) => 'Y', chr(197).chr(185) => 'Z', |
|
550 | + chr(197).chr(186) => 'z', chr(197).chr(187) => 'Z', |
|
551 | + chr(197).chr(188) => 'z', chr(197).chr(189) => 'Z', |
|
552 | + chr(197).chr(190) => 'z', chr(197).chr(191) => 's' |
|
553 | 553 | ); |
554 | 554 | $string = strtr($string, $chars); |
555 | 555 | return $string; |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | date_default_timezone_set('UTC'); |
28 | 28 | //waypoint plotting |
29 | 29 | $output .= '{"type": "Feature",'; |
30 | - $output .= '"properties": {'; |
|
30 | + $output .= '"properties": {'; |
|
31 | 31 | $output .= '"name": "'.str_replace('"',"'",$spotter_item['name']).'",'; |
32 | 32 | $output .= '"city": "'.str_replace('"',"'",$spotter_item['city']).'",'; |
33 | 33 | $output .= '"country": "'.$spotter_item['country'].'",'; |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | $output .= '"homepage": "'.$spotter_item['home_link'].'",'; |
51 | 51 | $output .= '"image_thumb": "'.$spotter_item['image_thumb'].'"'; |
52 | 52 | // $output .= '"photo": "'.$spotter_item['image_thumbnail'].'",'; |
53 | - $output .= '},'; |
|
54 | - $output .= '"geometry": {'; |
|
53 | + $output .= '},'; |
|
54 | + $output .= '"geometry": {'; |
|
55 | 55 | $output .= '"type": "Point",'; |
56 | 56 | $output .= '"coordinates": ['; |
57 | - $output .= $spotter_item['longitude'].', '.$spotter_item['latitude']; |
|
57 | + $output .= $spotter_item['longitude'].', '.$spotter_item['latitude']; |
|
58 | 58 | $output .= ']'; |
59 | - $output .= '}'; |
|
59 | + $output .= '}'; |
|
60 | 60 | $output .= '},'; |
61 | 61 | } |
62 | 62 | $output = substr($output, 0, -1); |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | require_once('require/class.Stats.php'); |
5 | 5 | require_once('require/class.Language.php'); |
6 | 6 | if (!isset($_GET['airline'])) { |
7 | - header('Location: '.$globalURL.'/airline'); |
|
8 | - die(); |
|
7 | + header('Location: '.$globalURL.'/airline'); |
|
8 | + die(); |
|
9 | 9 | } |
10 | 10 | $airline = filter_input(INPUT_GET,'airline',FILTER_SANITIZE_STRING); |
11 | 11 | $Spotter = new Spotter(); |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | } |
77 | 77 | $country_data = substr($country_data, 0, -1); |
78 | 78 | print $country_data; |
79 | - print '];'; |
|
80 | - print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
81 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);'; |
|
82 | - print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});'; |
|
83 | - print 'new Datamap({ |
|
79 | + print '];'; |
|
80 | + print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
81 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);'; |
|
82 | + print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});'; |
|
83 | + print 'new Datamap({ |
|
84 | 84 | element: document.getElementById("chartCountry"), |
85 | 85 | projection: "mercator", // big world map |
86 | 86 | fills: { defaultFill: "#F5F5F5" }, |
@@ -21,18 +21,18 @@ discard block |
||
21 | 21 | print '<div class="select-item">'; |
22 | 22 | print '<form action="'.$globalURL.'/aircraft" method="post">'; |
23 | 23 | print '<select name="aircraft_type" class="selectpicker" data-live-search="true">'; |
24 | - print '<option></option>'; |
|
25 | - $Stats = new Stats(); |
|
26 | - $aircraft_types = $Stats->getAllAircraftTypes(); |
|
27 | - if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
28 | - foreach($aircraft_types as $aircrafttype) |
|
29 | - { |
|
30 | - if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
31 | - { |
|
32 | - print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
33 | - } else { |
|
34 | - print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
35 | - } |
|
24 | + print '<option></option>'; |
|
25 | + $Stats = new Stats(); |
|
26 | + $aircraft_types = $Stats->getAllAircraftTypes(); |
|
27 | + if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
28 | + foreach($aircraft_types as $aircrafttype) |
|
29 | + { |
|
30 | + if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
31 | + { |
|
32 | + print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
33 | + } else { |
|
34 | + print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | print '</select>'; |
38 | 38 | print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>'; |
@@ -61,18 +61,18 @@ discard block |
||
61 | 61 | print '<script type="text/javascript" src="'.$globalURL.'/js/datamaps.world.min.js"></script>'; |
62 | 62 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
63 | 63 | print 'var series = ['; |
64 | - $country_data = ''; |
|
64 | + $country_data = ''; |
|
65 | 65 | foreach($airline_array as $airline_item) |
66 | 66 | { |
67 | 67 | $country_data .= '[ "'.$airline_item['airline_country_iso3'].'",'.$airline_item['airline_country_count'].'],'; |
68 | 68 | } |
69 | - $country_data = substr($country_data, 0, -1); |
|
70 | - print $country_data; |
|
71 | - print '];'; |
|
72 | - print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
73 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);'; |
|
74 | - print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});'; |
|
75 | - print 'new Datamap({ |
|
69 | + $country_data = substr($country_data, 0, -1); |
|
70 | + print $country_data; |
|
71 | + print '];'; |
|
72 | + print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
73 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);'; |
|
74 | + print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});'; |
|
75 | + print 'new Datamap({ |
|
76 | 76 | element: document.getElementById("chartCountry"), |
77 | 77 | projection: "mercator", // big world map |
78 | 78 | fills: { defaultFill: "#F5F5F5" }, |
@@ -2,10 +2,10 @@ discard block |
||
2 | 2 | require_once(dirname(__FILE__).'/settings.php'); |
3 | 3 | require_once(dirname(__FILE__).'/class.Common.php'); |
4 | 4 | class aprs { |
5 | - private $socket; |
|
6 | - private $connected = false; |
|
5 | + private $socket; |
|
6 | + private $connected = false; |
|
7 | 7 | |
8 | - protected $symbols = array('!' => 'Police', |
|
8 | + protected $symbols = array('!' => 'Police', |
|
9 | 9 | '#' => 'DIGI', |
10 | 10 | '$' => 'Phone', |
11 | 11 | '%' => 'DX Cluster', |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | 'y' => 'Yagi At QTH'); |
90 | 90 | |
91 | 91 | |
92 | - private function urshift($n, $s) { |
|
92 | + private function urshift($n, $s) { |
|
93 | 93 | return ($n >= 0) ? ($n >> $s) : |
94 | - (($n & 0x7fffffff) >> $s) | |
|
94 | + (($n & 0x7fffffff) >> $s) | |
|
95 | 95 | (0x40000000 >> ($s - 1)); |
96 | - } |
|
96 | + } |
|
97 | 97 | |
98 | - public function parse($input) { |
|
98 | + public function parse($input) { |
|
99 | 99 | global $globalDebug; |
100 | 100 | $debug = false; |
101 | 101 | $result = array(); |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | |
108 | 108 | /* Check that end was found and body has at least one byte. */ |
109 | 109 | if ($splitpos == 0 || $splitpos + 1 == $input_len || $splitpos === FALSE) { |
110 | - if ($globalDebug) echo '!!! APRS invalid : '.$input."\n"; |
|
111 | - return false; |
|
110 | + if ($globalDebug) echo '!!! APRS invalid : '.$input."\n"; |
|
111 | + return false; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | if ($debug) echo 'input : '.$input."\n"; |
@@ -122,31 +122,31 @@ discard block |
||
122 | 122 | /* Parse source, target and path. */ |
123 | 123 | //FLRDF0A52>APRS,qAS,LSTB |
124 | 124 | if (preg_match('/^([A-Z0-9\\-]{1,9})>(.*)$/',$header,$matches)) { |
125 | - $ident = $matches[1]; |
|
126 | - $all_elements = $matches[2]; |
|
127 | - if ($ident == 'AIRCRAFT') { |
|
125 | + $ident = $matches[1]; |
|
126 | + $all_elements = $matches[2]; |
|
127 | + if ($ident == 'AIRCRAFT') { |
|
128 | 128 | $result['format_source'] = 'famaprs'; |
129 | 129 | $result['source_type'] = 'modes'; |
130 | - } elseif ($ident == 'MARINE') { |
|
130 | + } elseif ($ident == 'MARINE') { |
|
131 | 131 | $result['format_source'] = 'famaprs'; |
132 | 132 | $result['source_type'] = 'ais'; |
133 | - } else { |
|
133 | + } else { |
|
134 | 134 | if ($debug) echo 'ident : '.$ident."\n"; |
135 | 135 | $result['ident'] = $ident; |
136 | - } |
|
136 | + } |
|
137 | 137 | } else return false; |
138 | 138 | $elements = explode(',',$all_elements); |
139 | 139 | $source = end($elements); |
140 | 140 | $result['source'] = $source; |
141 | 141 | foreach ($elements as $element) { |
142 | - if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) { |
|
143 | - //echo "ok"; |
|
144 | - //if ($element == 'TCPIP*') return false; |
|
145 | - } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
|
142 | + if (preg_match('/^([a-zA-Z0-9-]{1,9})([*]?)$/',$element)) { |
|
143 | + //echo "ok"; |
|
144 | + //if ($element == 'TCPIP*') return false; |
|
145 | + } elseif (!preg_match('/^([0-9A-F]{32})$/',$element)) { |
|
146 | 146 | if ($debug) echo 'element : '.$element."\n"; |
147 | 147 | return false; |
148 | - } |
|
149 | - /* |
|
148 | + } |
|
149 | + /* |
|
150 | 150 | } elseif (preg_match('/^([0-9A-F]{32})$/',$element)) { |
151 | 151 | //echo "ok"; |
152 | 152 | } else { |
@@ -173,49 +173,49 @@ discard block |
||
173 | 173 | $body_parse = substr($body,1); |
174 | 174 | //echo 'Body : '.$body."\n"; |
175 | 175 | if (preg_match('/^;(.){9}\*/',$body,$matches)) { |
176 | - $body_parse = substr($body_parse,10); |
|
177 | - $find = true; |
|
178 | - //echo $body_parse."\n"; |
|
176 | + $body_parse = substr($body_parse,10); |
|
177 | + $find = true; |
|
178 | + //echo $body_parse."\n"; |
|
179 | 179 | } |
180 | 180 | if (preg_match('/^`(.*)\//',$body,$matches)) { |
181 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
182 | - $find = true; |
|
183 | - //echo $body_parse."\n"; |
|
181 | + $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
182 | + $find = true; |
|
183 | + //echo $body_parse."\n"; |
|
184 | 184 | } |
185 | 185 | if (preg_match("/^'(.*)\//",$body,$matches)) { |
186 | - $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
187 | - $find = true; |
|
188 | - //echo $body_parse."\n"; |
|
186 | + $body_parse = substr($body_parse,strlen($matches[1])-1); |
|
187 | + $find = true; |
|
188 | + //echo $body_parse."\n"; |
|
189 | 189 | } |
190 | 190 | if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([zh\\/])/',$body_parse,$matches)) { |
191 | - $find = true; |
|
192 | - //print_r($matches); |
|
193 | - $timestamp = $matches[0]; |
|
194 | - if ($matches[4] == 'h') { |
|
191 | + $find = true; |
|
192 | + //print_r($matches); |
|
193 | + $timestamp = $matches[0]; |
|
194 | + if ($matches[4] == 'h') { |
|
195 | 195 | $timestamp = strtotime(date('Ymd').' '.$matches[1].':'.$matches[2].':'.$matches[3]); |
196 | 196 | //echo 'timestamp : '.$timestamp.' - now : '.time()."\n"; |
197 | 197 | /* |
198 | 198 | if (time() + 3900 < $timestamp) $timestamp -= 86400; |
199 | 199 | elseif (time() - 82500 > $timestamp) $timestamp += 86400; |
200 | 200 | */ |
201 | - } elseif ($matches[4] == 'z' || $matches[4] == '/') { |
|
201 | + } elseif ($matches[4] == 'z' || $matches[4] == '/') { |
|
202 | 202 | // This work or not ? |
203 | 203 | $timestamp = strtotime(date('Ym').$matches[1].' '.$matches[2].':'.$matches[3]); |
204 | - } |
|
205 | - $body_parse = substr($body_parse,7); |
|
206 | - $result['timestamp'] = $timestamp; |
|
207 | - //echo date('Ymd H:i:s',$timestamp); |
|
204 | + } |
|
205 | + $body_parse = substr($body_parse,7); |
|
206 | + $result['timestamp'] = $timestamp; |
|
207 | + //echo date('Ymd H:i:s',$timestamp); |
|
208 | 208 | } |
209 | 209 | if (preg_match('/^([0-9]{2})([0-9]{2})([0-9]{2})([0-9]{2})/',$body_parse,$matches)) { |
210 | - $find = true; |
|
211 | - $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]); |
|
212 | - $body_parse = substr($body_parse,8); |
|
213 | - $result['timestamp'] = $timestamp; |
|
214 | - //echo date('Ymd H:i:s',$timestamp); |
|
210 | + $find = true; |
|
211 | + $timestamp = strtotime(date('Y').$matches[1].$matches[2].' '.$matches[3].':'.$matches[4]); |
|
212 | + $body_parse = substr($body_parse,8); |
|
213 | + $result['timestamp'] = $timestamp; |
|
214 | + //echo date('Ymd H:i:s',$timestamp); |
|
215 | 215 | } |
216 | 216 | //if (strlen($body_parse) > 19) { |
217 | - if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) { |
|
218 | - $find = true; |
|
217 | + if (preg_match('/^([0-9]{2})([0-7 ][0-9 ]\\.[0-9 ]{2})([NnSs])(.)([0-9]{3})([0-7 ][0-9 ]\\.[0-9 ]{2})([EeWw])(.)/',$body_parse,$matches)) { |
|
218 | + $find = true; |
|
219 | 219 | // 4658.70N/00707.78Ez |
220 | 220 | //print_r(str_split($body_parse)); |
221 | 221 | |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $lon = intval($lon_deg); |
233 | 233 | if ($lat > 89 || $lon > 179) return false; |
234 | 234 | |
235 | - /* |
|
235 | + /* |
|
236 | 236 | $tmp_5b = str_replace('.','',$lat_min); |
237 | 237 | if (preg_match('/^([0-9]{0,4})( {0,4})$/',$tmp_5b,$matches)) { |
238 | 238 | print_r($matches); |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | $result['longitude'] = $longitude; |
247 | 247 | $body_parse = substr($body_parse,18); |
248 | 248 | $body_parse_len = strlen($body_parse); |
249 | - } |
|
250 | - $body_parse_len = strlen($body_parse); |
|
251 | - if ($body_parse_len > 0) { |
|
249 | + } |
|
250 | + $body_parse_len = strlen($body_parse); |
|
251 | + if ($body_parse_len > 0) { |
|
252 | 252 | /* |
253 | 253 | if (!isset($result['timestamp']) && !isset($result['latitude'])) { |
254 | 254 | $body_split = str_split($body); |
@@ -278,89 +278,89 @@ discard block |
||
278 | 278 | if (isset($this->symbols[$symbol_code])) $result['symbol'] = $this->symbols[$symbol_code]; |
279 | 279 | if ($symbol_code != '_') { |
280 | 280 | } |
281 | - //$body_parse = substr($body_parse,1); |
|
282 | - //$body_parse = trim($body_parse); |
|
283 | - //$body_parse_len = strlen($body_parse); |
|
284 | - if ($body_parse_len >= 7) { |
|
281 | + //$body_parse = substr($body_parse,1); |
|
282 | + //$body_parse = trim($body_parse); |
|
283 | + //$body_parse_len = strlen($body_parse); |
|
284 | + if ($body_parse_len >= 7) { |
|
285 | 285 | |
286 | - if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
|
287 | - $course = substr($body_parse,0,3); |
|
288 | - $tmp_s = intval($course); |
|
289 | - if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
|
290 | - $speed = substr($body_parse,4,3); |
|
291 | - if ($speed != '...') { |
|
292 | - //$result['speed'] = round($speed*1.852); |
|
293 | - $result['speed'] = intval($speed); |
|
294 | - } |
|
295 | - $body_parse = substr($body_parse,7); |
|
296 | - } |
|
297 | - // Check PHGR, PHG, RNG |
|
298 | - } |
|
299 | - /* |
|
286 | + if (preg_match('/^([0-9\\. ]{3})\\/([0-9\\. ]{3})/',$body_parse)) { |
|
287 | + $course = substr($body_parse,0,3); |
|
288 | + $tmp_s = intval($course); |
|
289 | + if ($tmp_s >= 1 && $tmp_s <= 360) $result['heading'] = intval($course); |
|
290 | + $speed = substr($body_parse,4,3); |
|
291 | + if ($speed != '...') { |
|
292 | + //$result['speed'] = round($speed*1.852); |
|
293 | + $result['speed'] = intval($speed); |
|
294 | + } |
|
295 | + $body_parse = substr($body_parse,7); |
|
296 | + } |
|
297 | + // Check PHGR, PHG, RNG |
|
298 | + } |
|
299 | + /* |
|
300 | 300 | else if ($body_parse_len > 0) { |
301 | 301 | $rest = $body_parse; |
302 | 302 | } |
303 | 303 | */ |
304 | - if (strlen($body_parse) > 0) { |
|
305 | - if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) { |
|
306 | - $altitude = intval($matches[1]); |
|
307 | - //$result['altitude'] = round($altitude*0.3048); |
|
308 | - $result['altitude'] = $altitude; |
|
309 | - //$body_parse = trim(substr($body_parse,strlen($matches[0]))); |
|
310 | - $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse)); |
|
311 | - } |
|
312 | - } |
|
304 | + if (strlen($body_parse) > 0) { |
|
305 | + if (preg_match('/\\/A=(-[0-9]{5}|[0-9]{6})/',$body_parse,$matches)) { |
|
306 | + $altitude = intval($matches[1]); |
|
307 | + //$result['altitude'] = round($altitude*0.3048); |
|
308 | + $result['altitude'] = $altitude; |
|
309 | + //$body_parse = trim(substr($body_parse,strlen($matches[0]))); |
|
310 | + $body_parse = trim(preg_replace('/\\/A=(-[0-9]{5}|[0-9]{6})/','',$body_parse)); |
|
311 | + } |
|
312 | + } |
|
313 | 313 | |
314 | - // Telemetry |
|
315 | - /* |
|
314 | + // Telemetry |
|
315 | + /* |
|
316 | 316 | if (preg_match('/^([0-9]+),(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,(-?)([0-9]{1,6}|[0-9]+\\.[0-9]+|\\.[0-9]+)?,([01]{0,8})/',$body_parse,$matches)) { |
317 | 317 | // Nothing yet... |
318 | 318 | } |
319 | 319 | */ |
320 | - // DAO |
|
320 | + // DAO |
|
321 | 321 | |
322 | - if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) { |
|
322 | + if (preg_match('/^!([0-9A-Z]{3})/',$body_parse,$matches)) { |
|
323 | 323 | |
324 | - $dao = $matches[1]; |
|
325 | - if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) { |
|
324 | + $dao = $matches[1]; |
|
325 | + if (preg_match('/^([A-Z])([0-9]{2})/',$dao)) { |
|
326 | 326 | $dao_split = str_split($dao); |
327 | - $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
|
328 | - $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
|
327 | + $lat_off = (($dao_split[1])-48.0)*0.001/60.0; |
|
328 | + $lon_off = (($dao_split[2])-48.0)*0.001/60.0; |
|
329 | 329 | |
330 | 330 | if ($result['latitude'] < 0) $result['latitude'] -= $lat_off; |
331 | 331 | else $result['latitude'] += $lat_off; |
332 | 332 | if ($result['longitude'] < 0) $result['longitude'] -= $lon_off; |
333 | 333 | else $result['longitude'] += $lon_off; |
334 | - } |
|
334 | + } |
|
335 | 335 | |
336 | - $body_parse = substr($body_parse,6); |
|
337 | - } |
|
336 | + $body_parse = substr($body_parse,6); |
|
337 | + } |
|
338 | 338 | |
339 | - if (preg_match('/CS=([0-9A-Z]*)/',$body_parse,$matches)) { |
|
339 | + if (preg_match('/CS=([0-9A-Z]*)/',$body_parse,$matches)) { |
|
340 | 340 | $result['ident'] = $matches[1]; |
341 | - } |
|
342 | - if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) { |
|
341 | + } |
|
342 | + if (preg_match('/SQ=([0-9]{4})/',$body_parse,$matches)) { |
|
343 | 343 | $result['squawk'] = $matches[1]; |
344 | - } |
|
345 | - if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) { |
|
344 | + } |
|
345 | + if (preg_match('/AI=([0-9A-Z]{4})/',$body_parse,$matches)) { |
|
346 | 346 | $result['aircraft_icao'] = $matches[1]; |
347 | - } |
|
348 | - if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) { |
|
347 | + } |
|
348 | + if (preg_match('/TI=([0-9]*)/',$body_parse,$matches)) { |
|
349 | 349 | $result['typeid'] = $matches[1]; |
350 | - } |
|
351 | - if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) { |
|
350 | + } |
|
351 | + if (preg_match('/IMO=([0-9]{7})/',$body_parse,$matches)) { |
|
352 | 352 | $result['imo'] = $matches[1]; |
353 | - } |
|
354 | - if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) { |
|
353 | + } |
|
354 | + if (preg_match('/AD=([0-9]*)/',$body_parse,$matches)) { |
|
355 | 355 | $result['arrival_date'] = $matches[1]; |
356 | - } |
|
357 | - if (preg_match('/AC=([0-9A-Z]*)/',$body_parse,$matches)) { |
|
356 | + } |
|
357 | + if (preg_match('/AC=([0-9A-Z]*)/',$body_parse,$matches)) { |
|
358 | 358 | $result['arrival_code'] = $matches[1]; |
359 | - } |
|
360 | - // OGN comment |
|
359 | + } |
|
360 | + // OGN comment |
|
361 | 361 | // echo "Before OGN : ".$body_parse."\n"; |
362 | - //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) { |
|
363 | - if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) { |
|
362 | + //if (preg_match('/^id([0-9A-F]{8}) ([+-])([0-9]{3,4})fpm ([+-])([0-9.]{3,4})rot (.*)$/',$body_parse,$matches)) { |
|
363 | + if (preg_match('/^id([0-9A-F]{8})/',$body_parse,$matches)) { |
|
364 | 364 | $id = $matches[1]; |
365 | 365 | //$mode = substr($id,0,2); |
366 | 366 | $address = substr($id,2); |
@@ -390,53 +390,53 @@ discard block |
||
390 | 390 | $stealth = (intval(substr($id,0,2), 16) & 0b10000000) != 0; |
391 | 391 | $result['stealth'] = $stealth; |
392 | 392 | $result['address'] = $address; |
393 | - } |
|
393 | + } |
|
394 | 394 | |
395 | - //Comment |
|
396 | - $result['comment'] = trim($body_parse); |
|
395 | + //Comment |
|
396 | + $result['comment'] = trim($body_parse); |
|
397 | 397 | } else { |
398 | - // parse weather |
|
399 | - //$body_parse = substr($body_parse,1); |
|
400 | - //$body_parse_len = strlen($body_parse); |
|
398 | + // parse weather |
|
399 | + //$body_parse = substr($body_parse,1); |
|
400 | + //$body_parse_len = strlen($body_parse); |
|
401 | 401 | |
402 | - if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
403 | - $result['wind_dir'] = intval($matches[1]); |
|
404 | - $result['wind_speed'] = round(intval($matches[2])*1.60934,1); |
|
405 | - $result['wind_gust'] = round(intval($matches[3])*1.60934,1); |
|
406 | - $result['temp'] = round(5/9*((intval($matches[4]))-32),1); |
|
407 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
408 | - } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
402 | + if (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
403 | + $result['wind_dir'] = intval($matches[1]); |
|
404 | + $result['wind_speed'] = round(intval($matches[2])*1.60934,1); |
|
405 | + $result['wind_gust'] = round(intval($matches[3])*1.60934,1); |
|
406 | + $result['temp'] = round(5/9*((intval($matches[4]))-32),1); |
|
407 | + $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
408 | + } elseif (preg_match('/^_{0,1}c([0-9 \\.\\-]{3})s([0-9 \\.]{3})g([0-9 \\.]+)t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
409 | 409 | $result['wind_dir'] = intval($matches[1]); |
410 | 410 | $result['wind_speed'] = round($matches[2]*1.60934,1); |
411 | 411 | $result['wind_gust'] = round($matches[3]*1.60934,1); |
412 | 412 | $result['temp'] = round(5/9*(($matches[4])-32),1); |
413 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
414 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
413 | + $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
414 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})t(-{0,1}[0-9 \\.]+)/',$body_parse,$matches)) { |
|
415 | 415 | $result['wind_dir'] = intval($matches[1]); |
416 | 416 | $result['wind_speed'] = round($matches[2]*1.60934,1); |
417 | 417 | $result['wind_gust'] = round($matches[3]*1.60934,1); |
418 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
419 | - } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) { |
|
418 | + $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
419 | + } elseif (preg_match('/^_{0,1}([0-9 \\.\\-]{3})\\/([0-9 \\.]{3})g([0-9 \\.]+)/',$body_parse,$matches)) { |
|
420 | 420 | $result['wind_dir'] = intval($matches[1]); |
421 | 421 | $result['wind_speed'] = round($matches[2]*1.60934,1); |
422 | 422 | $result['wind_gust'] = round($matches[3]*1.60934,1); |
423 | - $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
424 | - } |
|
425 | - if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) { |
|
423 | + $body_parse = substr($body_parse,strlen($matches[0])+1); |
|
424 | + } |
|
425 | + if (!isset($result['temp']) && strlen($body_parse) > 0 && preg_match('/^g([0-9]+)t(-?[0-9 \\.]{1,3})/',$body_parse,$matches)) { |
|
426 | 426 | $result['temp'] = round(5/9*(($matches[1])-32),1); |
427 | - } |
|
427 | + } |
|
428 | 428 | } |
429 | 429 | } else $result['comment'] = trim($body_parse); |
430 | 430 | |
431 | - } |
|
431 | + } |
|
432 | 432 | //} |
433 | 433 | if (isset($result['latitude'])) $result['latitude'] = round($result['latitude'],4); |
434 | 434 | if (isset($result['longitude'])) $result['longitude'] = round($result['longitude'],4); |
435 | 435 | if ($debug) print_r($result); |
436 | 436 | return $result; |
437 | - } |
|
437 | + } |
|
438 | 438 | |
439 | - public function connect() { |
|
439 | + public function connect() { |
|
440 | 440 | global $globalAPRSversion, $globalServerAPRSssid, $globalServerAPRSpass,$globalName, $globalServerAPRShost, $globalServerAPRSport; |
441 | 441 | $aprs_connect = 0; |
442 | 442 | $aprs_keep = 120; |
@@ -459,32 +459,32 @@ discard block |
||
459 | 459 | $send = socket_send( $this->socket , $aprs_login , strlen($aprs_login) , 0 ); |
460 | 460 | while ($msgin = socket_read($this->socket, 1000,PHP_NORMAL_READ)) { |
461 | 461 | if (strpos($msgin, "$aprs_ssid verified") !== FALSE) { |
462 | - echo 'APRS user verified !'."\n"; |
|
463 | - $this->connected = true; |
|
464 | - return true; |
|
465 | - break; |
|
462 | + echo 'APRS user verified !'."\n"; |
|
463 | + $this->connected = true; |
|
464 | + return true; |
|
465 | + break; |
|
466 | 466 | } |
467 | 467 | if (time()-$authstart > 5) { |
468 | - echo 'APRS timeout'."\n"; |
|
469 | - break; |
|
468 | + echo 'APRS timeout'."\n"; |
|
469 | + break; |
|
470 | 470 | } |
471 | 471 | } |
472 | 472 | socket_set_option($this->socket,SOL_SOCKET,SO_KEEPALIVE); |
473 | 473 | } |
474 | - } |
|
474 | + } |
|
475 | 475 | |
476 | - public function disconnect() { |
|
476 | + public function disconnect() { |
|
477 | 477 | socket_close($this->socket); |
478 | - } |
|
478 | + } |
|
479 | 479 | |
480 | - public function send($data) { |
|
480 | + public function send($data) { |
|
481 | 481 | if ($this->connected === false) $this->connect(); |
482 | 482 | $send = socket_send( $this->socket , $data , strlen($data),0); |
483 | 483 | if ($send === FALSE) { |
484 | 484 | socket_close($this->socket); |
485 | 485 | $this->connect(); |
486 | 486 | } |
487 | - } |
|
487 | + } |
|
488 | 488 | } |
489 | 489 | |
490 | 490 | class APRSSpotter extends APRS { |
@@ -12,10 +12,10 @@ discard block |
||
12 | 12 | |
13 | 13 | |
14 | 14 | /** |
15 | - * Get SQL query part for filter used |
|
16 | - * @param Array $filter the filter |
|
17 | - * @return Array the SQL part |
|
18 | - */ |
|
15 | + * Get SQL query part for filter used |
|
16 | + * @param Array $filter the filter |
|
17 | + * @return Array the SQL part |
|
18 | + */ |
|
19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
21 | 21 | $filters = array(); |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | /** |
89 | - * Gets all the spotter information based on the latest data entry |
|
90 | - * |
|
91 | - * @return Array the spotter information |
|
92 | - * |
|
93 | - */ |
|
89 | + * Gets all the spotter information based on the latest data entry |
|
90 | + * |
|
91 | + * @return Array the spotter information |
|
92 | + * |
|
93 | + */ |
|
94 | 94 | public function getLiveTrackerData($limit = '', $sort = '', $filter = array()) |
95 | 95 | { |
96 | 96 | global $globalDBdriver, $globalLiveInterval; |
@@ -132,11 +132,11 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | /** |
135 | - * Gets Minimal Live Spotter data |
|
136 | - * |
|
137 | - * @return Array the spotter information |
|
138 | - * |
|
139 | - */ |
|
135 | + * Gets Minimal Live Spotter data |
|
136 | + * |
|
137 | + * @return Array the spotter information |
|
138 | + * |
|
139 | + */ |
|
140 | 140 | public function getMinLiveTrackerData($filter = array()) |
141 | 141 | { |
142 | 142 | global $globalDBdriver, $globalLiveInterval; |
@@ -170,11 +170,11 @@ discard block |
||
170 | 170 | } |
171 | 171 | |
172 | 172 | /** |
173 | - * Gets Minimal Live Spotter data since xx seconds |
|
174 | - * |
|
175 | - * @return Array the spotter information |
|
176 | - * |
|
177 | - */ |
|
173 | + * Gets Minimal Live Spotter data since xx seconds |
|
174 | + * |
|
175 | + * @return Array the spotter information |
|
176 | + * |
|
177 | + */ |
|
178 | 178 | public function getMinLastLiveTrackerData($filter = array()) |
179 | 179 | { |
180 | 180 | global $globalDBdriver, $globalLiveInterval; |
@@ -187,13 +187,13 @@ discard block |
||
187 | 187 | $query = 'SELECT tracker_live.ident, tracker_live.famtrackid,tracker_live.type, tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
188 | 188 | FROM tracker_live'.$filter_query.' DATE_SUB(UTC_TIMESTAMP(),INTERVAL '.$globalLiveInterval." SECOND) <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' |
189 | 189 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
190 | - } else { |
|
190 | + } else { |
|
191 | 191 | $query = "SELECT tracker_live.ident, tracker_live.famtrackid, tracker_live.type,tracker_live.latitude, tracker_live.longitude, tracker_live.altitude, tracker_live.heading, tracker_live.ground_speed, tracker_live.date, tracker_live.format_source |
192 | 192 | FROM tracker_live".$filter_query." CURRENT_TIMESTAMP AT TIME ZONE 'UTC' - INTERVAL '".$globalLiveInterval." SECONDS' <= tracker_live.date AND tracker_live.latitude <> '0' AND tracker_live.longitude <> '0' |
193 | 193 | ORDER BY tracker_live.famtrackid, tracker_live.date"; |
194 | 194 | } |
195 | 195 | |
196 | - try { |
|
196 | + try { |
|
197 | 197 | $sth = $this->db->prepare($query); |
198 | 198 | $sth->execute(); |
199 | 199 | } catch(PDOException $e) { |
@@ -205,11 +205,11 @@ discard block |
||
205 | 205 | } |
206 | 206 | |
207 | 207 | /** |
208 | - * Gets number of latest data entry |
|
209 | - * |
|
210 | - * @return String number of entry |
|
211 | - * |
|
212 | - */ |
|
208 | + * Gets number of latest data entry |
|
209 | + * |
|
210 | + * @return String number of entry |
|
211 | + * |
|
212 | + */ |
|
213 | 213 | public function getLiveTrackerCount($filter = array()) |
214 | 214 | { |
215 | 215 | global $globalDBdriver, $globalLiveInterval; |
@@ -234,11 +234,11 @@ discard block |
||
234 | 234 | } |
235 | 235 | |
236 | 236 | /** |
237 | - * Gets all the spotter information based on the latest data entry and coord |
|
238 | - * |
|
239 | - * @return Array the spotter information |
|
240 | - * |
|
241 | - */ |
|
237 | + * Gets all the spotter information based on the latest data entry and coord |
|
238 | + * |
|
239 | + * @return Array the spotter information |
|
240 | + * |
|
241 | + */ |
|
242 | 242 | public function getLiveTrackerDatabyCoord($coord, $filter = array()) |
243 | 243 | { |
244 | 244 | global $globalDBdriver, $globalLiveInterval; |
@@ -262,11 +262,11 @@ discard block |
||
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
265 | - * Gets all the spotter information based on the latest data entry and coord |
|
266 | - * |
|
267 | - * @return Array the spotter information |
|
268 | - * |
|
269 | - */ |
|
265 | + * Gets all the spotter information based on the latest data entry and coord |
|
266 | + * |
|
267 | + * @return Array the spotter information |
|
268 | + * |
|
269 | + */ |
|
270 | 270 | public function getMinLiveTrackerDatabyCoord($coord, $filter = array()) |
271 | 271 | { |
272 | 272 | global $globalDBdriver, $globalLiveInterval; |
@@ -293,11 +293,11 @@ discard block |
||
293 | 293 | } |
294 | 294 | |
295 | 295 | /** |
296 | - * Gets all the spotter information based on a user's latitude and longitude |
|
297 | - * |
|
298 | - * @return Array the spotter information |
|
299 | - * |
|
300 | - */ |
|
296 | + * Gets all the spotter information based on a user's latitude and longitude |
|
297 | + * |
|
298 | + * @return Array the spotter information |
|
299 | + * |
|
300 | + */ |
|
301 | 301 | public function getLatestTrackerForLayar($lat, $lng, $radius, $interval) |
302 | 302 | { |
303 | 303 | $Tracker = new Tracker($this->db); |
@@ -310,142 +310,142 @@ discard block |
||
310 | 310 | if ($lng != '') |
311 | 311 | { |
312 | 312 | if (!is_numeric($lng)) |
313 | - { |
|
314 | - return false; |
|
315 | - } |
|
316 | - } |
|
317 | - |
|
318 | - if ($radius != '') |
|
319 | - { |
|
320 | - if (!is_numeric($radius)) |
|
321 | - { |
|
322 | - return false; |
|
323 | - } |
|
324 | - } |
|
313 | + { |
|
314 | + return false; |
|
315 | + } |
|
316 | + } |
|
317 | + |
|
318 | + if ($radius != '') |
|
319 | + { |
|
320 | + if (!is_numeric($radius)) |
|
321 | + { |
|
322 | + return false; |
|
323 | + } |
|
324 | + } |
|
325 | 325 | $additional_query = ''; |
326 | 326 | if ($interval != '') |
327 | - { |
|
328 | - if (!is_string($interval)) |
|
329 | - { |
|
330 | - //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
331 | - return false; |
|
332 | - } else { |
|
333 | - if ($interval == '1m') |
|
334 | - { |
|
335 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
336 | - } else if ($interval == '15m'){ |
|
337 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; |
|
338 | - } |
|
339 | - } |
|
340 | - } else { |
|
341 | - $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
342 | - } |
|
343 | - |
|
344 | - $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
327 | + { |
|
328 | + if (!is_string($interval)) |
|
329 | + { |
|
330 | + //$additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
331 | + return false; |
|
332 | + } else { |
|
333 | + if ($interval == '1m') |
|
334 | + { |
|
335 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
336 | + } else if ($interval == '15m'){ |
|
337 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 15 MINUTE) <= tracker_live.date '; |
|
338 | + } |
|
339 | + } |
|
340 | + } else { |
|
341 | + $additional_query = ' AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 MINUTE) <= tracker_live.date '; |
|
342 | + } |
|
343 | + |
|
344 | + $query = "SELECT tracker_live.*, ( 6371 * acos( cos( radians(:lat) ) * cos( radians( latitude ) ) * cos( radians( longitude ) - radians(:lng) ) + sin( radians(:lat) ) * sin( radians( latitude ) ) ) ) AS distance FROM tracker_live |
|
345 | 345 | WHERE tracker_live.latitude <> '' |
346 | 346 | AND tracker_live.longitude <> '' |
347 | 347 | ".$additional_query." |
348 | 348 | HAVING distance < :radius |
349 | 349 | ORDER BY distance"; |
350 | 350 | |
351 | - $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
351 | + $spotter_array = $Tracker->getDataFromDB($query, array(':lat' => $lat, ':lng' => $lng,':radius' => $radius)); |
|
352 | 352 | |
353 | - return $spotter_array; |
|
354 | - } |
|
353 | + return $spotter_array; |
|
354 | + } |
|
355 | 355 | |
356 | 356 | |
357 | - /** |
|
358 | - * Gets all the spotter information based on a particular callsign |
|
359 | - * |
|
360 | - * @return Array the spotter information |
|
361 | - * |
|
362 | - */ |
|
357 | + /** |
|
358 | + * Gets all the spotter information based on a particular callsign |
|
359 | + * |
|
360 | + * @return Array the spotter information |
|
361 | + * |
|
362 | + */ |
|
363 | 363 | public function getLastLiveTrackerDataByIdent($ident) |
364 | 364 | { |
365 | 365 | $Tracker = new Tracker($this->db); |
366 | 366 | date_default_timezone_set('UTC'); |
367 | 367 | |
368 | 368 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
369 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
369 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
370 | 370 | |
371 | 371 | $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident),'',true); |
372 | 372 | |
373 | 373 | return $spotter_array; |
374 | 374 | } |
375 | 375 | |
376 | - /** |
|
377 | - * Gets all the spotter information based on a particular callsign |
|
378 | - * |
|
379 | - * @return Array the spotter information |
|
380 | - * |
|
381 | - */ |
|
376 | + /** |
|
377 | + * Gets all the spotter information based on a particular callsign |
|
378 | + * |
|
379 | + * @return Array the spotter information |
|
380 | + * |
|
381 | + */ |
|
382 | 382 | public function getDateLiveTrackerDataByIdent($ident,$date) |
383 | 383 | { |
384 | 384 | $Tracker = new Tracker($this->db); |
385 | 385 | date_default_timezone_set('UTC'); |
386 | 386 | |
387 | 387 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
388 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
388 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.ident = :ident AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
389 | 389 | |
390 | - $date = date('c',$date); |
|
390 | + $date = date('c',$date); |
|
391 | 391 | $spotter_array = $Tracker->getDataFromDB($query,array(':ident' => $ident,':date' => $date)); |
392 | 392 | |
393 | 393 | return $spotter_array; |
394 | 394 | } |
395 | 395 | |
396 | - /** |
|
397 | - * Gets last spotter information based on a particular callsign |
|
398 | - * |
|
399 | - * @return Array the spotter information |
|
400 | - * |
|
401 | - */ |
|
396 | + /** |
|
397 | + * Gets last spotter information based on a particular callsign |
|
398 | + * |
|
399 | + * @return Array the spotter information |
|
400 | + * |
|
401 | + */ |
|
402 | 402 | public function getLastLiveTrackerDataById($id) |
403 | 403 | { |
404 | 404 | $Tracker = new Tracker($this->db); |
405 | 405 | date_default_timezone_set('UTC'); |
406 | 406 | |
407 | 407 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
408 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
408 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
409 | 409 | |
410 | 410 | $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id),'',true); |
411 | 411 | |
412 | 412 | return $spotter_array; |
413 | 413 | } |
414 | 414 | |
415 | - /** |
|
416 | - * Gets last spotter information based on a particular callsign |
|
417 | - * |
|
418 | - * @return Array the spotter information |
|
419 | - * |
|
420 | - */ |
|
415 | + /** |
|
416 | + * Gets last spotter information based on a particular callsign |
|
417 | + * |
|
418 | + * @return Array the spotter information |
|
419 | + * |
|
420 | + */ |
|
421 | 421 | public function getDateLiveTrackerDataById($id,$date) |
422 | 422 | { |
423 | 423 | $Tracker = new Tracker($this->db); |
424 | 424 | date_default_timezone_set('UTC'); |
425 | 425 | |
426 | 426 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
427 | - $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
428 | - $date = date('c',$date); |
|
427 | + $query = 'SELECT tracker_live.* FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l WHERE l.famtrackid = :id AND l.date <= :date GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate ORDER BY tracker_live.date DESC'; |
|
428 | + $date = date('c',$date); |
|
429 | 429 | $spotter_array = $Tracker->getDataFromDB($query,array(':id' => $id,':date' => $date),'',true); |
430 | 430 | |
431 | 431 | return $spotter_array; |
432 | 432 | } |
433 | 433 | |
434 | - /** |
|
435 | - * Gets altitude information based on a particular callsign |
|
436 | - * |
|
437 | - * @return Array the spotter information |
|
438 | - * |
|
439 | - */ |
|
434 | + /** |
|
435 | + * Gets altitude information based on a particular callsign |
|
436 | + * |
|
437 | + * @return Array the spotter information |
|
438 | + * |
|
439 | + */ |
|
440 | 440 | public function getAltitudeLiveTrackerDataByIdent($ident) |
441 | 441 | { |
442 | 442 | |
443 | 443 | date_default_timezone_set('UTC'); |
444 | 444 | |
445 | 445 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
446 | - $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
446 | + $query = 'SELECT tracker_live.altitude, tracker_live.date FROM tracker_live WHERE tracker_live.ident = :ident'; |
|
447 | 447 | |
448 | - try { |
|
448 | + try { |
|
449 | 449 | |
450 | 450 | $sth = $this->db->prepare($query); |
451 | 451 | $sth->execute(array(':ident' => $ident)); |
@@ -458,12 +458,12 @@ discard block |
||
458 | 458 | return $spotter_array; |
459 | 459 | } |
460 | 460 | |
461 | - /** |
|
462 | - * Gets all the spotter information based on a particular id |
|
463 | - * |
|
464 | - * @return Array the spotter information |
|
465 | - * |
|
466 | - */ |
|
461 | + /** |
|
462 | + * Gets all the spotter information based on a particular id |
|
463 | + * |
|
464 | + * @return Array the spotter information |
|
465 | + * |
|
466 | + */ |
|
467 | 467 | public function getAllLiveTrackerDataById($id,$liveinterval = false) |
468 | 468 | { |
469 | 469 | global $globalDBdriver, $globalLiveInterval; |
@@ -491,18 +491,18 @@ discard block |
||
491 | 491 | return $spotter_array; |
492 | 492 | } |
493 | 493 | |
494 | - /** |
|
495 | - * Gets all the spotter information based on a particular ident |
|
496 | - * |
|
497 | - * @return Array the spotter information |
|
498 | - * |
|
499 | - */ |
|
494 | + /** |
|
495 | + * Gets all the spotter information based on a particular ident |
|
496 | + * |
|
497 | + * @return Array the spotter information |
|
498 | + * |
|
499 | + */ |
|
500 | 500 | public function getAllLiveTrackerDataByIdent($ident) |
501 | 501 | { |
502 | 502 | date_default_timezone_set('UTC'); |
503 | 503 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
504 | 504 | $query = self::$global_query.' WHERE tracker_live.ident = :ident'; |
505 | - try { |
|
505 | + try { |
|
506 | 506 | |
507 | 507 | $sth = $this->db->prepare($query); |
508 | 508 | $sth->execute(array(':ident' => $ident)); |
@@ -516,23 +516,23 @@ discard block |
||
516 | 516 | |
517 | 517 | |
518 | 518 | /** |
519 | - * Deletes all info in the table |
|
520 | - * |
|
521 | - * @return String success or false |
|
522 | - * |
|
523 | - */ |
|
519 | + * Deletes all info in the table |
|
520 | + * |
|
521 | + * @return String success or false |
|
522 | + * |
|
523 | + */ |
|
524 | 524 | public function deleteLiveTrackerData() |
525 | 525 | { |
526 | 526 | global $globalDBdriver; |
527 | 527 | if ($globalDBdriver == 'mysql') { |
528 | 528 | //$query = "DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 30 MINUTE) >= tracker_live.date"; |
529 | 529 | $query = 'DELETE FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(),INTERVAL 9 HOUR) >= tracker_live.date'; |
530 | - //$query = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)"; |
|
530 | + //$query = "DELETE FROM tracker_live WHERE tracker_live.id IN (SELECT tracker_live.id FROM tracker_live INNER JOIN (SELECT l.famtrackid, max(l.date) as maxdate FROM tracker_live l GROUP BY l.famtrackid) s on tracker_live.famtrackid = s.famtrackid AND tracker_live.date = s.maxdate AND DATE_SUB(UTC_TIMESTAMP(),INTERVAL 1 HOUR) >= tracker_live.date)"; |
|
531 | 531 | } else { |
532 | 532 | $query = "DELETE FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date"; |
533 | 533 | } |
534 | 534 | |
535 | - try { |
|
535 | + try { |
|
536 | 536 | |
537 | 537 | $sth = $this->db->prepare($query); |
538 | 538 | $sth->execute(); |
@@ -544,18 +544,18 @@ discard block |
||
544 | 544 | } |
545 | 545 | |
546 | 546 | /** |
547 | - * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
548 | - * |
|
549 | - * @return String success or false |
|
550 | - * |
|
551 | - */ |
|
547 | + * Deletes all info in the table for aircraft not seen since 2 HOUR |
|
548 | + * |
|
549 | + * @return String success or false |
|
550 | + * |
|
551 | + */ |
|
552 | 552 | public function deleteLiveTrackerDataNotUpdated() |
553 | 553 | { |
554 | 554 | global $globalDBdriver, $globalDebug; |
555 | 555 | if ($globalDBdriver == 'mysql') { |
556 | 556 | //$query = 'SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE DATE_SUB(UTC_TIMESTAMP(), INTERVAL 1 HOUR) < tracker_live.date) LIMIT 800 OFFSET 0'; |
557 | - $query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
558 | - try { |
|
557 | + $query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND DATE_SUB(UTC_TIMESTAMP(), INTERVAL 2 HOUR) >= s.max_date LIMIT 1200 OFFSET 0"; |
|
558 | + try { |
|
559 | 559 | |
560 | 560 | $sth = $this->db->prepare($query); |
561 | 561 | $sth->execute(); |
@@ -563,8 +563,8 @@ discard block |
||
563 | 563 | return "error"; |
564 | 564 | } |
565 | 565 | $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
566 | - $i = 0; |
|
567 | - $j =0; |
|
566 | + $i = 0; |
|
567 | + $j =0; |
|
568 | 568 | $all = $sth->fetchAll(PDO::FETCH_ASSOC); |
569 | 569 | foreach($all as $row) |
570 | 570 | { |
@@ -572,20 +572,20 @@ discard block |
||
572 | 572 | $j++; |
573 | 573 | if ($j == 30) { |
574 | 574 | if ($globalDebug) echo "."; |
575 | - try { |
|
575 | + try { |
|
576 | 576 | |
577 | 577 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
578 | 578 | $sth->execute(); |
579 | 579 | } catch(PDOException $e) { |
580 | 580 | return "error"; |
581 | 581 | } |
582 | - $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
|
583 | - $j = 0; |
|
582 | + $query_delete = 'DELETE FROM tracker_live WHERE famtrackid IN ('; |
|
583 | + $j = 0; |
|
584 | 584 | } |
585 | 585 | $query_delete .= "'".$row['famtrackid']."',"; |
586 | 586 | } |
587 | 587 | if ($i > 0) { |
588 | - try { |
|
588 | + try { |
|
589 | 589 | |
590 | 590 | $sth = $this->db->prepare(substr($query_delete,0,-1).")"); |
591 | 591 | $sth->execute(); |
@@ -596,9 +596,9 @@ discard block |
||
596 | 596 | return "success"; |
597 | 597 | } elseif ($globalDBdriver == 'pgsql') { |
598 | 598 | //$query = "SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' >= tracker_live.date AND tracker_live.famtrackid NOT IN (SELECT famtrackid FROM tracker_live WHERE NOW() AT TIME ZONE 'UTC' - INTERVAL '9 HOURS' < tracker_live.date) LIMIT 800 OFFSET 0"; |
599 | - //$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
600 | - $query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
601 | - try { |
|
599 | + //$query = "SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0"; |
|
600 | + $query = "DELETE FROM tracker_live WHERE famtrackid IN (SELECT tracker_live.famtrackid FROM tracker_live INNER JOIN (SELECT famtrackid,MAX(date) as max_date FROM tracker_live GROUP BY famtrackid) s ON s.famtrackid = tracker_live.famtrackid AND NOW() AT TIME ZONE 'UTC' - INTERVAL '2 HOURS' >= s.max_date LIMIT 800 OFFSET 0)"; |
|
601 | + try { |
|
602 | 602 | |
603 | 603 | $sth = $this->db->prepare($query); |
604 | 604 | $sth->execute(); |
@@ -642,17 +642,17 @@ discard block |
||
642 | 642 | } |
643 | 643 | |
644 | 644 | /** |
645 | - * Deletes all info in the table for an ident |
|
646 | - * |
|
647 | - * @return String success or false |
|
648 | - * |
|
649 | - */ |
|
645 | + * Deletes all info in the table for an ident |
|
646 | + * |
|
647 | + * @return String success or false |
|
648 | + * |
|
649 | + */ |
|
650 | 650 | public function deleteLiveTrackerDataByIdent($ident) |
651 | 651 | { |
652 | 652 | $ident = filter_var($ident, FILTER_SANITIZE_STRING); |
653 | 653 | $query = 'DELETE FROM tracker_live WHERE ident = :ident'; |
654 | 654 | |
655 | - try { |
|
655 | + try { |
|
656 | 656 | |
657 | 657 | $sth = $this->db->prepare($query); |
658 | 658 | $sth->execute(array(':ident' => $ident)); |
@@ -664,17 +664,17 @@ discard block |
||
664 | 664 | } |
665 | 665 | |
666 | 666 | /** |
667 | - * Deletes all info in the table for an id |
|
668 | - * |
|
669 | - * @return String success or false |
|
670 | - * |
|
671 | - */ |
|
667 | + * Deletes all info in the table for an id |
|
668 | + * |
|
669 | + * @return String success or false |
|
670 | + * |
|
671 | + */ |
|
672 | 672 | public function deleteLiveTrackerDataById($id) |
673 | 673 | { |
674 | 674 | $id = filter_var($id, FILTER_SANITIZE_STRING); |
675 | 675 | $query = 'DELETE FROM tracker_live WHERE famtrackid = :id'; |
676 | 676 | |
677 | - try { |
|
677 | + try { |
|
678 | 678 | |
679 | 679 | $sth = $this->db->prepare($query); |
680 | 680 | $sth->execute(array(':id' => $id)); |
@@ -687,11 +687,11 @@ discard block |
||
687 | 687 | |
688 | 688 | |
689 | 689 | /** |
690 | - * Gets the aircraft ident within the last hour |
|
691 | - * |
|
692 | - * @return String the ident |
|
693 | - * |
|
694 | - */ |
|
690 | + * Gets the aircraft ident within the last hour |
|
691 | + * |
|
692 | + * @return String the ident |
|
693 | + * |
|
694 | + */ |
|
695 | 695 | public function getIdentFromLastHour($ident) |
696 | 696 | { |
697 | 697 | global $globalDBdriver, $globalTimezone; |
@@ -717,14 +717,14 @@ discard block |
||
717 | 717 | $ident_result = $row['ident']; |
718 | 718 | } |
719 | 719 | return $ident_result; |
720 | - } |
|
720 | + } |
|
721 | 721 | |
722 | 722 | /** |
723 | - * Check recent aircraft |
|
724 | - * |
|
725 | - * @return String the ident |
|
726 | - * |
|
727 | - */ |
|
723 | + * Check recent aircraft |
|
724 | + * |
|
725 | + * @return String the ident |
|
726 | + * |
|
727 | + */ |
|
728 | 728 | public function checkIdentRecent($ident) |
729 | 729 | { |
730 | 730 | global $globalDBdriver, $globalTimezone; |
@@ -750,14 +750,14 @@ discard block |
||
750 | 750 | $ident_result = $row['famtrackid']; |
751 | 751 | } |
752 | 752 | return $ident_result; |
753 | - } |
|
753 | + } |
|
754 | 754 | |
755 | 755 | /** |
756 | - * Check recent aircraft by id |
|
757 | - * |
|
758 | - * @return String the ident |
|
759 | - * |
|
760 | - */ |
|
756 | + * Check recent aircraft by id |
|
757 | + * |
|
758 | + * @return String the ident |
|
759 | + * |
|
760 | + */ |
|
761 | 761 | public function checkIdRecent($id) |
762 | 762 | { |
763 | 763 | global $globalDBdriver, $globalTimezone; |
@@ -783,19 +783,19 @@ discard block |
||
783 | 783 | $ident_result = $row['famtrackid']; |
784 | 784 | } |
785 | 785 | return $ident_result; |
786 | - } |
|
786 | + } |
|
787 | 787 | |
788 | 788 | /** |
789 | - * Adds a new spotter data |
|
790 | - * |
|
791 | - * @param String $famtrackid the ID from flightaware |
|
792 | - * @param String $ident the flight ident |
|
793 | - * @param String $aircraft_icao the aircraft type |
|
794 | - * @param String $departure_airport_icao the departure airport |
|
795 | - * @param String $arrival_airport_icao the arrival airport |
|
796 | - * @return String success or false |
|
797 | - * |
|
798 | - */ |
|
789 | + * Adds a new spotter data |
|
790 | + * |
|
791 | + * @param String $famtrackid the ID from flightaware |
|
792 | + * @param String $ident the flight ident |
|
793 | + * @param String $aircraft_icao the aircraft type |
|
794 | + * @param String $departure_airport_icao the departure airport |
|
795 | + * @param String $arrival_airport_icao the arrival airport |
|
796 | + * @return String success or false |
|
797 | + * |
|
798 | + */ |
|
799 | 799 | public function addLiveTrackerData($famtrackid = '', $ident = '', $latitude = '', $longitude = '', $altitude = '', $heading = '', $groundspeed = '', $date = '', $putinarchive = false, $comment = '', $type = '',$noarchive = false,$format_source = '', $source_name = '', $over_country = '') |
800 | 800 | { |
801 | 801 | global $globalURL, $globalArchive, $globalDebug; |
@@ -868,8 +868,8 @@ discard block |
||
868 | 868 | $comment = filter_var($comment,FILTER_SANITIZE_STRING); |
869 | 869 | $type = filter_var($type,FILTER_SANITIZE_STRING); |
870 | 870 | |
871 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
872 | - if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
871 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false ) $groundspeed = 0; |
|
872 | + if ($heading == '' || $Common->isInteger($heading) === false ) $heading = 0; |
|
873 | 873 | |
874 | 874 | $query = 'INSERT INTO tracker_live (famtrackid, ident, latitude, longitude, altitude, heading, ground_speed, date, format_source, source_name, over_country, comment, type) |
875 | 875 | VALUES (:famtrackid,:ident,:latitude,:longitude,:altitude,:heading,:groundspeed,:date,:format_source, :source_name, :over_country,:comment,:type)'; |
@@ -879,9 +879,9 @@ discard block |
||
879 | 879 | |
880 | 880 | $sth = $this->db->prepare($query); |
881 | 881 | $sth->execute($query_values); |
882 | - } catch(PDOException $e) { |
|
883 | - return "error : ".$e->getMessage(); |
|
884 | - } |
|
882 | + } catch(PDOException $e) { |
|
883 | + return "error : ".$e->getMessage(); |
|
884 | + } |
|
885 | 885 | /* |
886 | 886 | if (isset($globalArchive) && $globalArchive && $putinarchive && $noarchive !== true) { |
887 | 887 | if ($globalDebug) echo '(Add to SBS archive : '; |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | } |
12 | 12 | |
13 | 13 | /** |
14 | - * Get SQL query part for filter used |
|
15 | - * @param Array $filter the filter |
|
16 | - * @return Array the SQL part |
|
17 | - */ |
|
14 | + * Get SQL query part for filter used |
|
15 | + * @param Array $filter the filter |
|
16 | + * @return Array the SQL part |
|
17 | + */ |
|
18 | 18 | |
19 | 19 | public function getFilter($filter = array(),$where = false,$and = false) { |
20 | 20 | global $globalFilter, $globalStatsFilters, $globalFilterName, $globalDBdriver; |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | } |
79 | 79 | |
80 | 80 | /** |
81 | - * Executes the SQL statements to get the spotter information |
|
82 | - * |
|
83 | - * @param String $query the SQL query |
|
84 | - * @param Array $params parameter of the query |
|
85 | - * @param String $limitQuery the limit query |
|
86 | - * @return Array the spotter information |
|
87 | - * |
|
88 | - */ |
|
81 | + * Executes the SQL statements to get the spotter information |
|
82 | + * |
|
83 | + * @param String $query the SQL query |
|
84 | + * @param Array $params parameter of the query |
|
85 | + * @param String $limitQuery the limit query |
|
86 | + * @return Array the spotter information |
|
87 | + * |
|
88 | + */ |
|
89 | 89 | public function getDataFromDB($query, $params = array(), $limitQuery = '',$schedules = false) |
90 | 90 | { |
91 | 91 | date_default_timezone_set('UTC'); |
@@ -212,11 +212,11 @@ discard block |
||
212 | 212 | |
213 | 213 | |
214 | 214 | /** |
215 | - * Gets all the spotter information based on the latest data entry |
|
216 | - * |
|
217 | - * @return Array the spotter information |
|
218 | - * |
|
219 | - */ |
|
215 | + * Gets all the spotter information based on the latest data entry |
|
216 | + * |
|
217 | + * @return Array the spotter information |
|
218 | + * |
|
219 | + */ |
|
220 | 220 | public function getLatestMarineData($limit = '', $sort = '', $filter = array()) |
221 | 221 | { |
222 | 222 | global $global_query; |
@@ -274,11 +274,11 @@ discard block |
||
274 | 274 | } |
275 | 275 | |
276 | 276 | /** |
277 | - * Gets all the spotter information based on the callsign |
|
278 | - * |
|
279 | - * @return Array the spotter information |
|
280 | - * |
|
281 | - */ |
|
277 | + * Gets all the spotter information based on the callsign |
|
278 | + * |
|
279 | + * @return Array the spotter information |
|
280 | + * |
|
281 | + */ |
|
282 | 282 | public function getMarineDataByIdent($ident = '', $limit = '', $sort = '', $filter = array()) |
283 | 283 | { |
284 | 284 | global $global_query; |
@@ -389,12 +389,12 @@ discard block |
||
389 | 389 | |
390 | 390 | |
391 | 391 | /** |
392 | - * Gets all source name |
|
393 | - * |
|
394 | - * @param String type format of source |
|
395 | - * @return Array list of source name |
|
396 | - * |
|
397 | - */ |
|
392 | + * Gets all source name |
|
393 | + * |
|
394 | + * @param String type format of source |
|
395 | + * @return Array list of source name |
|
396 | + * |
|
397 | + */ |
|
398 | 398 | public function getAllSourceName($type = '',$filters = array()) |
399 | 399 | { |
400 | 400 | $filter_query = $this->getFilter($filters,true,true); |
@@ -424,11 +424,11 @@ discard block |
||
424 | 424 | |
425 | 425 | |
426 | 426 | /** |
427 | - * Gets a list of all idents/callsigns |
|
428 | - * |
|
429 | - * @return Array list of ident/callsign names |
|
430 | - * |
|
431 | - */ |
|
427 | + * Gets a list of all idents/callsigns |
|
428 | + * |
|
429 | + * @return Array list of ident/callsign names |
|
430 | + * |
|
431 | + */ |
|
432 | 432 | public function getAllIdents($filters = array()) |
433 | 433 | { |
434 | 434 | $filter_query = $this->getFilter($filters,true,true); |
@@ -452,11 +452,11 @@ discard block |
||
452 | 452 | } |
453 | 453 | |
454 | 454 | /** |
455 | - * Gets all info from a mmsi |
|
456 | - * |
|
457 | - * @return Array list of mmsi info |
|
458 | - * |
|
459 | - */ |
|
455 | + * Gets all info from a mmsi |
|
456 | + * |
|
457 | + * @return Array list of mmsi info |
|
458 | + * |
|
459 | + */ |
|
460 | 460 | public function getIdentity($mmsi) |
461 | 461 | { |
462 | 462 | $mmsi = filter_var($mmsi,FILTER_SANITIZE_NUMBER_INT); |
@@ -513,18 +513,18 @@ discard block |
||
513 | 513 | |
514 | 514 | |
515 | 515 | /** |
516 | - * Update ident tracker data |
|
517 | - * |
|
518 | - * @param String $fammarine_id the ID |
|
519 | - * @param String $ident the marine ident |
|
520 | - * @return String success or false |
|
521 | - * |
|
522 | - */ |
|
516 | + * Update ident tracker data |
|
517 | + * |
|
518 | + * @param String $fammarine_id the ID |
|
519 | + * @param String $ident the marine ident |
|
520 | + * @return String success or false |
|
521 | + * |
|
522 | + */ |
|
523 | 523 | public function updateIdentMarineData($fammarine_id = '', $ident = '',$fromsource = NULL) |
524 | 524 | { |
525 | 525 | |
526 | 526 | $query = 'UPDATE marine_output SET ident = :ident WHERE fammarine_id = :fammarine_id'; |
527 | - $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident); |
|
527 | + $query_values = array(':fammarine_id' => $fammarine_id,':ident' => $ident); |
|
528 | 528 | |
529 | 529 | try { |
530 | 530 | $sth = $this->db->prepare($query); |
@@ -537,17 +537,17 @@ discard block |
||
537 | 537 | |
538 | 538 | } |
539 | 539 | /** |
540 | - * Update latest marine data |
|
541 | - * |
|
542 | - * @param String $fammarine_id the ID |
|
543 | - * @param String $ident the marine ident |
|
544 | - * @return String success or false |
|
545 | - * |
|
546 | - */ |
|
540 | + * Update latest marine data |
|
541 | + * |
|
542 | + * @param String $fammarine_id the ID |
|
543 | + * @param String $ident the marine ident |
|
544 | + * @return String success or false |
|
545 | + * |
|
546 | + */ |
|
547 | 547 | public function updateLatestMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $groundspeed = NULL, $date = '') |
548 | 548 | { |
549 | 549 | $query = 'UPDATE marine_output SET ident = :ident, last_latitude = :last_latitude, last_longitude = :last_longitude, last_seen = :last_seen, last_ground_speed = :last_ground_speed WHERE fammarine_id = :fammarine_id'; |
550 | - $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
550 | + $query_values = array(':fammarine_id' => $fammarine_id,':last_latitude' => $latitude,':last_longitude' => $longitude, ':last_ground_speed' => $groundspeed,':last_seen' => $date,':ident' => $ident); |
|
551 | 551 | |
552 | 552 | try { |
553 | 553 | $sth = $this->db->prepare($query); |
@@ -561,30 +561,30 @@ discard block |
||
561 | 561 | } |
562 | 562 | |
563 | 563 | /** |
564 | - * Adds a new spotter data |
|
565 | - * |
|
566 | - * @param String $fammarine_id the ID |
|
567 | - * @param String $ident the marine ident |
|
568 | - * @param String $departure_airport_icao the departure airport |
|
569 | - * @param String $arrival_airport_icao the arrival airport |
|
570 | - * @param String $latitude latitude of flight |
|
571 | - * @param String $longitude latitude of flight |
|
572 | - * @param String $waypoints waypoints of flight |
|
573 | - * @param String $heading heading of flight |
|
574 | - * @param String $groundspeed speed of flight |
|
575 | - * @param String $date date of flight |
|
576 | - * @param String $departure_airport_time departure time of flight |
|
577 | - * @param String $arrival_airport_time arrival time of flight |
|
578 | - * @param String $squawk squawk code of flight |
|
579 | - * @param String $route_stop route stop of flight |
|
580 | - * @param String $highlight highlight or not |
|
581 | - * @param String $ModeS ModesS code of flight |
|
582 | - * @param String $registration registration code of flight |
|
583 | - * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
584 | - * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
585 | - * @param String $verticalrate vertival rate of flight |
|
586 | - * @return String success or false |
|
587 | - */ |
|
564 | + * Adds a new spotter data |
|
565 | + * |
|
566 | + * @param String $fammarine_id the ID |
|
567 | + * @param String $ident the marine ident |
|
568 | + * @param String $departure_airport_icao the departure airport |
|
569 | + * @param String $arrival_airport_icao the arrival airport |
|
570 | + * @param String $latitude latitude of flight |
|
571 | + * @param String $longitude latitude of flight |
|
572 | + * @param String $waypoints waypoints of flight |
|
573 | + * @param String $heading heading of flight |
|
574 | + * @param String $groundspeed speed of flight |
|
575 | + * @param String $date date of flight |
|
576 | + * @param String $departure_airport_time departure time of flight |
|
577 | + * @param String $arrival_airport_time arrival time of flight |
|
578 | + * @param String $squawk squawk code of flight |
|
579 | + * @param String $route_stop route stop of flight |
|
580 | + * @param String $highlight highlight or not |
|
581 | + * @param String $ModeS ModesS code of flight |
|
582 | + * @param String $registration registration code of flight |
|
583 | + * @param String $pilot_id pilot id of flight (for virtual airlines) |
|
584 | + * @param String $pilot_name pilot name of flight (for virtual airlines) |
|
585 | + * @param String $verticalrate vertival rate of flight |
|
586 | + * @return String success or false |
|
587 | + */ |
|
588 | 588 | public function addMarineData($fammarine_id = '', $ident = '', $latitude = '', $longitude = '', $heading = '', $groundspeed = '', $date = '', $mmsi = '',$type = '',$typeid = '',$imo = '',$callsign = '',$arrival_code = '',$arrival_date = '',$status = '',$format_source = '', $source_name = '') |
589 | 589 | { |
590 | 590 | global $globalURL, $globalMarineImageFetch; |
@@ -681,13 +681,13 @@ discard block |
||
681 | 681 | unset($Image); |
682 | 682 | } |
683 | 683 | |
684 | - if ($latitude == '' && $longitude == '') { |
|
685 | - $latitude = 0; |
|
686 | - $longitude = 0; |
|
687 | - } |
|
688 | - if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
689 | - if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
690 | - if ($arrival_date == '') $arrival_date = NULL; |
|
684 | + if ($latitude == '' && $longitude == '') { |
|
685 | + $latitude = 0; |
|
686 | + $longitude = 0; |
|
687 | + } |
|
688 | + if ($heading == '' || $Common->isInteger($heading) === false) $heading = 0; |
|
689 | + if ($groundspeed == '' || $Common->isInteger($groundspeed) === false) $groundspeed = 0; |
|
690 | + if ($arrival_date == '') $arrival_date = NULL; |
|
691 | 691 | $query = "INSERT INTO marine_output (fammarine_id, ident, latitude, longitude, heading, ground_speed, date, format_source, source_name, mmsi, type, status,imo,arrival_port_name,arrival_port_date) |
692 | 692 | VALUES (:fammarine_id,:ident,:latitude,:longitude,:heading,:speed,:date,:format_source, :source_name,:mmsi,:type,:status,:imo,:arrival_port_name,:arrival_port_date)"; |
693 | 693 | |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | $sth->execute($query_values); |
699 | 699 | $this->db = null; |
700 | 700 | } catch (PDOException $e) { |
701 | - return "error : ".$e->getMessage(); |
|
701 | + return "error : ".$e->getMessage(); |
|
702 | 702 | } |
703 | 703 | |
704 | 704 | return "success"; |
@@ -707,11 +707,11 @@ discard block |
||
707 | 707 | |
708 | 708 | |
709 | 709 | /** |
710 | - * Gets the aircraft ident within the last hour |
|
711 | - * |
|
712 | - * @return String the ident |
|
713 | - * |
|
714 | - */ |
|
710 | + * Gets the aircraft ident within the last hour |
|
711 | + * |
|
712 | + * @return String the ident |
|
713 | + * |
|
714 | + */ |
|
715 | 715 | public function getIdentFromLastHour($ident) |
716 | 716 | { |
717 | 717 | global $globalDBdriver, $globalTimezone; |
@@ -727,11 +727,11 @@ discard block |
||
727 | 727 | AND marine_output.date >= now() AT TIME ZONE 'UTC' - INTERVAL '1 HOURS' |
728 | 728 | AND marine_output.date < now() AT TIME ZONE 'UTC'"; |
729 | 729 | $query_data = array(':ident' => $ident); |
730 | - } |
|
730 | + } |
|
731 | 731 | |
732 | 732 | $sth = $this->db->prepare($query); |
733 | 733 | $sth->execute($query_data); |
734 | - $ident_result=''; |
|
734 | + $ident_result=''; |
|
735 | 735 | while($row = $sth->fetch(PDO::FETCH_ASSOC)) |
736 | 736 | { |
737 | 737 | $ident_result = $row['ident']; |
@@ -742,11 +742,11 @@ discard block |
||
742 | 742 | |
743 | 743 | |
744 | 744 | /** |
745 | - * Gets the aircraft data from the last 20 seconds |
|
746 | - * |
|
747 | - * @return Array the spotter data |
|
748 | - * |
|
749 | - */ |
|
745 | + * Gets the aircraft data from the last 20 seconds |
|
746 | + * |
|
747 | + * @return Array the spotter data |
|
748 | + * |
|
749 | + */ |
|
750 | 750 | public function getRealTimeData($q = '') |
751 | 751 | { |
752 | 752 | global $globalDBdriver; |
@@ -784,11 +784,11 @@ discard block |
||
784 | 784 | |
785 | 785 | |
786 | 786 | /** |
787 | - * Gets all number of flight over countries |
|
788 | - * |
|
789 | - * @return Array the airline country list |
|
790 | - * |
|
791 | - */ |
|
787 | + * Gets all number of flight over countries |
|
788 | + * |
|
789 | + * @return Array the airline country list |
|
790 | + * |
|
791 | + */ |
|
792 | 792 | /* |
793 | 793 | public function countAllTrackedOverCountries($limit = true,$olderthanmonths = 0,$sincedate = '',$filters = array()) |
794 | 794 | { |
@@ -839,11 +839,11 @@ discard block |
||
839 | 839 | |
840 | 840 | |
841 | 841 | /** |
842 | - * Gets all callsigns that have flown over |
|
843 | - * |
|
844 | - * @return Array the callsign list |
|
845 | - * |
|
846 | - */ |
|
842 | + * Gets all callsigns that have flown over |
|
843 | + * |
|
844 | + * @return Array the callsign list |
|
845 | + * |
|
846 | + */ |
|
847 | 847 | public function countAllCallsigns($limit = true, $olderthanmonths = 0, $sincedate = '',$filters = array(),$year = '', $month = '', $day = '') |
848 | 848 | { |
849 | 849 | global $globalDBdriver; |
@@ -910,11 +910,11 @@ discard block |
||
910 | 910 | |
911 | 911 | |
912 | 912 | /** |
913 | - * Counts all dates |
|
914 | - * |
|
915 | - * @return Array the date list |
|
916 | - * |
|
917 | - */ |
|
913 | + * Counts all dates |
|
914 | + * |
|
915 | + * @return Array the date list |
|
916 | + * |
|
917 | + */ |
|
918 | 918 | public function countAllDates($filters = array()) |
919 | 919 | { |
920 | 920 | global $globalTimezone, $globalDBdriver; |
@@ -960,11 +960,11 @@ discard block |
||
960 | 960 | |
961 | 961 | |
962 | 962 | /** |
963 | - * Counts all dates during the last 7 days |
|
964 | - * |
|
965 | - * @return Array the date list |
|
966 | - * |
|
967 | - */ |
|
963 | + * Counts all dates during the last 7 days |
|
964 | + * |
|
965 | + * @return Array the date list |
|
966 | + * |
|
967 | + */ |
|
968 | 968 | public function countAllDatesLast7Days($filters = array()) |
969 | 969 | { |
970 | 970 | global $globalTimezone, $globalDBdriver; |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | $query .= " GROUP BY date_name |
987 | 987 | ORDER BY date_name ASC"; |
988 | 988 | $query_data = array(':offset' => $offset); |
989 | - } |
|
989 | + } |
|
990 | 990 | |
991 | 991 | $sth = $this->db->prepare($query); |
992 | 992 | $sth->execute($query_data); |
@@ -1006,11 +1006,11 @@ discard block |
||
1006 | 1006 | } |
1007 | 1007 | |
1008 | 1008 | /** |
1009 | - * Counts all dates during the last month |
|
1010 | - * |
|
1011 | - * @return Array the date list |
|
1012 | - * |
|
1013 | - */ |
|
1009 | + * Counts all dates during the last month |
|
1010 | + * |
|
1011 | + * @return Array the date list |
|
1012 | + * |
|
1013 | + */ |
|
1014 | 1014 | public function countAllDatesLastMonth($filters = array()) |
1015 | 1015 | { |
1016 | 1016 | global $globalTimezone, $globalDBdriver; |
@@ -1032,7 +1032,7 @@ discard block |
||
1032 | 1032 | $query .= " GROUP BY date_name |
1033 | 1033 | ORDER BY date_name ASC"; |
1034 | 1034 | $query_data = array(':offset' => $offset); |
1035 | - } |
|
1035 | + } |
|
1036 | 1036 | |
1037 | 1037 | $sth = $this->db->prepare($query); |
1038 | 1038 | $sth->execute($query_data); |
@@ -1054,11 +1054,11 @@ discard block |
||
1054 | 1054 | |
1055 | 1055 | |
1056 | 1056 | /** |
1057 | - * Counts all month |
|
1058 | - * |
|
1059 | - * @return Array the month list |
|
1060 | - * |
|
1061 | - */ |
|
1057 | + * Counts all month |
|
1058 | + * |
|
1059 | + * @return Array the month list |
|
1060 | + * |
|
1061 | + */ |
|
1062 | 1062 | public function countAllMonths($filters = array()) |
1063 | 1063 | { |
1064 | 1064 | global $globalTimezone, $globalDBdriver; |
@@ -1103,11 +1103,11 @@ discard block |
||
1103 | 1103 | |
1104 | 1104 | |
1105 | 1105 | /** |
1106 | - * Counts all dates during the last year |
|
1107 | - * |
|
1108 | - * @return Array the date list |
|
1109 | - * |
|
1110 | - */ |
|
1106 | + * Counts all dates during the last year |
|
1107 | + * |
|
1108 | + * @return Array the date list |
|
1109 | + * |
|
1110 | + */ |
|
1111 | 1111 | public function countAllMonthsLastYear($filters) |
1112 | 1112 | { |
1113 | 1113 | global $globalTimezone, $globalDBdriver; |
@@ -1129,7 +1129,7 @@ discard block |
||
1129 | 1129 | $query .= " GROUP BY year_name, month_name |
1130 | 1130 | ORDER BY year_name, month_name ASC"; |
1131 | 1131 | $query_data = array(':offset' => $offset); |
1132 | - } |
|
1132 | + } |
|
1133 | 1133 | |
1134 | 1134 | $sth = $this->db->prepare($query); |
1135 | 1135 | $sth->execute($query_data); |
@@ -1152,11 +1152,11 @@ discard block |
||
1152 | 1152 | |
1153 | 1153 | |
1154 | 1154 | /** |
1155 | - * Counts all hours |
|
1156 | - * |
|
1157 | - * @return Array the hour list |
|
1158 | - * |
|
1159 | - */ |
|
1155 | + * Counts all hours |
|
1156 | + * |
|
1157 | + * @return Array the hour list |
|
1158 | + * |
|
1159 | + */ |
|
1160 | 1160 | public function countAllHours($orderby,$filters = array()) |
1161 | 1161 | { |
1162 | 1162 | global $globalTimezone, $globalDBdriver; |
@@ -1219,11 +1219,11 @@ discard block |
||
1219 | 1219 | |
1220 | 1220 | |
1221 | 1221 | /** |
1222 | - * Counts all hours by date |
|
1223 | - * |
|
1224 | - * @return Array the hour list |
|
1225 | - * |
|
1226 | - */ |
|
1222 | + * Counts all hours by date |
|
1223 | + * |
|
1224 | + * @return Array the hour list |
|
1225 | + * |
|
1226 | + */ |
|
1227 | 1227 | public function countAllHoursByDate($date, $filters = array()) |
1228 | 1228 | { |
1229 | 1229 | global $globalTimezone, $globalDBdriver; |
@@ -1267,11 +1267,11 @@ discard block |
||
1267 | 1267 | |
1268 | 1268 | |
1269 | 1269 | /** |
1270 | - * Counts all hours by a ident/callsign |
|
1271 | - * |
|
1272 | - * @return Array the hour list |
|
1273 | - * |
|
1274 | - */ |
|
1270 | + * Counts all hours by a ident/callsign |
|
1271 | + * |
|
1272 | + * @return Array the hour list |
|
1273 | + * |
|
1274 | + */ |
|
1275 | 1275 | public function countAllHoursByIdent($ident, $filters = array()) |
1276 | 1276 | { |
1277 | 1277 | global $globalTimezone, $globalDBdriver; |
@@ -1316,11 +1316,11 @@ discard block |
||
1316 | 1316 | |
1317 | 1317 | |
1318 | 1318 | /** |
1319 | - * Counts all flights that have flown over |
|
1320 | - * |
|
1321 | - * @return Integer the number of flights |
|
1322 | - * |
|
1323 | - */ |
|
1319 | + * Counts all flights that have flown over |
|
1320 | + * |
|
1321 | + * @return Integer the number of flights |
|
1322 | + * |
|
1323 | + */ |
|
1324 | 1324 | public function countOverallTracked($filters = array(),$year = '',$month = '') |
1325 | 1325 | { |
1326 | 1326 | global $globalDBdriver; |
@@ -1355,11 +1355,11 @@ discard block |
||
1355 | 1355 | |
1356 | 1356 | |
1357 | 1357 | /** |
1358 | - * Counts all hours of today |
|
1359 | - * |
|
1360 | - * @return Array the hour list |
|
1361 | - * |
|
1362 | - */ |
|
1358 | + * Counts all hours of today |
|
1359 | + * |
|
1360 | + * @return Array the hour list |
|
1361 | + * |
|
1362 | + */ |
|
1363 | 1363 | public function countAllHoursFromToday($filters = array()) |
1364 | 1364 | { |
1365 | 1365 | global $globalTimezone, $globalDBdriver; |
@@ -1399,12 +1399,12 @@ discard block |
||
1399 | 1399 | } |
1400 | 1400 | |
1401 | 1401 | |
1402 | - /** |
|
1403 | - * Gets the Barrie Spotter ID based on the FlightAware ID |
|
1404 | - * |
|
1405 | - * @return Integer the Barrie Spotter ID |
|
1402 | + /** |
|
1403 | + * Gets the Barrie Spotter ID based on the FlightAware ID |
|
1404 | + * |
|
1405 | + * @return Integer the Barrie Spotter ID |
|
1406 | 1406 | q * |
1407 | - */ |
|
1407 | + */ |
|
1408 | 1408 | public function getMarineIDBasedOnFamMarineID($fammarine_id) |
1409 | 1409 | { |
1410 | 1410 | $fammarine_id = filter_var($fammarine_id,FILTER_SANITIZE_STRING); |
@@ -1425,13 +1425,13 @@ discard block |
||
1425 | 1425 | |
1426 | 1426 | |
1427 | 1427 | /** |
1428 | - * Parses a date string |
|
1429 | - * |
|
1430 | - * @param String $dateString the date string |
|
1431 | - * @param String $timezone the timezone of a user |
|
1432 | - * @return Array the time information |
|
1433 | - * |
|
1434 | - */ |
|
1428 | + * Parses a date string |
|
1429 | + * |
|
1430 | + * @param String $dateString the date string |
|
1431 | + * @param String $timezone the timezone of a user |
|
1432 | + * @return Array the time information |
|
1433 | + * |
|
1434 | + */ |
|
1435 | 1435 | public function parseDateString($dateString, $timezone = '') |
1436 | 1436 | { |
1437 | 1437 | $time_array = array(); |
@@ -1464,12 +1464,12 @@ discard block |
||
1464 | 1464 | } |
1465 | 1465 | |
1466 | 1466 | /** |
1467 | - * Parses the direction degrees to working |
|
1468 | - * |
|
1469 | - * @param Float $direction the direction in degrees |
|
1470 | - * @return Array the direction information |
|
1471 | - * |
|
1472 | - */ |
|
1467 | + * Parses the direction degrees to working |
|
1468 | + * |
|
1469 | + * @param Float $direction the direction in degrees |
|
1470 | + * @return Array the direction information |
|
1471 | + * |
|
1472 | + */ |
|
1473 | 1473 | public function parseDirection($direction = 0) |
1474 | 1474 | { |
1475 | 1475 | if ($direction == '') $direction = 0; |
@@ -1548,12 +1548,12 @@ discard block |
||
1548 | 1548 | |
1549 | 1549 | |
1550 | 1550 | /** |
1551 | - * Gets Country from latitude/longitude |
|
1552 | - * |
|
1553 | - * @param Float $latitude latitute of the flight |
|
1554 | - * @param Float $longitude longitute of the flight |
|
1555 | - * @return String the countrie |
|
1556 | - */ |
|
1551 | + * Gets Country from latitude/longitude |
|
1552 | + * |
|
1553 | + * @param Float $latitude latitute of the flight |
|
1554 | + * @param Float $longitude longitute of the flight |
|
1555 | + * @return String the countrie |
|
1556 | + */ |
|
1557 | 1557 | public function getCountryFromLatitudeLongitude($latitude,$longitude) |
1558 | 1558 | { |
1559 | 1559 | global $globalDBdriver, $globalDebug; |
@@ -1590,11 +1590,11 @@ discard block |
||
1590 | 1590 | } |
1591 | 1591 | |
1592 | 1592 | /** |
1593 | - * Gets Country from iso2 |
|
1594 | - * |
|
1595 | - * @param String $iso2 ISO2 country code |
|
1596 | - * @return String the countrie |
|
1597 | - */ |
|
1593 | + * Gets Country from iso2 |
|
1594 | + * |
|
1595 | + * @param String $iso2 ISO2 country code |
|
1596 | + * @return String the countrie |
|
1597 | + */ |
|
1598 | 1598 | public function getCountryFromISO2($iso2) |
1599 | 1599 | { |
1600 | 1600 | global $globalDBdriver, $globalDebug; |
@@ -1623,12 +1623,12 @@ discard block |
||
1623 | 1623 | |
1624 | 1624 | |
1625 | 1625 | /** |
1626 | - * Gets the short url from bit.ly |
|
1627 | - * |
|
1628 | - * @param String $url the full url |
|
1629 | - * @return String the bit.ly url |
|
1630 | - * |
|
1631 | - */ |
|
1626 | + * Gets the short url from bit.ly |
|
1627 | + * |
|
1628 | + * @param String $url the full url |
|
1629 | + * @return String the bit.ly url |
|
1630 | + * |
|
1631 | + */ |
|
1632 | 1632 | public function getBitlyURL($url) |
1633 | 1633 | { |
1634 | 1634 | global $globalBitlyAccessToken; |
@@ -7,35 +7,35 @@ discard block |
||
7 | 7 | public $latest_schema = 38; |
8 | 8 | |
9 | 9 | public function __construct($dbc = null,$dbname = null,$user = null,$pass = null) { |
10 | - global $globalDBdriver, $globalNoDB; |
|
11 | - if (isset($globalNoDB) && $globalNoDB === TRUE) { |
|
10 | + global $globalDBdriver, $globalNoDB; |
|
11 | + if (isset($globalNoDB) && $globalNoDB === TRUE) { |
|
12 | 12 | $this->db = null; |
13 | - } else { |
|
13 | + } else { |
|
14 | 14 | if ($dbc === null) { |
15 | - if ($this->db === null && $dbname === null) { |
|
15 | + if ($this->db === null && $dbname === null) { |
|
16 | 16 | if ($user === null && $pass === null) { |
17 | - $this->createDBConnection(); |
|
17 | + $this->createDBConnection(); |
|
18 | 18 | } else { |
19 | - $this->createDBConnection(null,$user,$pass); |
|
19 | + $this->createDBConnection(null,$user,$pass); |
|
20 | 20 | } |
21 | - } else { |
|
21 | + } else { |
|
22 | 22 | $this->createDBConnection($dbname); |
23 | - } |
|
23 | + } |
|
24 | 24 | } elseif ($dbname === null || $dbname === 'default') { |
25 | - $this->db = $dbc; |
|
26 | - if ($this->connectionExists() === false) { |
|
25 | + $this->db = $dbc; |
|
26 | + if ($this->connectionExists() === false) { |
|
27 | 27 | /* |
28 | 28 | echo 'Restart Connection !!!'."\n"; |
29 | 29 | $e = new \Exception; |
30 | 30 | var_dump($e->getTraceAsString()); |
31 | 31 | */ |
32 | 32 | $this->createDBConnection(); |
33 | - } |
|
33 | + } |
|
34 | 34 | } else { |
35 | - //$this->connectionExists(); |
|
36 | - $this->dbs[$dbname] = $dbc; |
|
35 | + //$this->connectionExists(); |
|
36 | + $this->dbs[$dbname] = $dbc; |
|
37 | + } |
|
37 | 38 | } |
38 | - } |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | public function db() { |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
59 | - * Creates the database connection |
|
60 | - * |
|
61 | - * @return Boolean of the database connection |
|
62 | - * |
|
63 | - */ |
|
59 | + * Creates the database connection |
|
60 | + * |
|
61 | + * @return Boolean of the database connection |
|
62 | + * |
|
63 | + */ |
|
64 | 64 | |
65 | 65 | public function createDBConnection($DBname = null, $user = null, $pass = null) |
66 | 66 | { |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | return false; |
158 | 158 | } |
159 | 159 | if($results->rowCount()>0) { |
160 | - return true; |
|
160 | + return true; |
|
161 | 161 | } |
162 | 162 | else return false; |
163 | 163 | } |
@@ -174,14 +174,14 @@ discard block |
||
174 | 174 | $sum = $sum->fetchColumn(0); |
175 | 175 | } else $sum = 0; |
176 | 176 | if (intval($sum) !== 2) { |
177 | - return false; |
|
177 | + return false; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | } catch(PDOException $e) { |
181 | 181 | if($e->getCode() != 'HY000' || !stristr($e->getMessage(), 'server has gone away')) { |
182 | - throw $e; |
|
183 | - } |
|
184 | - //echo 'error ! '.$e->getMessage(); |
|
182 | + throw $e; |
|
183 | + } |
|
184 | + //echo 'error ! '.$e->getMessage(); |
|
185 | 185 | return false; |
186 | 186 | } |
187 | 187 | return true; |
@@ -285,8 +285,8 @@ discard block |
||
285 | 285 | $version = 0; |
286 | 286 | if ($this->tableExists('aircraft')) { |
287 | 287 | if (!$this->tableExists('config')) { |
288 | - $version = '1'; |
|
289 | - return $version; |
|
288 | + $version = '1'; |
|
289 | + return $version; |
|
290 | 290 | } else { |
291 | 291 | $query = "SELECT value FROM config WHERE name = 'schema_version' LIMIT 1"; |
292 | 292 | try { |
@@ -307,10 +307,10 @@ discard block |
||
307 | 307 | * @return Boolean if latest version or not |
308 | 308 | */ |
309 | 309 | public function latest() { |
310 | - global $globalNoDB; |
|
311 | - if (isset($globalNoDB) && $globalNoDB === TRUE) return true; |
|
312 | - if ($this->check_schema_version() == $this->latest_schema) return true; |
|
313 | - else return false; |
|
310 | + global $globalNoDB; |
|
311 | + if (isset($globalNoDB) && $globalNoDB === TRUE) return true; |
|
312 | + if ($this->check_schema_version() == $this->latest_schema) return true; |
|
313 | + else return false; |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | } |