From 1bce11aec73bcd6f90fe8e72877b4061ae8d45af Mon Sep 17 00:00:00 2001 From: Karol Nowacki Date: Thu, 21 Apr 2011 20:24:38 +0200 Subject: resolve php notices Including a lot of undefined $_GET values. --- inc/functions.inc.php | 6 ++++++ inc/html.inc.php | 21 +++++++++++---------- 2 files changed, 17 insertions(+), 10 deletions(-) (limited to 'inc') diff --git a/inc/functions.inc.php b/inc/functions.inc.php index 04e58e3..39f1cd0 100644 --- a/inc/functions.inc.php +++ b/inc/functions.inc.php @@ -2,6 +2,12 @@ # global functions +function GET($index) { + if (isset($_GET[$index])) + return $_GET[$index]; + return null; +} + function validate_get($value, $type) { switch($type) { case 'host': diff --git a/inc/html.inc.php b/inc/html.inc.php index 1dc3d2c..d4a31f2 100644 --- a/inc/html.inc.php +++ b/inc/html.inc.php @@ -118,16 +118,17 @@ function host_summary($hosts) { function breadcrumbs() { - if (validate_get($_GET['h'], 'host')) - $path = ' - '.ucfirst($_GET['h']); - if (validate_get($_GET['p'], 'plugin')) - $path .= ' - '.ucfirst($_GET['p']); - if (validate_get($_GET['pi'], 'pinstance')) - $path .= ' - '.$_GET['pi']; - if (validate_get($_GET['t'], 'type') && validate_get($_GET['p'], 'plugin') && $_GET['t'] != $_GET['p']) - $path .= ' - '.$_GET['t']; - if (validate_get($_GET['ti'], 'tinstance')) - $path .= ' - '.$_GET['ti']; + $path = ''; + if (validate_get(GET('h'), 'host')) + $path .= ' - '.ucfirst(GET('h')); + if (validate_get(GET('p'), 'plugin')) + $path .= ' - '.ucfirst(GET('p')); + if (validate_get(GET('pi'), 'pinstance')) + $path .= ' - '.GET('pi'); + if (validate_get(GET('t'), 'type') && validate_get(GET('p'), 'plugin') && GET('t') != GET('p')) + $path .= ' - '.GET('t'); + if (validate_get(GET('ti'), 'tinstance')) + $path .= ' - '.GET('ti'); return $path; } -- cgit v1.1