diff options
author | onefang | 2019-12-10 14:05:36 +1000 |
---|---|---|
committer | onefang | 2019-12-10 14:05:36 +1000 |
commit | fe73abc4ee41989d40b6bec0dbee1391470f97e6 (patch) | |
tree | b4e6f678194fcfee5ee5fa009213320012d2fefc | |
parent | A few style tweaks, mostly to a dark theme. (diff) | |
download | apt-panopticon_cgp-fe73abc4ee41989d40b6bec0dbee1391470f97e6.zip apt-panopticon_cgp-fe73abc4ee41989d40b6bec0dbee1391470f97e6.tar.gz apt-panopticon_cgp-fe73abc4ee41989d40b6bec0dbee1391470f97e6.tar.bz2 apt-panopticon_cgp-fe73abc4ee41989d40b6bec0dbee1391470f97e6.tar.xz |
New config for "allowed" graphs, so people can hide some of them.
-rw-r--r-- | conf/config.php | 3 | ||||
-rw-r--r-- | inc/functions.inc.php | 6 | ||||
-rw-r--r-- | inc/html.inc.php | 2 |
3 files changed, 10 insertions, 1 deletions
diff --git a/conf/config.php b/conf/config.php index 492e7eb..5a67007 100644 --- a/conf/config.php +++ b/conf/config.php | |||
@@ -36,6 +36,9 @@ $CONFIG['rrdtool_opts'] = array( | |||
36 | # default plugins to show on host page | 36 | # default plugins to show on host page |
37 | $CONFIG['overview'] = array('load', 'cpu', 'memory', 'swap'); | 37 | $CONFIG['overview'] = array('load', 'cpu', 'memory', 'swap'); |
38 | 38 | ||
39 | # allowed other plugins to show on host page | ||
40 | $CONFIG['allowed'] = array(); | ||
41 | |||
39 | # example of filter to show only the if_octets of eth0 on host page | 42 | # example of filter to show only the if_octets of eth0 on host page |
40 | # (interface must be enabled in the overview config array) | 43 | # (interface must be enabled in the overview config array) |
41 | #$CONFIG['overview_filter']['interface'] = array('ti' => 'eth0', 't' => 'if_octets'); | 44 | #$CONFIG['overview_filter']['interface'] = array('ti' => 'eth0', 't' => 'if_octets'); |
diff --git a/inc/functions.inc.php b/inc/functions.inc.php index 376b6e1..1c12c2f 100644 --- a/inc/functions.inc.php +++ b/inc/functions.inc.php | |||
@@ -1,8 +1,11 @@ | |||
1 | <?php | 1 | <?php |
2 | 2 | ||
3 | require_once 'conf/common.inc.php'; | ||
4 | |||
3 | # global functions | 5 | # global functions |
4 | 6 | ||
5 | function GET($index = NULL, $value = NULL) { | 7 | function GET($index = NULL, $value = NULL) { |
8 | global $CONFIG; | ||
6 | # parse all values from $_GET when no index is given | 9 | # parse all values from $_GET when no index is given |
7 | if ($index === NULL) { | 10 | if ($index === NULL) { |
8 | $arr = array(); | 11 | $arr = array(); |
@@ -40,6 +43,9 @@ function GET($index = NULL, $value = NULL) { | |||
40 | } | 43 | } |
41 | break; | 44 | break; |
42 | case 'p': # plugin | 45 | case 'p': # plugin |
46 | if ((!in_array($value, $CONFIG['allowed'])) && (!in_array($value, $CONFIG['overview']))) { | ||
47 | return NULL; | ||
48 | } | ||
43 | case 'c': # category | 49 | case 'c': # category |
44 | case 't': # type | 50 | case 't': # type |
45 | if (!preg_match('/^\w+$/u', $value)) { | 51 | if (!preg_match('/^\w+$/u', $value)) { |
diff --git a/inc/html.inc.php b/inc/html.inc.php index deebdc0..bc38b24 100644 --- a/inc/html.inc.php +++ b/inc/html.inc.php | |||
@@ -181,7 +181,7 @@ function plugins_list($host, $selected_plugins = array()) { | |||
181 | 181 | ||
182 | # other plugins | 182 | # other plugins |
183 | foreach($plugins as $plugin) { | 183 | foreach($plugins as $plugin) { |
184 | if (!in_array($plugin, $CONFIG['overview'])) { | 184 | if (in_array($plugin, $CONFIG['allowed'])) { |
185 | printf("<li><a %shref=\"%shost.php?h=%s&p=%s\">%s</a></li>\n", | 185 | printf("<li><a %shref=\"%shost.php?h=%s&p=%s\">%s</a></li>\n", |
186 | selected_plugin($plugin, $selected_plugins), | 186 | selected_plugin($plugin, $selected_plugins), |
187 | htmlentities($CONFIG['weburl']), | 187 | htmlentities($CONFIG['weburl']), |