97f04d3
--- cacti-0.8.6h/lib/graph_variables.php	2006-01-03 21:08:30.000000000 -0600
97f04d3
+++ cacti-fixed/lib/graph_variables.php	2006-01-06 22:40:31.032460462 -0600
97f04d3
@@ -302,27 +302,34 @@
97f04d3
 
97f04d3
 	/* format the output according to args passed to the variable */
97f04d3
 	if ($regexp_match_array[4] == "current") {
97f04d3
+		if (! empty($nth_cache{$graph_item["local_data_id"]}{$graph_item["data_source_name"]})) {
97f04d3
 		$nth = $nth_cache{$graph_item["local_data_id"]}{$graph_item["data_source_name"]};
97f04d3
 		$nth = ($regexp_match_array[2] == "bits") ? $nth * 8 : $nth;
97f04d3
 		$nth /= pow(10,intval($regexp_match_array[3]));
97f04d3
+		}
97f04d3
 	}elseif ($regexp_match_array[4] == "total") {
97f04d3
 		for ($t=0;($t
97f04d3
 			if ((ereg("(AREA|STACK|LINE[123])", $graph_item_types{$graph_items[$t]["graph_type_id"]})) && (!empty($graph_items[$t]["data_template_rrd_id"]))) {
97f04d3
+				if (! empty($nth_cache{$graph_items[$t]["local_data_id"]}{$graph_items[$t]["data_source_name"]})) {
97f04d3
 				$local_nth = $nth_cache{$graph_items[$t]["local_data_id"]}{$graph_items[$t]["data_source_name"]};
97f04d3
 				$local_nth = ($regexp_match_array[2] == "bits") ? $local_nth * 8 : $local_nth;
97f04d3
 				$local_nth /= pow(10,intval($regexp_match_array[3]));
97f04d3
 
97f04d3
 				$nth += $local_nth;
97f04d3
+				}
97f04d3
 
97f04d3
 			}
97f04d3
 		}
97f04d3
 	}elseif ($regexp_match_array[4] == "max") {
97f04d3
+		if (! empty($nth_cache{$graph_item["local_data_id"]}["nth_percentile_maximum"])) {
97f04d3
 		$nth = $nth_cache{$graph_item["local_data_id"]}["nth_percentile_maximum"];
97f04d3
 		$nth = ($regexp_match_array[2] == "bits") ? $nth * 8 : $nth;
97f04d3
 		$nth /= pow(10,intval($regexp_match_array[3]));
97f04d3
+		}
97f04d3
 	}elseif ($regexp_match_array[4] == "total_peak") {
97f04d3
 		for ($t=0;($t
97f04d3
 			if ((ereg("(AREA|STACK|LINE[123])", $graph_item_types{$graph_items[$t]["graph_type_id"]})) && (!empty($graph_items[$t]["data_template_rrd_id"]))) {
97f04d3
+				if (! empty($nth_cache{$graph_items[$t]["local_data_id"]}["nth_percentile_maximum"])) {
97f04d3
 				$local_nth = $nth_cache{$graph_items[$t]["local_data_id"]}["nth_percentile_maximum"];
97f04d3
 				$local_nth = ($regexp_match_array[2] == "bits") ? $local_nth * 8 : $local_nth;
97f04d3
 				$local_nth /= pow(10,intval($regexp_match_array[3]));
97f04d3
@@ -330,9 +337,11 @@
97f04d3
 				$nth += $local_nth;
97f04d3
 			}
97f04d3
 		}
97f04d3
+		}
97f04d3
 	}elseif ($regexp_match_array[4] == "all_max_current") {
97f04d3
 		for ($t=0;($t
97f04d3
 			if ((ereg("(AREA|STACK|LINE[123])", $graph_item_types{$graph_items[$t]["graph_type_id"]})) && (!empty($graph_items[$t]["data_template_rrd_id"]))) {
97f04d3
+				if (! empty($ninety_fifth_cache{$graph_items[$t]["local_data_id"]}{$graph_items[$t]["data_source_name"]})) {
97f04d3
 				$local_nth = $ninety_fifth_cache{$graph_items[$t]["local_data_id"]}{$graph_items[$t]["data_source_name"]};
97f04d3
 				$local_nth = ($regexp_match_array[2] == "bits") ? $local_nth * 8 : $local_nth;
97f04d3
 				$local_nth /= pow(10,intval($regexp_match_array[3]));
97f04d3
@@ -342,9 +351,11 @@
97f04d3
 				}
97f04d3
 			}
97f04d3
 		}
97f04d3
+		}
97f04d3
 	}elseif ($regexp_match_array[4] == "all_max_peak") {
97f04d3
 		for ($t=0;($t
97f04d3
 			if ((ereg("(AREA|STACK|LINE[123])", $graph_item_types{$graph_items[$t]["graph_type_id"]})) && (!empty($graph_items[$t]["data_template_rrd_id"]))) {
97f04d3
+				if (! empty($nth_cache{$graph_items[$t]["local_data_id"]}["nth_percentile_maximum"])) {
97f04d3
 				$local_nth = $nth_cache{$graph_items[$t]["local_data_id"]}["nth_percentile_maximum"];
97f04d3
 				$local_nth = ($regexp_match_array[2] == "bits") ? $local_nth * 8 : $local_nth;
97f04d3
 				$local_nth /= pow(10,intval($regexp_match_array[3]));
97f04d3
@@ -354,28 +365,23 @@
97f04d3
 				}
97f04d3
 			}
97f04d3
 		}
97f04d3
+		}
97f04d3
 	}elseif ($regexp_match_array[4] == "aggregate") {
97f04d3
-		if (empty($nth_cache{0}["nth_percentile_aggregate_total"])) {
97f04d3
-			$nth = 0;
97f04d3
-		}else{
97f04d3
+		if (! empty($nth_cache{0}["nth_percentile_aggregate_total"])) {
97f04d3
 			$local_nth = $nth_cache{0}["nth_percentile_aggregate_total"];
97f04d3
 			$local_nth = ($regexp_match_array[2] == "bits") ? $local_nth * 8 : $local_nth;
97f04d3
 			$local_nth /= pow(10,intval($regexp_match_array[3]));
97f04d3
 			$nth = $local_nth;
97f04d3
 		}
97f04d3
 	}elseif ($regexp_match_array[4] == "aggregate_max") {
97f04d3
-		if (empty($nth_cache{0}["nth_percentile_aggregate_max"])) {
97f04d3
-			$nth = 0;
97f04d3
-		}else{
97f04d3
+		if (! empty($nth_cache{0}["nth_percentile_aggregate_max"])) {
97f04d3
 			$local_nth = $nth_cache{0}["nth_percentile_aggregate_max"];
97f04d3
 			$local_nth = ($regexp_match_array[2] == "bits") ? $local_nth * 8 : $local_nth;
97f04d3
 			$local_nth /= pow(10,intval($regexp_match_array[3]));
97f04d3
 			$nth = $local_nth;
97f04d3
 		}
97f04d3
 	}elseif ($regexp_match_array[4] == "aggregate_sum") {
97f04d3
-		if (empty($nth_cache{0}["nth_percentile_aggregate_sum"])) {
97f04d3
-			$nth = 0;
97f04d3
-		}else{
97f04d3
+		if (! empty($nth_cache{0}["nth_percentile_aggregate_sum"])) {
97f04d3
 			$local_nth = $nth_cache{0}["nth_percentile_aggregate_sum"];
97f04d3
 			$local_nth = ($regexp_match_array[2] == "bits") ? $local_nth * 8 : $local_nth;
97f04d3
 			$local_nth /= pow(10,intval($regexp_match_array[3]));