diff options
author | Karol Nowacki | 2011-04-21 20:24:38 +0200 |
---|---|---|
committer | Pim van den Berg | 2011-04-21 20:30:07 +0200 |
commit | 1bce11aec73bcd6f90fe8e72877b4061ae8d45af (patch) | |
tree | 082af880c39ee01a241c0467fec29c239ef0155b /inc | |
parent | plugin/varnish: deduplicate rrd_format values (diff) | |
download | apt-panopticon_cgp-1bce11aec73bcd6f90fe8e72877b4061ae8d45af.zip apt-panopticon_cgp-1bce11aec73bcd6f90fe8e72877b4061ae8d45af.tar.gz apt-panopticon_cgp-1bce11aec73bcd6f90fe8e72877b4061ae8d45af.tar.bz2 apt-panopticon_cgp-1bce11aec73bcd6f90fe8e72877b4061ae8d45af.tar.xz |
resolve php notices
Including a lot of undefined $_GET values.
Diffstat (limited to 'inc')
-rw-r--r-- | inc/functions.inc.php | 6 | ||||
-rw-r--r-- | inc/html.inc.php | 21 |
2 files changed, 17 insertions, 10 deletions
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 @@ | |||
2 | 2 | ||
3 | # global functions | 3 | # global functions |
4 | 4 | ||
5 | function GET($index) { | ||
6 | if (isset($_GET[$index])) | ||
7 | return $_GET[$index]; | ||
8 | return null; | ||
9 | } | ||
10 | |||
5 | function validate_get($value, $type) { | 11 | function validate_get($value, $type) { |
6 | switch($type) { | 12 | switch($type) { |
7 | case 'host': | 13 | 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) { | |||
118 | 118 | ||
119 | 119 | ||
120 | function breadcrumbs() { | 120 | function breadcrumbs() { |
121 | if (validate_get($_GET['h'], 'host')) | 121 | $path = ''; |
122 | $path = ' - '.ucfirst($_GET['h']); | 122 | if (validate_get(GET('h'), 'host')) |
123 | if (validate_get($_GET['p'], 'plugin')) | 123 | $path .= ' - '.ucfirst(GET('h')); |
124 | $path .= ' - '.ucfirst($_GET['p']); | 124 | if (validate_get(GET('p'), 'plugin')) |
125 | if (validate_get($_GET['pi'], 'pinstance')) | 125 | $path .= ' - '.ucfirst(GET('p')); |
126 | $path .= ' - '.$_GET['pi']; | 126 | if (validate_get(GET('pi'), 'pinstance')) |
127 | if (validate_get($_GET['t'], 'type') && validate_get($_GET['p'], 'plugin') && $_GET['t'] != $_GET['p']) | 127 | $path .= ' - '.GET('pi'); |
128 | $path .= ' - '.$_GET['t']; | 128 | if (validate_get(GET('t'), 'type') && validate_get(GET('p'), 'plugin') && GET('t') != GET('p')) |
129 | if (validate_get($_GET['ti'], 'tinstance')) | 129 | $path .= ' - '.GET('t'); |
130 | $path .= ' - '.$_GET['ti']; | 130 | if (validate_get(GET('ti'), 'tinstance')) |
131 | $path .= ' - '.GET('ti'); | ||
131 | 132 | ||
132 | return $path; | 133 | return $path; |
133 | } | 134 | } |