From 1c888304d33a8c1405b8716356ae300fad39521c Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Sat, 3 May 2014 11:15:53 +0200 Subject: type/Default: don't depend on external function GET --- type/Default.class.php | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'type/Default.class.php') 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 { var $tinstances; var $identifiers; - function __construct($config) { + function __construct($config, $_get) { $this->datadir = $config['datadir']; $this->rrdtool = $config['rrdtool']; $this->rrdtool_opts = $config['rrdtool_opts']; $this->cache = $config['cache']; - $this->parse_get(); + $this->parse_get($_get); $this->rrd_files(); - $this->width = GET('x'); - if (empty($this->width)) $this->width = $config['width']; - $this->height = GET('y'); - if (empty($this->height)) $this->height = $config['height']; + $this->width = isset($_get['x']) ? $_get['x'] : $config['width']; + $this->height = isset($_get['y']) ? $_get['y'] : $config['height']; $this->graph_type = $config['graph_type']; $this->negative_io = $config['negative_io']; $this->graph_smooth = $config['graph_smooth']; @@ -67,16 +65,16 @@ class Type_Default { } # parse $_GET values - function parse_get() { + function parse_get($_get) { $this->args = array( - 'host' => GET('h'), - 'plugin' => GET('p'), - 'pinstance' => GET('pi'), - 'category' => GET('c'), - 'type' => GET('t'), - 'tinstance' => GET('ti'), + 'host' => isset($_get['h']) ? $_get['h'] : null, + 'plugin' => isset($_get['p']) ? $_get['p'] : null, + 'pinstance' => isset($_get['pi']) ? $_get['pi'] : null, + 'category' => isset($_get['c']) ? $_get['c'] : null, + 'type' => isset($_get['t']) ? $_get['t'] : null, + 'tinstance' => isset($_get['ti']) ? $_get['ti'] : null, ); - $this->seconds = GET('s'); + $this->seconds = isset($_get['s']) ? $_get['s'] : null; } function validate_color($color) { -- cgit v1.1