summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: da93b31)
raw | patch | inline | side by side (parent: da93b31)
author | Florian Forster <octo@collectd.org> | |
Sun, 27 May 2012 09:13:04 +0000 (11:13 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Sun, 27 May 2012 09:13:04 +0000 (11:13 +0200) |
Otherwise XML errors will prevent the page from rendering.
contrib/collection3/bin/index.cgi | patch | blob | history |
index 85064b868f2354f4d5aff7f00bff1a5746be7d98..e28e98572238e04e6e1e9ea52a6a8d565e88b1e2 100755 (executable)
HTML
}
+sub contains_invalid_chars
+{
+ my $str = shift;
+
+ for (split (m//, $str))
+ {
+ my $n = ord ($_);
+
+ # Whitespace is allowed.
+ if (($n >= 9) && ($n <= 13))
+ {
+ next;
+ }
+ elsif ($n < 32)
+ {
+ return (1);
+ }
+ }
+
+ return;
+}
+
sub show_selector
{
my $timespan_selection = get_timespan_selection ();
HTML
for (sort (keys %$host_selection))
{
+ next if contains_invalid_chars ($_);
my $host = encode_entities ($_);
my $selected = $host_selection->{$_}
? ' selected="selected"'
HTML
for (sort (keys %$plugin_selection))
{
+ next if contains_invalid_chars ($_);
my $plugin = encode_entities ($_);
my $selected = $plugin_selection->{$_}
? ' selected="selected"'
HTML
for (sort { $TimeSpans->{$a} <=> $TimeSpans->{$b} } (keys (%$TimeSpans)))
{
+ next if contains_invalid_chars ($_);
my $name = encode_entities ($_);
my $value = $TimeSpans->{$_};
my $selected = ($value == $timespan_selection)
for (sort @hosts)
{
my $url = encode_entities (script_name () . "?action=show_selection;hostname=$_");
+ next if contains_invalid_chars ($_);
my $name = encode_entities ($_);
print qq# <li><a href="$url">$name</a></li>\n#;
}