diff --git a/lib/ftp.pm b/lib/ftp.pm index edeb730..a3351f3 100644 --- a/lib/ftp.pm +++ b/lib/ftp.pm @@ -306,8 +306,8 @@ sub ftp_cgi { my ($package, $config, $cgi) = @_; my $ftp = $config->{ftp}; - my @rigid = split(',', $ftp->{rigid}); - my @limit = split(',', $ftp->{limit}); + my @rigid = split(',', ($ftp->{rigid} || "")); + my @limit = split(',', ($ftp->{limit} || "")); my $tf = $cgi->{tf}; my $colors = $cgi->{colors}; my $graph = $cgi->{graph}; @@ -409,14 +409,7 @@ sub ftp_cgi { if($title) { main::graph_header($title, 2); } - if(trim($rigid[0]) eq 1) { - push(@riglim, "--upper-limit=" . trim($limit[0])); - } else { - if(trim($rigid[0]) eq 2) { - push(@riglim, "--upper-limit=" . trim($limit[0])); - push(@riglim, "--rigid"); - } - } + @riglim = @{setup_riglim($rigid[0], $limit[0])}; if($title) { print(" \n"); print(" \n"); @@ -476,7 +469,6 @@ sub ftp_cgi { "--width=$width", "--height=$height", @riglim, - "--lower-limit=0", $zoom, @{$cgi->{version12}}, @{$colors->{graph_colors}}, @@ -502,7 +494,6 @@ sub ftp_cgi { "--width=$width", "--height=$height", @riglim, - "--lower-limit=0", @{$cgi->{version12}}, @{$colors->{graph_colors}}, "DEF:retr=$rrd:ftp_retr:AVERAGE", @@ -534,15 +525,7 @@ sub ftp_cgi { print(" \n"); print(" \n"); } - undef(@riglim); - if(trim($rigid[1]) eq 1) { - push(@riglim, "--upper-limit=" . trim($limit[1])); - } else { - if(trim($rigid[1]) eq 2) { - push(@riglim, "--upper-limit=" . trim($limit[1])); - push(@riglim, "--rigid"); - } - } + @riglim = @{setup_riglim($rigid[1], $limit[1])}; undef(@tmp); undef(@tmpz); undef(@CDEF); @@ -583,7 +566,6 @@ sub ftp_cgi { "--width=$width", "--height=$height", @riglim, - "--lower-limit=0", $zoom, @{$cgi->{version12}}, @{$cgi->{version12_small}}, @@ -607,7 +589,6 @@ sub ftp_cgi { "--width=$width", "--height=$height", @riglim, - "--lower-limit=0", @{$cgi->{version12}}, @{$cgi->{version12_small}}, @{$colors->{graph_colors}}, @@ -634,15 +615,7 @@ sub ftp_cgi { } } - undef(@riglim); - if(trim($rigid[2]) eq 1) { - push(@riglim, "--upper-limit=" . trim($limit[2])); - } else { - if(trim($rigid[2]) eq 2) { - push(@riglim, "--upper-limit=" . trim($limit[2])); - push(@riglim, "--rigid"); - } - } + @riglim = @{setup_riglim($rigid[2], $limit[2])}; undef(@tmp); undef(@tmpz); undef(@CDEF); @@ -680,7 +653,6 @@ sub ftp_cgi { "--width=$width", "--height=$height", @riglim, - "--lower-limit=0", $zoom, @{$cgi->{version12}}, @{$cgi->{version12_small}}, @@ -702,7 +674,6 @@ sub ftp_cgi { "--width=$width", "--height=$height", @riglim, - "--lower-limit=0", @{$cgi->{version12}}, @{$cgi->{version12_small}}, @{$colors->{graph_colors}},