From e692d5c3dc912c6333715af801d8a92fea0fb34f Mon Sep 17 00:00:00 2001 From: cigamit Date: Thu, 24 Mar 2016 07:54:42 -0500 Subject: [PATCH 1/3] fixin javascript errors on login page. --- auth_login.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/auth_login.php b/auth_login.php index ae8bf4e94a..eadd0a1bc2 100644 --- a/auth_login.php +++ b/auth_login.php @@ -465,6 +465,8 @@ function domains_ldap_search_dn($username, $realm) { + + From b4c83b5641c78458feffc03532f4835cb11dacd2 Mon Sep 17 00:00:00 2001 From: Browniebraun Date: Thu, 24 Mar 2016 17:20:12 +0100 Subject: [PATCH 2/3] array to string conversion --- include/plugins.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/plugins.php b/include/plugins.php index 9c78ecf779..0aaf8b0432 100644 --- a/include/plugins.php +++ b/include/plugins.php @@ -54,7 +54,7 @@ function use_plugin ($name) { /* On startup, register all plugins configured for use. */ if (isset($plugins) && is_array($plugins) && !defined('IN_CACTI_INSTALL')) { - foreach ($plugins as $name) { - use_plugin($name); + foreach ($plugins as $plugin) { + use_plugin($plugin['directory']); } } From dfba135dbd84f93f30704da824fa52a7df272b65 Mon Sep 17 00:00:00 2001 From: Browniebraun Date: Thu, 24 Mar 2016 17:42:37 +0100 Subject: [PATCH 3/3] SNMPagent did not take care of uninstalled plugins. --- lib/snmpagent.php | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/lib/snmpagent.php b/lib/snmpagent.php index 6080ff6cb6..a7fd5dccca 100644 --- a/lib/snmpagent.php +++ b/lib/snmpagent.php @@ -368,10 +368,42 @@ function snmpagent_get_pluginslist(){ foreach ($registered_plugins as $t) { $pluginslist[$t['directory']] = $t; } - foreach ($plugins as $t) { - $pluginslist[$t] = $t; - } + $path = $config['base_path'] . '/plugins/'; + $dh = opendir($path); + if ($dh !== false) { + while (($file = readdir($dh)) !== false) { + if ((is_dir("$path/$file")) && (file_exists("$path/$file/setup.php")) && (!array_key_exists($file, $pluginslist))) { + include_once("$path/$file/setup.php"); + if (!function_exists('plugin_' . $file . '_install') && function_exists($file . '_version')) { + $function = $file . '_version'; + $cinfo = $function(); + if (!isset($cinfo['author'])) $cinfo['author'] = 'Unknown'; + if (!isset($cinfo['homepage'])) $cinfo['homepage'] = 'Not Stated'; + if (isset($cinfo['webpage'])) $cinfo['homepage'] = $cinfo['webpage']; + if (!isset($cinfo['longname'])) $cinfo['longname'] = ucfirst($file); + $cinfo['status'] = -2; /* old PIA -- disabled */ + if (in_array($file, $plugins)) { + $cinfo['status'] = -1; /* old PIA -- enabled */ + } + $cinfo['directory'] = $file; + $pluginslist[$file] = $cinfo; + + } elseif (function_exists('plugin_' . $file . '_install') && function_exists('plugin_' . $file . '_version')) { + $function = $file . '_version'; + $cinfo = $function(); + $cinfo['status'] = 0; + if (!isset($cinfo['author'])) $cinfo['author'] = 'Unknown'; + if (!isset($cinfo['homepage'])) $cinfo['homepage'] = 'Not Stated'; + if (isset($cinfo['webpage'])) $cinfo['homepage'] = $cinfo['webpage']; + if (!isset($cinfo['longname'])) $cinfo['homepage'] = ucfirst($file); + $cinfo['directory'] = $file; + $pluginslist[$file] = $cinfo; + } + } + } + closedir($dh); + } return $pluginslist; }