@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | return ($dec); |
58 | 58 | } |
59 | 59 | |
60 | - /* |
|
60 | + /* |
|
61 | 61 | $ais_map64 = array( |
62 | 62 | '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', // 48 |
63 | 63 | ':', ';', '<', '=', '>', '?', '@', 'A', 'B', 'C', |
@@ -97,13 +97,13 @@ discard block |
||
97 | 97 | // ' ' --- '?', // 0x20 - 0x3F |
98 | 98 | // '@' --- '_', // 0x40 - 0x5F |
99 | 99 | $ais_chars = array( |
100 | - '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', |
|
101 | - 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', |
|
102 | - 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', |
|
103 | - '^', '_', ' ', '!', '\"', '#', '$', '%', '&', '\'', |
|
104 | - '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', |
|
105 | - '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', |
|
106 | - '<', '=', '>', '?' |
|
100 | + '@', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', |
|
101 | + 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', |
|
102 | + 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '[', '\\', ']', |
|
103 | + '^', '_', ' ', '!', '\"', '#', '$', '%', '&', '\'', |
|
104 | + '(', ')', '*', '+', ',', '-', '.', '/', '0', '1', |
|
105 | + '2', '3', '4', '5', '6', '7', '8', '9', ':', ';', |
|
106 | + '<', '=', '>', '?' |
|
107 | 107 | ); |
108 | 108 | // " |
109 | 109 | $rv = ''; |
@@ -421,8 +421,8 @@ discard block |
||
421 | 421 | } |
422 | 422 | if ($num_seq > 1) { // for multipart messages |
423 | 423 | if ($cmsg_sid != $msg_sid // different msg_sid |
424 | - || $msg_sid == -1 // invalid initial msg_sid |
|
425 | - || ($seq - $pseq) != 1 // not insequence |
|
424 | + || $msg_sid == -1 // invalid initial msg_sid |
|
425 | + || ($seq - $pseq) != 1 // not insequence |
|
426 | 426 | ) { // invalid for multipart message |
427 | 427 | $msg_sid = -1; |
428 | 428 | $cmsg_sid = -1; |
@@ -435,7 +435,7 @@ discard block |
||
435 | 435 | $itu = $itu.$pcs[5]; // get itu message |
436 | 436 | $filler += (int)$pcs[6][0]; // get filler |
437 | 437 | if ($num_seq == 1 // valid single message |
438 | - || $num_seq == $pseq // valid multi-part message |
|
438 | + || $num_seq == $pseq // valid multi-part message |
|
439 | 439 | ) { |
440 | 440 | /* |
441 | 441 | if ($num_seq != 1) { // test |
@@ -520,13 +520,13 @@ discard block |
||
520 | 520 | else $pad = ''; |
521 | 521 | $rv = ''; |
522 | 522 | $ais_chars = array( |
523 | - '@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9, |
|
524 | - 'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19, |
|
525 | - 'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26, '['=>27, '\\'=>28, ']'=>29, |
|
526 | - '^'=>30, '_'=>31, ' '=>32, '!'=>33, '\"'=>34, '#'=>35, '$'=>36, '%'=>37, '&'=>38, '\''=>39, |
|
527 | - '('=>40, ')'=>41, '*'=>42, '+'=>43, ','=>44, '-'=>45, '.'=>46, '/'=>47, '0'=>48, '1'=>49, |
|
528 | - '2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, ':'=>58, ';'=>59, |
|
529 | - '<'=>60, '='=>61, '>'=>62, '?'=>63 |
|
523 | + '@'=>0, 'A'=>1, 'B'=>2, 'C'=>3, 'D'=>4, 'E'=>5, 'F'=>6, 'G'=>7, 'H'=>8, 'I'=>9, |
|
524 | + 'J'=>10, 'K'=>11, 'L'=>12, 'M'=>13, 'N'=>14, 'O'=>15, 'P'=>16, 'Q'=>17, 'R'=>18, 'S'=>19, |
|
525 | + 'T'=>20, 'U'=>21, 'V'=>22, 'W'=>23, 'X'=>24, 'Y'=>25, 'Z'=>26, '['=>27, '\\'=>28, ']'=>29, |
|
526 | + '^'=>30, '_'=>31, ' '=>32, '!'=>33, '\"'=>34, '#'=>35, '$'=>36, '%'=>37, '&'=>38, '\''=>39, |
|
527 | + '('=>40, ')'=>41, '*'=>42, '+'=>43, ','=>44, '-'=>45, '.'=>46, '/'=>47, '0'=>48, '1'=>49, |
|
528 | + '2'=>50, '3'=>51, '4'=>52, '5'=>53, '6'=>54, '7'=>55, '8'=>56, '9'=>57, ':'=>58, ';'=>59, |
|
529 | + '<'=>60, '='=>61, '>'=>62, '?'=>63 |
|
530 | 530 | ); |
531 | 531 | // " |
532 | 532 | $_a = str_split($name); |
@@ -21,18 +21,18 @@ discard block |
||
21 | 21 | print '<div class="select-item">'; |
22 | 22 | print '<form action="'.$globalURL.'/aircraft" method="get">'; |
23 | 23 | print '<select name="aircraft_type" class="selectpicker" data-live-search="true">'; |
24 | - print '<option></option>'; |
|
25 | - $Stats = new Stats(); |
|
26 | - $aircraft_types = $Stats->getAllAircraftTypes(); |
|
27 | - if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
28 | - foreach($aircraft_types as $aircrafttype) |
|
29 | - { |
|
30 | - if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
31 | - { |
|
32 | - print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
33 | - } else { |
|
34 | - print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
35 | - } |
|
24 | + print '<option></option>'; |
|
25 | + $Stats = new Stats(); |
|
26 | + $aircraft_types = $Stats->getAllAircraftTypes(); |
|
27 | + if (empty($aircraft_types)) $aircraft_types = $Spotter->getAllAircraftTypes(); |
|
28 | + foreach($aircraft_types as $aircrafttype) |
|
29 | + { |
|
30 | + if($aircraft_type == $aircrafttype['aircraft_icao']) |
|
31 | + { |
|
32 | + print '<option value="'.$aircrafttype['aircraft_icao'].'" selected="selected">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
33 | + } else { |
|
34 | + print '<option value="'.$aircrafttype['aircraft_icao'].'">'.$aircrafttype['aircraft_name'].' ('.$aircrafttype['aircraft_icao'].')</option>'; |
|
35 | + } |
|
36 | 36 | } |
37 | 37 | print '</select>'; |
38 | 38 | print '<button type="submit"><i class="fa fa-angle-double-right"></i></button>'; |
@@ -61,18 +61,18 @@ discard block |
||
61 | 61 | print '<script type="text/javascript" src="'.$globalURL.'/js/datamaps.world.min.js"></script>'; |
62 | 62 | print '<div id="chartCountry" class="chart" width="100%"></div><script>'; |
63 | 63 | print 'var series = ['; |
64 | - $country_data = ''; |
|
64 | + $country_data = ''; |
|
65 | 65 | foreach($airline_array as $airline_item) |
66 | 66 | { |
67 | 67 | $country_data .= '[ "'.$airline_item['airline_country_iso3'].'",'.$airline_item['airline_country_count'].'],'; |
68 | 68 | } |
69 | - $country_data = substr($country_data, 0, -1); |
|
70 | - print $country_data; |
|
71 | - print '];'; |
|
72 | - print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
73 | - print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);'; |
|
74 | - print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});'; |
|
75 | - print 'new Datamap({ |
|
69 | + $country_data = substr($country_data, 0, -1); |
|
70 | + print $country_data; |
|
71 | + print '];'; |
|
72 | + print 'var dataset = {};var onlyValues = series.map(function(obj){ return obj[1]; });var minValue = Math.min.apply(null, onlyValues), maxValue = Math.max.apply(null, onlyValues);'; |
|
73 | + print 'var paletteScale = d3.scale.log().domain([minValue,maxValue]).range(["#EFEFFF","#001830"]);'; |
|
74 | + print 'series.forEach(function(item){var iso = item[0], value = item[1]; dataset[iso] = { numberOfThings: value, fillColor: paletteScale(value) };});'; |
|
75 | + print 'new Datamap({ |
|
76 | 76 | element: document.getElementById("chartCountry"), |
77 | 77 | projection: "mercator", // big world map |
78 | 78 | fills: { defaultFill: "#F5F5F5" }, |
@@ -868,7 +868,6 @@ discard block |
||
868 | 868 | * This tells SimplePie to ignore any file errors and fall back to cache |
869 | 869 | * instead. This only works if caching is enabled and cached content |
870 | 870 | * still exists. |
871 | - |
|
872 | 871 | * @param bool $enable Force use of cache on fail. |
873 | 872 | */ |
874 | 873 | public function force_cache_fallback($enable = false) |
@@ -1663,7 +1662,7 @@ discard block |
||
1663 | 1662 | // Now also do feed discovery, but if microformats were found don't |
1664 | 1663 | // overwrite the current value of file. |
1665 | 1664 | $discovered = $locate->find($this->autodiscovery, |
1666 | - $this->all_discovered_feeds); |
|
1665 | + $this->all_discovered_feeds); |
|
1667 | 1666 | if ($microformats) |
1668 | 1667 | { |
1669 | 1668 | if ($hub = $locate->get_rel_link('hub')) |
@@ -1928,8 +1927,8 @@ discard block |
||
1928 | 1927 | { |
1929 | 1928 | // sanitize encodes ampersands which are required when used in a url. |
1930 | 1929 | return str_replace('&', '&', |
1931 | - $this->sanitize($this->permanent_url, |
|
1932 | - SIMPLEPIE_CONSTRUCT_IRI)); |
|
1930 | + $this->sanitize($this->permanent_url, |
|
1931 | + SIMPLEPIE_CONSTRUCT_IRI)); |
|
1933 | 1932 | } |
1934 | 1933 | } |
1935 | 1934 | else |
@@ -1937,8 +1936,8 @@ discard block |
||
1937 | 1936 | if ($this->feed_url !== null) |
1938 | 1937 | { |
1939 | 1938 | return str_replace('&', '&', |
1940 | - $this->sanitize($this->feed_url, |
|
1941 | - SIMPLEPIE_CONSTRUCT_IRI)); |
|
1939 | + $this->sanitize($this->feed_url, |
|
1940 | + SIMPLEPIE_CONSTRUCT_IRI)); |
|
1942 | 1941 | } |
1943 | 1942 | } |
1944 | 1943 | return null; |
@@ -2597,8 +2596,8 @@ discard block |
||
2597 | 2596 | } |
2598 | 2597 | |
2599 | 2598 | if (isset($this->data['headers']['link']) && |
2600 | - preg_match('/<([^>]+)>; rel='.preg_quote($rel).'/', |
|
2601 | - $this->data['headers']['link'], $match)) |
|
2599 | + preg_match('/<([^>]+)>; rel='.preg_quote($rel).'/', |
|
2600 | + $this->data['headers']['link'], $match)) |
|
2602 | 2601 | { |
2603 | 2602 | return array($match[1]); |
2604 | 2603 | } |
@@ -3937,112 +3936,112 @@ discard block |
||
3937 | 3936 | */ |
3938 | 3937 | class SimplePie_Cache_Memcached implements SimplePie_Cache_Base |
3939 | 3938 | { |
3940 | - /** |
|
3941 | - * Memcached instance |
|
3942 | - * @var Memcached |
|
3943 | - */ |
|
3944 | - protected $cache; |
|
3945 | - |
|
3946 | - /** |
|
3947 | - * Options |
|
3948 | - * @var array |
|
3949 | - */ |
|
3950 | - protected $options; |
|
3951 | - |
|
3952 | - /** |
|
3953 | - * Cache name |
|
3954 | - * @var string |
|
3955 | - */ |
|
3956 | - protected $name; |
|
3957 | - |
|
3958 | - /** |
|
3959 | - * Create a new cache object |
|
3960 | - * @param string $location Location string (from SimplePie::$cache_location) |
|
3961 | - * @param string $name Unique ID for the cache |
|
3962 | - * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data |
|
3963 | - */ |
|
3964 | - public function __construct($location, $name, $type) { |
|
3965 | - $this->options = array( |
|
3966 | - 'host' => '127.0.0.1', |
|
3967 | - 'port' => 11211, |
|
3968 | - 'extras' => array( |
|
3969 | - 'timeout' => 3600, // one hour |
|
3970 | - 'prefix' => 'simplepie_', |
|
3971 | - ), |
|
3972 | - ); |
|
3973 | - $this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location)); |
|
3974 | - |
|
3975 | - $this->name = $this->options['extras']['prefix'] . md5("$name:$type"); |
|
3976 | - |
|
3977 | - $this->cache = new Memcached(); |
|
3978 | - $this->cache->addServer($this->options['host'], (int)$this->options['port']); |
|
3979 | - } |
|
3980 | - |
|
3981 | - /** |
|
3982 | - * Save data to the cache |
|
3983 | - * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property |
|
3984 | - * @return bool Successfulness |
|
3985 | - */ |
|
3986 | - public function save($data) { |
|
3987 | - if ($data instanceof SimplePie) { |
|
3988 | - $data = $data->data; |
|
3989 | - } |
|
3990 | - |
|
3991 | - return $this->setData(serialize($data)); |
|
3992 | - } |
|
3993 | - |
|
3994 | - /** |
|
3995 | - * Retrieve the data saved to the cache |
|
3996 | - * @return array Data for SimplePie::$data |
|
3997 | - */ |
|
3998 | - public function load() { |
|
3999 | - $data = $this->cache->get($this->name); |
|
4000 | - |
|
4001 | - if ($data !== false) { |
|
4002 | - return unserialize($data); |
|
4003 | - } |
|
4004 | - return false; |
|
4005 | - } |
|
4006 | - |
|
4007 | - /** |
|
4008 | - * Retrieve the last modified time for the cache |
|
4009 | - * @return int Timestamp |
|
4010 | - */ |
|
4011 | - public function mtime() { |
|
4012 | - $data = $this->cache->get($this->name . '_mtime'); |
|
4013 | - return (int) $data; |
|
4014 | - } |
|
4015 | - |
|
4016 | - /** |
|
4017 | - * Set the last modified time to the current time |
|
4018 | - * @return bool Success status |
|
4019 | - */ |
|
4020 | - public function touch() { |
|
4021 | - $data = $this->cache->get($this->name); |
|
4022 | - return $this->setData($data); |
|
4023 | - } |
|
4024 | - |
|
4025 | - /** |
|
4026 | - * Remove the cache |
|
4027 | - * @return bool Success status |
|
4028 | - */ |
|
4029 | - public function unlink() { |
|
4030 | - return $this->cache->delete($this->name, 0); |
|
4031 | - } |
|
4032 | - |
|
4033 | - /** |
|
4034 | - * Set the last modified time and data to Memcached |
|
4035 | - * @return bool Success status |
|
4036 | - */ |
|
4037 | - private function setData($data) { |
|
4038 | - |
|
4039 | - if ($data !== false) { |
|
4040 | - $this->cache->set($this->name . '_mtime', time(), (int)$this->options['extras']['timeout']); |
|
4041 | - return $this->cache->set($this->name, $data, (int)$this->options['extras']['timeout']); |
|
4042 | - } |
|
4043 | - |
|
4044 | - return false; |
|
4045 | - } |
|
3939 | + /** |
|
3940 | + * Memcached instance |
|
3941 | + * @var Memcached |
|
3942 | + */ |
|
3943 | + protected $cache; |
|
3944 | + |
|
3945 | + /** |
|
3946 | + * Options |
|
3947 | + * @var array |
|
3948 | + */ |
|
3949 | + protected $options; |
|
3950 | + |
|
3951 | + /** |
|
3952 | + * Cache name |
|
3953 | + * @var string |
|
3954 | + */ |
|
3955 | + protected $name; |
|
3956 | + |
|
3957 | + /** |
|
3958 | + * Create a new cache object |
|
3959 | + * @param string $location Location string (from SimplePie::$cache_location) |
|
3960 | + * @param string $name Unique ID for the cache |
|
3961 | + * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data |
|
3962 | + */ |
|
3963 | + public function __construct($location, $name, $type) { |
|
3964 | + $this->options = array( |
|
3965 | + 'host' => '127.0.0.1', |
|
3966 | + 'port' => 11211, |
|
3967 | + 'extras' => array( |
|
3968 | + 'timeout' => 3600, // one hour |
|
3969 | + 'prefix' => 'simplepie_', |
|
3970 | + ), |
|
3971 | + ); |
|
3972 | + $this->options = SimplePie_Misc::array_merge_recursive($this->options, SimplePie_Cache::parse_URL($location)); |
|
3973 | + |
|
3974 | + $this->name = $this->options['extras']['prefix'] . md5("$name:$type"); |
|
3975 | + |
|
3976 | + $this->cache = new Memcached(); |
|
3977 | + $this->cache->addServer($this->options['host'], (int)$this->options['port']); |
|
3978 | + } |
|
3979 | + |
|
3980 | + /** |
|
3981 | + * Save data to the cache |
|
3982 | + * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property |
|
3983 | + * @return bool Successfulness |
|
3984 | + */ |
|
3985 | + public function save($data) { |
|
3986 | + if ($data instanceof SimplePie) { |
|
3987 | + $data = $data->data; |
|
3988 | + } |
|
3989 | + |
|
3990 | + return $this->setData(serialize($data)); |
|
3991 | + } |
|
3992 | + |
|
3993 | + /** |
|
3994 | + * Retrieve the data saved to the cache |
|
3995 | + * @return array Data for SimplePie::$data |
|
3996 | + */ |
|
3997 | + public function load() { |
|
3998 | + $data = $this->cache->get($this->name); |
|
3999 | + |
|
4000 | + if ($data !== false) { |
|
4001 | + return unserialize($data); |
|
4002 | + } |
|
4003 | + return false; |
|
4004 | + } |
|
4005 | + |
|
4006 | + /** |
|
4007 | + * Retrieve the last modified time for the cache |
|
4008 | + * @return int Timestamp |
|
4009 | + */ |
|
4010 | + public function mtime() { |
|
4011 | + $data = $this->cache->get($this->name . '_mtime'); |
|
4012 | + return (int) $data; |
|
4013 | + } |
|
4014 | + |
|
4015 | + /** |
|
4016 | + * Set the last modified time to the current time |
|
4017 | + * @return bool Success status |
|
4018 | + */ |
|
4019 | + public function touch() { |
|
4020 | + $data = $this->cache->get($this->name); |
|
4021 | + return $this->setData($data); |
|
4022 | + } |
|
4023 | + |
|
4024 | + /** |
|
4025 | + * Remove the cache |
|
4026 | + * @return bool Success status |
|
4027 | + */ |
|
4028 | + public function unlink() { |
|
4029 | + return $this->cache->delete($this->name, 0); |
|
4030 | + } |
|
4031 | + |
|
4032 | + /** |
|
4033 | + * Set the last modified time and data to Memcached |
|
4034 | + * @return bool Success status |
|
4035 | + */ |
|
4036 | + private function setData($data) { |
|
4037 | + |
|
4038 | + if ($data !== false) { |
|
4039 | + $this->cache->set($this->name . '_mtime', time(), (int)$this->options['extras']['timeout']); |
|
4040 | + return $this->cache->set($this->name, $data, (int)$this->options['extras']['timeout']); |
|
4041 | + } |
|
4042 | + |
|
4043 | + return false; |
|
4044 | + } |
|
4046 | 4045 | } |
4047 | 4046 | |
4048 | 4047 | /** |
@@ -4471,143 +4470,143 @@ discard block |
||
4471 | 4470 | * @uses Redis |
4472 | 4471 | */ |
4473 | 4472 | class SimplePie_Cache_Redis implements SimplePie_Cache_Base { |
4474 | - /** |
|
4475 | - * Redis instance |
|
4476 | - * |
|
4477 | - * @var \Redis |
|
4478 | - */ |
|
4479 | - protected $cache; |
|
4480 | - |
|
4481 | - /** |
|
4482 | - * Options |
|
4483 | - * |
|
4484 | - * @var array |
|
4485 | - */ |
|
4486 | - protected $options; |
|
4487 | - |
|
4488 | - /** |
|
4489 | - * Cache name |
|
4490 | - * |
|
4491 | - * @var string |
|
4492 | - */ |
|
4493 | - protected $name; |
|
4494 | - |
|
4495 | - /** |
|
4496 | - * Cache Data |
|
4497 | - * |
|
4498 | - * @var type |
|
4499 | - */ |
|
4500 | - protected $data; |
|
4501 | - |
|
4502 | - /** |
|
4503 | - * Create a new cache object |
|
4504 | - * |
|
4505 | - * @param string $location Location string (from SimplePie::$cache_location) |
|
4506 | - * @param string $name Unique ID for the cache |
|
4507 | - * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data |
|
4508 | - */ |
|
4509 | - public function __construct($location, $name, $options = null) { |
|
4510 | - //$this->cache = \flow\simple\cache\Redis::getRedisClientInstance(); |
|
4511 | - $parsed = SimplePie_Cache::parse_URL($location); |
|
4512 | - $redis = new Redis(); |
|
4513 | - $redis->connect($parsed['host'], $parsed['port']); |
|
4514 | - $this->cache = $redis; |
|
4515 | - |
|
4516 | - if (!is_null($options) && is_array($options)) { |
|
4517 | - $this->options = $options; |
|
4518 | - } else { |
|
4519 | - $this->options = array ( |
|
4520 | - 'prefix' => 'rss:simple_primary:', |
|
4521 | - 'expire' => 0, |
|
4522 | - ); |
|
4523 | - } |
|
4524 | - |
|
4525 | - $this->name = $this->options['prefix'] . $name; |
|
4526 | - } |
|
4527 | - |
|
4528 | - /** |
|
4529 | - * @param \Redis $cache |
|
4530 | - */ |
|
4531 | - public function setRedisClient(\Redis $cache) { |
|
4532 | - $this->cache = $cache; |
|
4533 | - } |
|
4534 | - |
|
4535 | - /** |
|
4536 | - * Save data to the cache |
|
4537 | - * |
|
4538 | - * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property |
|
4539 | - * @return bool Successfulness |
|
4540 | - */ |
|
4541 | - public function save($data) { |
|
4542 | - if ($data instanceof SimplePie) { |
|
4543 | - $data = $data->data; |
|
4544 | - } |
|
4545 | - $response = $this->cache->set($this->name, serialize($data)); |
|
4546 | - if ($this->options['expire']) { |
|
4547 | - $this->cache->expire($this->name, $this->options['expire']); |
|
4548 | - } |
|
4549 | - |
|
4550 | - return $response; |
|
4551 | - } |
|
4552 | - |
|
4553 | - /** |
|
4554 | - * Retrieve the data saved to the cache |
|
4555 | - * |
|
4556 | - * @return array Data for SimplePie::$data |
|
4557 | - */ |
|
4558 | - public function load() { |
|
4559 | - $data = $this->cache->get($this->name); |
|
4560 | - |
|
4561 | - if ($data !== false) { |
|
4562 | - return unserialize($data); |
|
4563 | - } |
|
4564 | - return false; |
|
4565 | - } |
|
4566 | - |
|
4567 | - /** |
|
4568 | - * Retrieve the last modified time for the cache |
|
4569 | - * |
|
4570 | - * @return int Timestamp |
|
4571 | - */ |
|
4572 | - public function mtime() { |
|
4573 | - |
|
4574 | - $data = $this->cache->get($this->name); |
|
4575 | - |
|
4576 | - if ($data !== false) { |
|
4577 | - return time(); |
|
4578 | - } |
|
4579 | - |
|
4580 | - return false; |
|
4581 | - } |
|
4582 | - |
|
4583 | - /** |
|
4584 | - * Set the last modified time to the current time |
|
4585 | - * |
|
4586 | - * @return bool Success status |
|
4587 | - */ |
|
4588 | - public function touch() { |
|
4589 | - |
|
4590 | - $data = $this->cache->get($this->name); |
|
4591 | - |
|
4592 | - if ($data !== false) { |
|
4593 | - $return = $this->cache->set($this->name, $data); |
|
4594 | - if ($this->options['expire']) { |
|
4595 | - return $this->cache->expire($this->name, $this->ttl); |
|
4596 | - } |
|
4597 | - return $return; |
|
4598 | - } |
|
4599 | - |
|
4600 | - return false; |
|
4601 | - } |
|
4602 | - |
|
4603 | - /** |
|
4604 | - * Remove the cache |
|
4605 | - * |
|
4606 | - * @return bool Success status |
|
4607 | - */ |
|
4608 | - public function unlink() { |
|
4609 | - return $this->cache->set($this->name, null); |
|
4610 | - } |
|
4473 | + /** |
|
4474 | + * Redis instance |
|
4475 | + * |
|
4476 | + * @var \Redis |
|
4477 | + */ |
|
4478 | + protected $cache; |
|
4479 | + |
|
4480 | + /** |
|
4481 | + * Options |
|
4482 | + * |
|
4483 | + * @var array |
|
4484 | + */ |
|
4485 | + protected $options; |
|
4486 | + |
|
4487 | + /** |
|
4488 | + * Cache name |
|
4489 | + * |
|
4490 | + * @var string |
|
4491 | + */ |
|
4492 | + protected $name; |
|
4493 | + |
|
4494 | + /** |
|
4495 | + * Cache Data |
|
4496 | + * |
|
4497 | + * @var type |
|
4498 | + */ |
|
4499 | + protected $data; |
|
4500 | + |
|
4501 | + /** |
|
4502 | + * Create a new cache object |
|
4503 | + * |
|
4504 | + * @param string $location Location string (from SimplePie::$cache_location) |
|
4505 | + * @param string $name Unique ID for the cache |
|
4506 | + * @param string $type Either TYPE_FEED for SimplePie data, or TYPE_IMAGE for image data |
|
4507 | + */ |
|
4508 | + public function __construct($location, $name, $options = null) { |
|
4509 | + //$this->cache = \flow\simple\cache\Redis::getRedisClientInstance(); |
|
4510 | + $parsed = SimplePie_Cache::parse_URL($location); |
|
4511 | + $redis = new Redis(); |
|
4512 | + $redis->connect($parsed['host'], $parsed['port']); |
|
4513 | + $this->cache = $redis; |
|
4514 | + |
|
4515 | + if (!is_null($options) && is_array($options)) { |
|
4516 | + $this->options = $options; |
|
4517 | + } else { |
|
4518 | + $this->options = array ( |
|
4519 | + 'prefix' => 'rss:simple_primary:', |
|
4520 | + 'expire' => 0, |
|
4521 | + ); |
|
4522 | + } |
|
4523 | + |
|
4524 | + $this->name = $this->options['prefix'] . $name; |
|
4525 | + } |
|
4526 | + |
|
4527 | + /** |
|
4528 | + * @param \Redis $cache |
|
4529 | + */ |
|
4530 | + public function setRedisClient(\Redis $cache) { |
|
4531 | + $this->cache = $cache; |
|
4532 | + } |
|
4533 | + |
|
4534 | + /** |
|
4535 | + * Save data to the cache |
|
4536 | + * |
|
4537 | + * @param array|SimplePie $data Data to store in the cache. If passed a SimplePie object, only cache the $data property |
|
4538 | + * @return bool Successfulness |
|
4539 | + */ |
|
4540 | + public function save($data) { |
|
4541 | + if ($data instanceof SimplePie) { |
|
4542 | + $data = $data->data; |
|
4543 | + } |
|
4544 | + $response = $this->cache->set($this->name, serialize($data)); |
|
4545 | + if ($this->options['expire']) { |
|
4546 | + $this->cache->expire($this->name, $this->options['expire']); |
|
4547 | + } |
|
4548 | + |
|
4549 | + return $response; |
|
4550 | + } |
|
4551 | + |
|
4552 | + /** |
|
4553 | + * Retrieve the data saved to the cache |
|
4554 | + * |
|
4555 | + * @return array Data for SimplePie::$data |
|
4556 | + */ |
|
4557 | + public function load() { |
|
4558 | + $data = $this->cache->get($this->name); |
|
4559 | + |
|
4560 | + if ($data !== false) { |
|
4561 | + return unserialize($data); |
|
4562 | + } |
|
4563 | + return false; |
|
4564 | + } |
|
4565 | + |
|
4566 | + /** |
|
4567 | + * Retrieve the last modified time for the cache |
|
4568 | + * |
|
4569 | + * @return int Timestamp |
|
4570 | + */ |
|
4571 | + public function mtime() { |
|
4572 | + |
|
4573 | + $data = $this->cache->get($this->name); |
|
4574 | + |
|
4575 | + if ($data !== false) { |
|
4576 | + return time(); |
|
4577 | + } |
|
4578 | + |
|
4579 | + return false; |
|
4580 | + } |
|
4581 | + |
|
4582 | + /** |
|
4583 | + * Set the last modified time to the current time |
|
4584 | + * |
|
4585 | + * @return bool Success status |
|
4586 | + */ |
|
4587 | + public function touch() { |
|
4588 | + |
|
4589 | + $data = $this->cache->get($this->name); |
|
4590 | + |
|
4591 | + if ($data !== false) { |
|
4592 | + $return = $this->cache->set($this->name, $data); |
|
4593 | + if ($this->options['expire']) { |
|
4594 | + return $this->cache->expire($this->name, $this->ttl); |
|
4595 | + } |
|
4596 | + return $return; |
|
4597 | + } |
|
4598 | + |
|
4599 | + return false; |
|
4600 | + } |
|
4601 | + |
|
4602 | + /** |
|
4603 | + * Remove the cache |
|
4604 | + * |
|
4605 | + * @return bool Success status |
|
4606 | + */ |
|
4607 | + public function unlink() { |
|
4608 | + return $this->cache->set($this->name, null); |
|
4609 | + } |
|
4611 | 4610 | |
4612 | 4611 | } |
4613 | 4612 | |
@@ -8269,9 +8268,9 @@ discard block |
||
8269 | 8268 | * Clean up |
8270 | 8269 | */ |
8271 | 8270 | public function __destruct() { |
8272 | - $this->set_iri(null, true); |
|
8273 | - $this->set_path(null, true); |
|
8274 | - $this->set_authority(null, true); |
|
8271 | + $this->set_iri(null, true); |
|
8272 | + $this->set_path(null, true); |
|
8273 | + $this->set_authority(null, true); |
|
8275 | 8274 | } |
8276 | 8275 | |
8277 | 8276 | /** |
@@ -8794,9 +8793,9 @@ discard block |
||
8794 | 8793 | // Relative urls cannot have a colon in the first path segment (and the |
8795 | 8794 | // slashes themselves are not included so skip the first character). |
8796 | 8795 | if (!$this->scheme && !$isauthority && |
8797 | - strpos($this->ipath, ':') !== false && |
|
8798 | - strpos($this->ipath, '/', 1) !== false && |
|
8799 | - strpos($this->ipath, ':') < strpos($this->ipath, '/', 1)) return false; |
|
8796 | + strpos($this->ipath, ':') !== false && |
|
8797 | + strpos($this->ipath, '/', 1) !== false && |
|
8798 | + strpos($this->ipath, ':') < strpos($this->ipath, '/', 1)) return false; |
|
8800 | 8799 | |
8801 | 8800 | return true; |
8802 | 8801 | } |
@@ -9469,7 +9468,7 @@ discard block |
||
9469 | 9468 | $fn = 'md5'; |
9470 | 9469 | } |
9471 | 9470 | return call_user_func($fn, |
9472 | - $this->get_permalink().$this->get_title().$this->get_content()); |
|
9471 | + $this->get_permalink().$this->get_title().$this->get_content()); |
|
9473 | 9472 | } |
9474 | 9473 | |
9475 | 9474 | /** |
@@ -9538,47 +9537,47 @@ discard block |
||
9538 | 9537 | public function get_description($description_only = false) |
9539 | 9538 | { |
9540 | 9539 | if (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary')) && |
9541 | - ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) |
|
9540 | + ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) |
|
9542 | 9541 | { |
9543 | 9542 | return $return; |
9544 | 9543 | } |
9545 | 9544 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary')) && |
9546 | - ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) |
|
9545 | + ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) |
|
9547 | 9546 | { |
9548 | 9547 | return $return; |
9549 | 9548 | } |
9550 | 9549 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description')) && |
9551 | - ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($tags[0])))) |
|
9550 | + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($tags[0])))) |
|
9552 | 9551 | { |
9553 | 9552 | return $return; |
9554 | 9553 | } |
9555 | 9554 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description')) && |
9556 | - ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0])))) |
|
9555 | + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0])))) |
|
9557 | 9556 | { |
9558 | 9557 | return $return; |
9559 | 9558 | } |
9560 | 9559 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description')) && |
9561 | - ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT))) |
|
9560 | + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT))) |
|
9562 | 9561 | { |
9563 | 9562 | return $return; |
9564 | 9563 | } |
9565 | 9564 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description')) && |
9566 | - ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT))) |
|
9565 | + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT))) |
|
9567 | 9566 | { |
9568 | 9567 | return $return; |
9569 | 9568 | } |
9570 | 9569 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary')) && |
9571 | - ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0])))) |
|
9570 | + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0])))) |
|
9572 | 9571 | { |
9573 | 9572 | return $return; |
9574 | 9573 | } |
9575 | 9574 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle')) && |
9576 | - ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT))) |
|
9575 | + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT))) |
|
9577 | 9576 | { |
9578 | 9577 | return $return; |
9579 | 9578 | } |
9580 | 9579 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description')) && |
9581 | - ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML))) |
|
9580 | + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML))) |
|
9582 | 9581 | { |
9583 | 9582 | return $return; |
9584 | 9583 | } |
@@ -9610,17 +9609,17 @@ discard block |
||
9610 | 9609 | public function get_content($content_only = false) |
9611 | 9610 | { |
9612 | 9611 | if (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content')) && |
9613 | - ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_content_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) |
|
9612 | + ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_10_content_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) |
|
9614 | 9613 | { |
9615 | 9614 | return $return; |
9616 | 9615 | } |
9617 | 9616 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content')) && |
9618 | - ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) |
|
9617 | + ($return = $this->sanitize($tags[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($tags[0]['attribs'])), $this->get_base($tags[0])))) |
|
9619 | 9618 | { |
9620 | 9619 | return $return; |
9621 | 9620 | } |
9622 | 9621 | elseif (($tags = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded')) && |
9623 | - ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0])))) |
|
9622 | + ($return = $this->sanitize($tags[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($tags[0])))) |
|
9624 | 9623 | { |
9625 | 9624 | return $return; |
9626 | 9625 | } |
@@ -12335,8 +12334,8 @@ discard block |
||
12335 | 12334 | $sniffer = $this->registry->create('Content_Type_Sniffer', array($file)); |
12336 | 12335 | $sniffed = $sniffer->get_type(); |
12337 | 12336 | $mime_types = array('application/rss+xml', 'application/rdf+xml', |
12338 | - 'text/rdf', 'application/atom+xml', 'text/xml', |
|
12339 | - 'application/xml', 'application/x-rss+xml'); |
|
12337 | + 'text/rdf', 'application/atom+xml', 'text/xml', |
|
12338 | + 'application/xml', 'application/x-rss+xml'); |
|
12340 | 12339 | if ($check_html) |
12341 | 12340 | { |
12342 | 12341 | $mime_types[] = 'text/html'; |
@@ -12510,12 +12509,12 @@ discard block |
||
12510 | 12509 | if ($this->dom === null) |
12511 | 12510 | { |
12512 | 12511 | throw new SimplePie_Exception('DOMDocument not found, unable to use '. |
12513 | - 'locator'); |
|
12512 | + 'locator'); |
|
12514 | 12513 | } |
12515 | 12514 | if (!class_exists('DOMXpath')) |
12516 | 12515 | { |
12517 | 12516 | throw new SimplePie_Exception('DOMXpath not found, unable to use '. |
12518 | - 'get_rel_link'); |
|
12517 | + 'get_rel_link'); |
|
12519 | 12518 | } |
12520 | 12519 | |
12521 | 12520 | $xpath = new DOMXpath($this->dom); |
@@ -12525,22 +12524,22 @@ discard block |
||
12525 | 12524 | $href = trim($link->getAttribute('href')); |
12526 | 12525 | $parsed = $this->registry->call('Misc', 'parse_url', array($href)); |
12527 | 12526 | if ($parsed['scheme'] === '' || |
12528 | - preg_match('/^https?$/i', $parsed['scheme'])) |
|
12527 | + preg_match('/^https?$/i', $parsed['scheme'])) |
|
12529 | 12528 | { |
12530 | 12529 | if (method_exists($link, 'getLineNo') && |
12531 | - $this->base_location < $link->getLineNo()) |
|
12530 | + $this->base_location < $link->getLineNo()) |
|
12532 | 12531 | { |
12533 | 12532 | $href = |
12534 | 12533 | $this->registry->call('Misc', 'absolutize_url', |
12535 | - array(trim($link->getAttribute('href')), |
|
12536 | - $this->base)); |
|
12534 | + array(trim($link->getAttribute('href')), |
|
12535 | + $this->base)); |
|
12537 | 12536 | } |
12538 | 12537 | else |
12539 | 12538 | { |
12540 | 12539 | $href = |
12541 | 12540 | $this->registry->call('Misc', 'absolutize_url', |
12542 | - array(trim($link->getAttribute('href')), |
|
12543 | - $this->http_base)); |
|
12541 | + array(trim($link->getAttribute('href')), |
|
12542 | + $this->http_base)); |
|
12544 | 12543 | } |
12545 | 12544 | if ($href === false) |
12546 | 12545 | { |
@@ -16630,9 +16629,9 @@ discard block |
||
16630 | 16629 | } |
16631 | 16630 | $channel = array('channel' => array(array('child' => array('' => |
16632 | 16631 | array('link' => $link, 'image' => $image, 'title' => $feed_title, |
16633 | - 'item' => $items))))); |
|
16632 | + 'item' => $items))))); |
|
16634 | 16633 | $rss = array(array('attribs' => array('' => array('version' => '2.0')), |
16635 | - 'child' => array('' => $channel))); |
|
16634 | + 'child' => array('' => $channel))); |
|
16636 | 16635 | $this->data = array('child' => array('' => array('rss' => $rss))); |
16637 | 16636 | return true; |
16638 | 16637 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | </form> |
8 | 8 | </div> |
9 | 9 | <?php |
10 | - if (isset($owner)) { |
|
10 | + if (isset($owner)) { |
|
11 | 11 | ?> |
12 | 12 | <div class="sub-menu sub-menu-container"> |
13 | 13 | <ul class="nav nav-pills"> |
@@ -38,5 +38,5 @@ discard block |
||
38 | 38 | </ul> |
39 | 39 | </div> |
40 | 40 | <?php |
41 | - } |
|
41 | + } |
|
42 | 42 | ?> |
43 | 43 | \ No newline at end of file |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | $id = $spotter_item['Waypoint']['@attributes']['id']; |
24 | 24 | if ($id == 0 || !is_numeric($id)) $id = $j; |
25 | 25 | $output .= '{"type": "Feature",'; |
26 | - $output .= '"id": '.$id.','; |
|
27 | - $output .= '"properties": {'; |
|
26 | + $output .= '"id": '.$id.','; |
|
27 | + $output .= '"properties": {'; |
|
28 | 28 | $output .= '"type": "'.$spotter_item['@attributes']['type'].'",'; |
29 | 29 | //$output .= '"id": "'.$spotter_item['Waypoint']['@attributes']['id'].'",'; |
30 | 30 | $output .= '"name": "'.$spotter_item['Waypoint']['@attributes']['name'].'",'; |
@@ -35,31 +35,31 @@ discard block |
||
35 | 35 | } elseif ($spotter_item['@attributes']['type'] == 'Finish') { |
36 | 36 | $output .= '"icon": "/images/tsk/tsk-finish.png"'; |
37 | 37 | } else $output .= '"icon": "/images/tsk/number_'.$id.'.png"'; |
38 | - $output .= '},'; |
|
39 | - $output .= '"geometry": {'; |
|
38 | + $output .= '},'; |
|
39 | + $output .= '"geometry": {'; |
|
40 | 40 | $output .= '"type": "Point",'; |
41 | 41 | $output .= '"coordinates": ['; |
42 | - $output .= $spotter_item['Waypoint']['Location']['@attributes']['longitude'].', '.$spotter_item['Waypoint']['Location']['@attributes']['latitude']; |
|
42 | + $output .= $spotter_item['Waypoint']['Location']['@attributes']['longitude'].', '.$spotter_item['Waypoint']['Location']['@attributes']['latitude']; |
|
43 | 43 | $output .= ']'; |
44 | - $output .= '}'; |
|
44 | + $output .= '}'; |
|
45 | 45 | $output .= '},'; |
46 | 46 | $j++; |
47 | 47 | } |
48 | 48 | // Lines |
49 | 49 | $output .= '{"type": "Feature",'; |
50 | - $output .= '"properties": {'; |
|
50 | + $output .= '"properties": {'; |
|
51 | 51 | $output .= '"type": "'.$spotter_array['@attributes']['type'].'"'; |
52 | - $output .= '},'; |
|
53 | - $output .= '"geometry": {'; |
|
52 | + $output .= '},'; |
|
53 | + $output .= '"geometry": {'; |
|
54 | 54 | $output .= '"type": "LineString",'; |
55 | 55 | $output .= '"coordinates": ['; |
56 | 56 | foreach($spotter_array['Point'] as $spotter_item) |
57 | 57 | { |
58 | - $output .= '['.$spotter_item['Waypoint']['Location']['@attributes']['longitude'].', '.$spotter_item['Waypoint']['Location']['@attributes']['latitude'].'],'; |
|
58 | + $output .= '['.$spotter_item['Waypoint']['Location']['@attributes']['longitude'].', '.$spotter_item['Waypoint']['Location']['@attributes']['latitude'].'],'; |
|
59 | 59 | } |
60 | 60 | $output = substr($output, 0, -1); |
61 | 61 | $output .= ']'; |
62 | - $output .= '}'; |
|
62 | + $output .= '}'; |
|
63 | 63 | $output .= '},'; |
64 | 64 | $output = substr($output, 0, -1); |
65 | 65 | } |
@@ -14,35 +14,35 @@ discard block |
||
14 | 14 | public $db; |
15 | 15 | |
16 | 16 | protected $texts = Array( |
17 | - 'MI' => 'Shallow', |
|
18 | - 'PR' => 'Partial', |
|
19 | - 'BC' => 'Low drifting', |
|
20 | - 'BL' => 'Blowing', |
|
21 | - 'SH' => 'Showers', |
|
22 | - 'TS' => 'Thunderstorm', |
|
23 | - 'FZ' => 'Freezing', |
|
24 | - 'DZ' => 'Drizzle', |
|
25 | - 'RA' => 'Rain', |
|
26 | - 'SN' => 'Snow', |
|
27 | - 'SG' => 'Snow Grains', |
|
28 | - 'IC' => 'Ice crystals', |
|
29 | - 'PL' => 'Ice pellets', |
|
30 | - 'GR' => 'Hail', |
|
31 | - 'GS' => 'Small hail', |
|
32 | - 'UP' => 'Unknown', |
|
33 | - 'BR' => 'Mist', |
|
34 | - 'FG' => 'Fog', |
|
35 | - 'FU' => 'Smoke', |
|
36 | - 'VA' => 'Volcanic ash', |
|
37 | - 'DU' => 'Widespread dust', |
|
38 | - 'SA' => 'Sand', |
|
39 | - 'HZ' => 'Haze', |
|
40 | - 'PY' => 'Spray', |
|
41 | - 'PO' => 'Well developed dust / sand whirls', |
|
42 | - 'SQ' => 'Squalls', |
|
43 | - 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
44 | - 'SS' => 'Sandstorm', |
|
45 | - 'DS' => 'Duststorm' |
|
17 | + 'MI' => 'Shallow', |
|
18 | + 'PR' => 'Partial', |
|
19 | + 'BC' => 'Low drifting', |
|
20 | + 'BL' => 'Blowing', |
|
21 | + 'SH' => 'Showers', |
|
22 | + 'TS' => 'Thunderstorm', |
|
23 | + 'FZ' => 'Freezing', |
|
24 | + 'DZ' => 'Drizzle', |
|
25 | + 'RA' => 'Rain', |
|
26 | + 'SN' => 'Snow', |
|
27 | + 'SG' => 'Snow Grains', |
|
28 | + 'IC' => 'Ice crystals', |
|
29 | + 'PL' => 'Ice pellets', |
|
30 | + 'GR' => 'Hail', |
|
31 | + 'GS' => 'Small hail', |
|
32 | + 'UP' => 'Unknown', |
|
33 | + 'BR' => 'Mist', |
|
34 | + 'FG' => 'Fog', |
|
35 | + 'FU' => 'Smoke', |
|
36 | + 'VA' => 'Volcanic ash', |
|
37 | + 'DU' => 'Widespread dust', |
|
38 | + 'SA' => 'Sand', |
|
39 | + 'HZ' => 'Haze', |
|
40 | + 'PY' => 'Spray', |
|
41 | + 'PO' => 'Well developed dust / sand whirls', |
|
42 | + 'SQ' => 'Squalls', |
|
43 | + 'FC' => 'Funnel clouds inc tornadoes or waterspouts', |
|
44 | + 'SS' => 'Sandstorm', |
|
45 | + 'DS' => 'Duststorm' |
|
46 | 46 | ); |
47 | 47 | |
48 | 48 | /* |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $result['QNH_format'] = $matches[1] == 'Q' ? 'hPa' : 'inHg'; |
178 | 178 | */ |
179 | 179 | } |
180 | - /* |
|
180 | + /* |
|
181 | 181 | // Wind Direction |
182 | 182 | if (preg_match('#^([0-9]{3})V([0-9]{3})$#', $piece, $matches)) { |
183 | 183 | $result['wind_direction'] = $matches[1]; |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | $result['speed_variable'] = $matches[1]; |
189 | 189 | } |
190 | 190 | */ |
191 | - // Visibility |
|
191 | + // Visibility |
|
192 | 192 | if (preg_match('#^([0-9]{4})|(([0-9]{1,4})SM)$#', $piece, $matches)) { |
193 | 193 | if (isset($matches[3]) && strlen($matches[3]) > 0) { |
194 | 194 | $result['visibility'] = (float)$matches[3] * 1609.34; |
@@ -246,9 +246,9 @@ discard block |
||
246 | 246 | else $range = array('exact' => (float)$matches[2], 'unit' => 'M'); |
247 | 247 | if (isset($matches[3])) { |
248 | 248 | $range = Array( |
249 | - 'from' => (float)$matches[2], |
|
250 | - 'to' => (float)$matches[4], |
|
251 | - 'unit' => $matches[5] ? 'FT' : 'M' |
|
249 | + 'from' => (float)$matches[2], |
|
250 | + 'to' => (float)$matches[4], |
|
251 | + 'unit' => $matches[5] ? 'FT' : 'M' |
|
252 | 252 | ); |
253 | 253 | } |
254 | 254 | $result['RVR'] = $matches[1]; |
@@ -176,8 +176,8 @@ |
||
176 | 176 | |
177 | 177 | private function urshift($n, $s) { |
178 | 178 | return ($n >= 0) ? ($n >> $s) : |
179 | - (($n & 0x7fffffff) >> $s) | |
|
180 | - (0x40000000 >> ($s - 1)); |
|
179 | + (($n & 0x7fffffff) >> $s) | |
|
180 | + (0x40000000 >> ($s - 1)); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /* |
@@ -198,20 +198,20 @@ |
||
198 | 198 | |
199 | 199 | private function parityCheck($msg, $bin) { |
200 | 200 | $modes_checksum_table = array( |
201 | - 0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178, |
|
202 | - 0x2c38bc, 0x161c5e, 0x0b0e2f, 0xfa7d13, 0x82c48d, 0xbe9842, 0x5f4c21, 0xd05c14, |
|
203 | - 0x682e0a, 0x341705, 0xe5f186, 0x72f8c3, 0xc68665, 0x9cb936, 0x4e5c9b, 0xd8d449, |
|
204 | - 0x939020, 0x49c810, 0x24e408, 0x127204, 0x093902, 0x049c81, 0xfdb444, 0x7eda22, |
|
205 | - 0x3f6d11, 0xe04c8c, 0x702646, 0x381323, 0xe3f395, 0x8e03ce, 0x4701e7, 0xdc7af7, |
|
206 | - 0x91c77f, 0xb719bb, 0xa476d9, 0xadc168, 0x56e0b4, 0x2b705a, 0x15b82d, 0xf52612, |
|
207 | - 0x7a9309, 0xc2b380, 0x6159c0, 0x30ace0, 0x185670, 0x0c2b38, 0x06159c, 0x030ace, |
|
208 | - 0x018567, 0xff38b7, 0x80665f, 0xbfc92b, 0xa01e91, 0xaff54c, 0x57faa6, 0x2bfd53, |
|
209 | - 0xea04ad, 0x8af852, 0x457c29, 0xdd4410, 0x6ea208, 0x375104, 0x1ba882, 0x0dd441, |
|
210 | - 0xf91024, 0x7c8812, 0x3e4409, 0xe0d800, 0x706c00, 0x383600, 0x1c1b00, 0x0e0d80, |
|
211 | - 0x0706c0, 0x038360, 0x01c1b0, 0x00e0d8, 0x00706c, 0x003836, 0x001c1b, 0xfff409, |
|
212 | - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, |
|
213 | - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, |
|
214 | - 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 |
|
201 | + 0x3935ea, 0x1c9af5, 0xf1b77e, 0x78dbbf, 0xc397db, 0x9e31e9, 0xb0e2f0, 0x587178, |
|
202 | + 0x2c38bc, 0x161c5e, 0x0b0e2f, 0xfa7d13, 0x82c48d, 0xbe9842, 0x5f4c21, 0xd05c14, |
|
203 | + 0x682e0a, 0x341705, 0xe5f186, 0x72f8c3, 0xc68665, 0x9cb936, 0x4e5c9b, 0xd8d449, |
|
204 | + 0x939020, 0x49c810, 0x24e408, 0x127204, 0x093902, 0x049c81, 0xfdb444, 0x7eda22, |
|
205 | + 0x3f6d11, 0xe04c8c, 0x702646, 0x381323, 0xe3f395, 0x8e03ce, 0x4701e7, 0xdc7af7, |
|
206 | + 0x91c77f, 0xb719bb, 0xa476d9, 0xadc168, 0x56e0b4, 0x2b705a, 0x15b82d, 0xf52612, |
|
207 | + 0x7a9309, 0xc2b380, 0x6159c0, 0x30ace0, 0x185670, 0x0c2b38, 0x06159c, 0x030ace, |
|
208 | + 0x018567, 0xff38b7, 0x80665f, 0xbfc92b, 0xa01e91, 0xaff54c, 0x57faa6, 0x2bfd53, |
|
209 | + 0xea04ad, 0x8af852, 0x457c29, 0xdd4410, 0x6ea208, 0x375104, 0x1ba882, 0x0dd441, |
|
210 | + 0xf91024, 0x7c8812, 0x3e4409, 0xe0d800, 0x706c00, 0x383600, 0x1c1b00, 0x0e0d80, |
|
211 | + 0x0706c0, 0x038360, 0x01c1b0, 0x00e0d8, 0x00706c, 0x003836, 0x001c1b, 0xfff409, |
|
212 | + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, |
|
213 | + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, |
|
214 | + 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000, 0x000000 |
|
215 | 215 | ); |
216 | 216 | $crc = 0; |
217 | 217 | $checksum = intval(substr($msg,22,6),16); |
@@ -4,31 +4,31 @@ discard block |
||
4 | 4 | $hex = str_replace("#", "", $hex); |
5 | 5 | $color = array(); |
6 | 6 | if (strlen($hex) == 3) { |
7 | - $color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1)); |
|
8 | - $color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1)); |
|
9 | - $color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1)); |
|
7 | + $color['r'] = hexdec(substr($hex, 0, 1) . substr($hex,0,1)); |
|
8 | + $color['g'] = hexdec(substr($hex, 1, 1) . substr($hex,1,1)); |
|
9 | + $color['b'] = hexdec(substr($hex, 2, 1) . substr($hex,2,1)); |
|
10 | 10 | } else if (strlen($hex) == 6) { |
11 | - $color['r'] = hexdec(substr($hex, 0, 2)); |
|
12 | - $color['g'] = hexdec(substr($hex, 2, 2)); |
|
13 | - $color['b'] = hexdec(substr($hex, 4, 2)); |
|
11 | + $color['r'] = hexdec(substr($hex, 0, 2)); |
|
12 | + $color['g'] = hexdec(substr($hex, 2, 2)); |
|
13 | + $color['b'] = hexdec(substr($hex, 4, 2)); |
|
14 | 14 | } |
15 | 15 | return $color; |
16 | 16 | } |
17 | 17 | |
18 | 18 | |
19 | 19 | if (!isset($_GET['color']) || $_GET['color'] == '' || !preg_match('/^([a-fA-F0-9]){3}(([a-fA-F0-9]){3})?\b/',$_GET['color'])) { |
20 | - exit(0); |
|
20 | + exit(0); |
|
21 | 21 | } |
22 | 22 | $color = $_GET['color']; |
23 | 23 | if (!isset($_GET['filename']) || !preg_match('/^[a-z0-9-_]+\.png$/', strtolower($_GET['filename']))) { |
24 | - echo "Incorrect filename"; |
|
25 | - exit(0); |
|
24 | + echo "Incorrect filename"; |
|
25 | + exit(0); |
|
26 | 26 | } |
27 | 27 | $filename = $_GET['filename']; |
28 | 28 | if (file_exists(dirname(__FILE__).'/cache/'.$color.'-'.$filename) && is_readable(dirname(__FILE__).'/cache/'.$color.'-'.$filename)) { |
29 | - header('Content-type: image/png'); |
|
30 | - readfile(dirname(__FILE__).'/cache/'.$color.'-'.$filename); |
|
31 | - exit(0); |
|
29 | + header('Content-type: image/png'); |
|
30 | + readfile(dirname(__FILE__).'/cache/'.$color.'-'.$filename); |
|
31 | + exit(0); |
|
32 | 32 | } |
33 | 33 | if (isset($_GET['tracker'])) { |
34 | 34 | $original = dirname(__FILE__).'/images/vehicules/color/'.$filename; |
@@ -45,68 +45,68 @@ discard block |
||
45 | 45 | $original = dirname(__FILE__).'/images/aircrafts/new/'.$filename; |
46 | 46 | } |
47 | 47 | if (!file_exists($original)) { |
48 | - echo "File not found"; |
|
48 | + echo "File not found"; |
|
49 | 49 | } |
50 | 50 | |
51 | 51 | if (extension_loaded('gd') && function_exists('gd_info')) { |
52 | - $image = imagecreatefrompng($original); |
|
53 | - $index = imagecolorexact($image,26,49,81); |
|
54 | - if ($index < 0) { |
|
52 | + $image = imagecreatefrompng($original); |
|
53 | + $index = imagecolorexact($image,26,49,81); |
|
54 | + if ($index < 0) { |
|
55 | 55 | $index = imagecolorexact($image,25,49,79); |
56 | - } |
|
57 | - if ($index < 0) { |
|
56 | + } |
|
57 | + if ($index < 0) { |
|
58 | 58 | $index = imagecolorexact($image,0,0,0); |
59 | - } |
|
60 | - $c = hexToRGB($color); |
|
61 | - imagecolorset($image,$index,$c['r'],$c['g'],$c['b']); |
|
59 | + } |
|
60 | + $c = hexToRGB($color); |
|
61 | + imagecolorset($image,$index,$c['r'],$c['g'],$c['b']); |
|
62 | 62 | /* |
63 | 63 | $ig = imagecolorat($image, 0, 0); |
64 | 64 | imagecolortransparent($image, $ig); |
65 | 65 | */ |
66 | 66 | |
67 | - header('Content-type: image/png'); |
|
68 | - if (isset($_GET['resize']) && function_exists('imagecopyresampled')) { |
|
67 | + header('Content-type: image/png'); |
|
68 | + if (isset($_GET['resize']) && function_exists('imagecopyresampled')) { |
|
69 | 69 | $resize = filter_input(INPUT_GET,'resize',FILTER_SANITIZE_NUMBER_INT); |
70 | 70 | $newimg = imagecreatetruecolor($resize,$resize); |
71 | - imagealphablending($newimg, false); |
|
71 | + imagealphablending($newimg, false); |
|
72 | 72 | imagesavealpha($newimg, true); |
73 | 73 | imagecopyresampled($newimg,$image,0,0,0,0,15,15,imagesx($image),imagesy($image)); |
74 | 74 | if (isset($_GET['heading'])) { |
75 | - $heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT); |
|
76 | - $rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127)); |
|
77 | - imagealphablending($rotation, false); |
|
78 | - imagesavealpha($rotation, true); |
|
79 | - imagepng($rotation); |
|
80 | - imagedestroy($newimg); |
|
81 | - imagedestroy($image); |
|
82 | - imagedestroy($rotation); |
|
75 | + $heading = filter_input(INPUT_GET,'heading',FILTER_SANITIZE_NUMBER_INT); |
|
76 | + $rotation = imagerotate($newimg,$heading,imageColorAllocateAlpha($newimg,0,0,0,127)); |
|
77 | + imagealphablending($rotation, false); |
|
78 | + imagesavealpha($rotation, true); |
|
79 | + imagepng($rotation); |
|
80 | + imagedestroy($newimg); |
|
81 | + imagedestroy($image); |
|
82 | + imagedestroy($rotation); |
|
83 | 83 | |
84 | 84 | } else { |
85 | - imagepng($newimg); |
|
86 | - imagedestroy($newimg); |
|
87 | - imagedestroy($image); |
|
88 | - } |
|
89 | - } else { |
|
85 | + imagepng($newimg); |
|
86 | + imagedestroy($newimg); |
|
87 | + imagedestroy($image); |
|
88 | + } |
|
89 | + } else { |
|
90 | 90 | imagealphablending($image, false); |
91 | - imagesavealpha($image, true); |
|
91 | + imagesavealpha($image, true); |
|
92 | 92 | imagepng($image); |
93 | 93 | imagepng($image); |
94 | 94 | if (is_writable(dirname(__FILE__).'/cache')) { |
95 | - imagepng($image,dirname(__FILE__).'/cache/'.$color.'-'.$filename); |
|
95 | + imagepng($image,dirname(__FILE__).'/cache/'.$color.'-'.$filename); |
|
96 | + } |
|
97 | + imagedestroy($image); |
|
96 | 98 | } |
97 | - imagedestroy($image); |
|
98 | - } |
|
99 | 99 | } else { |
100 | - header('Content-type: image/png'); |
|
101 | - if (isset($_GET['tracker'])) { |
|
102 | - readfile(dirname(__FILE__).'/images/vehicules/'.$filename); |
|
103 | - } elseif (isset($_GET['marine'])) { |
|
104 | - readfile(dirname(__FILE__).'/images/vehicules/'.$filename); |
|
105 | - } elseif (isset($_GET['satellite'])) { |
|
106 | - readfile(dirname(__FILE__).'/images/satellites/'.$filename); |
|
107 | - } else { |
|
108 | - if ($color == 'FF0000') readfile(dirname(__FILE__).'/images/aircrafts/selected/'.$filename); |
|
100 | + header('Content-type: image/png'); |
|
101 | + if (isset($_GET['tracker'])) { |
|
102 | + readfile(dirname(__FILE__).'/images/vehicules/'.$filename); |
|
103 | + } elseif (isset($_GET['marine'])) { |
|
104 | + readfile(dirname(__FILE__).'/images/vehicules/'.$filename); |
|
105 | + } elseif (isset($_GET['satellite'])) { |
|
106 | + readfile(dirname(__FILE__).'/images/satellites/'.$filename); |
|
107 | + } else { |
|
108 | + if ($color == 'FF0000') readfile(dirname(__FILE__).'/images/aircrafts/selected/'.$filename); |
|
109 | 109 | else readfile(dirname(__FILE__).'/images/aircrafts/'.$filename); |
110 | - } |
|
110 | + } |
|
111 | 111 | } |
112 | 112 | ?> |
113 | 113 | \ No newline at end of file |