aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/type
diff options
context:
space:
mode:
authorPim van den Berg2014-05-03 11:15:53 +0200
committerPim van den Berg2014-05-03 11:15:53 +0200
commit1c888304d33a8c1405b8716356ae300fad39521c (patch)
treece0f5ef1946da9fd006a333f49233007fa574ae4 /type
parentinc: mv graphs_from_plugin, build_url functions to html.inc.php (diff)
downloadapt-panopticon_cgp-1c888304d33a8c1405b8716356ae300fad39521c.zip
apt-panopticon_cgp-1c888304d33a8c1405b8716356ae300fad39521c.tar.gz
apt-panopticon_cgp-1c888304d33a8c1405b8716356ae300fad39521c.tar.bz2
apt-panopticon_cgp-1c888304d33a8c1405b8716356ae300fad39521c.tar.xz
type/Default: don't depend on external function GET
Diffstat (limited to 'type')
-rw-r--r--type/Default.class.php26
1 files changed, 12 insertions, 14 deletions
diff --git a/type/Default.class.php b/type/Default.class.php
index 91f557f..e101e3b 100644
--- a/type/Default.class.php
+++ b/type/Default.class.php
@@ -27,17 +27,15 @@ class Type_Default {
27 var $tinstances; 27 var $tinstances;
28 var $identifiers; 28 var $identifiers;
29 29
30 function __construct($config) { 30 function __construct($config, $_get) {
31 $this->datadir = $config['datadir']; 31 $this->datadir = $config['datadir'];
32 $this->rrdtool = $config['rrdtool']; 32 $this->rrdtool = $config['rrdtool'];
33 $this->rrdtool_opts = $config['rrdtool_opts']; 33 $this->rrdtool_opts = $config['rrdtool_opts'];
34 $this->cache = $config['cache']; 34 $this->cache = $config['cache'];
35 $this->parse_get(); 35 $this->parse_get($_get);
36 $this->rrd_files(); 36 $this->rrd_files();
37 $this->width = GET('x'); 37 $this->width = isset($_get['x']) ? $_get['x'] : $config['width'];
38 if (empty($this->width)) $this->width = $config['width']; 38 $this->height = isset($_get['y']) ? $_get['y'] : $config['height'];
39 $this->height = GET('y');
40 if (empty($this->height)) $this->height = $config['height'];
41 $this->graph_type = $config['graph_type']; 39 $this->graph_type = $config['graph_type'];
42 $this->negative_io = $config['negative_io']; 40 $this->negative_io = $config['negative_io'];
43 $this->graph_smooth = $config['graph_smooth']; 41 $this->graph_smooth = $config['graph_smooth'];
@@ -67,16 +65,16 @@ class Type_Default {
67 } 65 }
68 66
69 # parse $_GET values 67 # parse $_GET values
70 function parse_get() { 68 function parse_get($_get) {
71 $this->args = array( 69 $this->args = array(
72 'host' => GET('h'), 70 'host' => isset($_get['h']) ? $_get['h'] : null,
73 'plugin' => GET('p'), 71 'plugin' => isset($_get['p']) ? $_get['p'] : null,
74 'pinstance' => GET('pi'), 72 'pinstance' => isset($_get['pi']) ? $_get['pi'] : null,
75 'category' => GET('c'), 73 'category' => isset($_get['c']) ? $_get['c'] : null,
76 'type' => GET('t'), 74 'type' => isset($_get['t']) ? $_get['t'] : null,
77 'tinstance' => GET('ti'), 75 'tinstance' => isset($_get['ti']) ? $_get['ti'] : null,
78 ); 76 );
79 $this->seconds = GET('s'); 77 $this->seconds = isset($_get['s']) ? $_get['s'] : null;
80 } 78 }
81 79
82 function validate_color($color) { 80 function validate_color($color) {