diff --git a/.gitignore b/.gitignore index eff3ba3..ad44dd1 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ *.swp .DS_Store locales/po/*.mo +.omc/ diff --git a/includes/functions.php b/includes/functions.php index f8dd2ed..92706e1 100644 --- a/includes/functions.php +++ b/includes/functions.php @@ -67,12 +67,28 @@ function plugin_webseer_refresh_servers() { $data['action'] = 'GETSERVERS'; $results = $cc->post($server['url'], $data); + if (!is_string($results)) { + return; + } + $results = explode("\n", $results); foreach ($results as $r) { + if (!is_string($r)) { + continue; + } if (substr($r, 0, 8) == 'SERVERS=') { - $servers = substr($r, 8); - $servers = unserialize(base64_decode($servers)); + $encoded = substr($r, 8); + $decoded = base64_decode($encoded, true); + if ($decoded === false) { + cacti_log('WARNING: plugin_webseer_refresh_servers failed to base64_decode response', false, 'WEBSEER'); + break; + } + $servers = @unserialize($decoded, array('allowed_classes' => false)); + if (!is_array($servers)) { + cacti_log('WARNING: plugin_webseer_refresh_servers failed to unserialize response', false, 'WEBSEER'); + break; + } if (isset($servers[0]['id'])) { db_execute('TRUNCATE TABLE plugin_webseer_servers'); foreach ($servers as $save) { @@ -99,12 +115,29 @@ function plugin_webseer_refresh_urls () { $data = array(); $data['action'] = 'GETURLS'; $results = $cc->post($server['url'], $data); + + if (!is_string($results)) { + return; + } + $results = explode("\n", $results); foreach ($results as $r) { + if (!is_string($r)) { + continue; + } if (substr($r, 0, 5) == 'URLS=') { - $urls = substr($r, 5); - $urls = unserialize(base64_decode($urls)); + $encoded = substr($r, 5); + $decoded = base64_decode($encoded, true); + if ($decoded === false) { + cacti_log('WARNING: plugin_webseer_refresh_urls failed to base64_decode response', false, 'WEBSEER'); + break; + } + $urls = @unserialize($decoded, array('allowed_classes' => false)); + if (!is_array($urls)) { + cacti_log('WARNING: plugin_webseer_refresh_urls failed to unserialize response', false, 'WEBSEER'); + break; + } if (isset($urls[0]['id'])) { db_execute('TRUNCATE TABLE plugin_webseer_urls'); diff --git a/poller_webseer.php b/poller_webseer.php index 2efc9fc..9470d4d 100644 --- a/poller_webseer.php +++ b/poller_webseer.php @@ -238,7 +238,7 @@ function plugin_webseer_update_servers() { foreach ($servers as $server) { $server['debug_type'] = 'Server'; - $cc = new cURL(true, 'cookies.txt', $server['compression'], '', $server);; + $cc = new cURL(true, 'cookies.txt', $server['compression'], '', $server); $data = array(); $data['action'] = 'HEARTBEAT'; diff --git a/webseer.php b/webseer.php index 767914c..0946c0a 100644 --- a/webseer.php +++ b/webseer.php @@ -927,7 +927,7 @@ function list_urls() { var title = $(this).attr('title'); if (title != undefined && title.indexOf('/') >= 0) { - $(this).click(function() { + $(this).on('click', function() { window.open(title, 'webseer'); }); } @@ -973,19 +973,19 @@ function clearFilter() { } $(function() { - $('#refresh, #state, #rows, #rfilter').change(function() { + $('#refresh, #state, #rows, #rfilter').on('change', function() { applyFilter(); }); - $('#go').click(function() { + $('#go').on('click', function() { applyFilter(); }); - $('#clear').click(function() { + $('#clear').on('click', function() { clearFilter(); }); - $('#form_webseer').submit(function(event) { + $('#form_webseer').on('submit', function(event) { event.preventDefault(); applyFilter(); }); @@ -1094,19 +1094,19 @@ function purgeEvents() { } $(function() { - $('#rows').change(function() { + $('#rows').on('change', function() { applyFilter(); }); - $('#clear').click(function() { + $('#clear').on('click', function() { clearFilter(); }); - $('#purge').click(function() { + $('#purge').on('click', function() { purgeEvents(); }); - $('#webseer').submit(function(event) { + $('#webseer').on('submit', function(event) { event.preventDefault(); applyFilter(); }); diff --git a/webseer_proxies.php b/webseer_proxies.php index e0c68b1..07bfaf1 100644 --- a/webseer_proxies.php +++ b/webseer_proxies.php @@ -384,15 +384,15 @@ function clearFilter() { } $(function() { - $('#rows').change(function() { + $('#rows').on('change', function() { applyFilter(); }); - $('#clear').click(function() { + $('#clear').on('click', function() { clearFilter(); }); - $('#webseer').submit(function(event) { + $('#webseer').on('submit', function(event) { event.preventDefault(); applyFilter(); }); diff --git a/webseer_servers.php b/webseer_servers.php index e99befc..e61f69e 100644 --- a/webseer_servers.php +++ b/webseer_servers.php @@ -588,7 +588,7 @@ function list_servers() { title = $(this).attr('title'); if (title != undefined && title.indexOf('/') >= 0) { - $(this).click(function() { + $(this).on('click', function() { window.open(title, 'webseer'); }); } @@ -710,15 +710,15 @@ function clearFilter() { } $(function() { - $('#refresh, #state, #rows').change(function() { + $('#refresh, #state, #rows').on('change', function() { applyFilter(); }); - $('#clear').click(function() { + $('#clear').on('click', function() { clearFilter(); }); - $('#webseer').submit(function(event) { + $('#webseer').on('submit', function(event) { event.preventDefault(); applyFilter(); }); @@ -811,15 +811,15 @@ function clearFilter() { } $(function() { - $('#rows').change(function() { + $('#rows').on('change', function() { applyFilter(); }); - $('#clear').click(function() { + $('#clear').on('click', function() { clearFilter(); }); - $('#webseer').submit(function(event) { + $('#webseer').on('submit', function(event) { event.preventDefault(); applyFilter(); });