diff --git a/Makefile b/Makefile index 6d2dd1b3..a3ab48a0 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ PHPCBF = phpcbf ########################################################## # Gweb version -GWEB_VERSION = 3.7.5 +GWEB_VERSION = 3.7.7 DIST_NAME = ganglia-web DIST_DIR = $(DIST_NAME)-$(GWEB_VERSION) diff --git a/cluster_view.php b/cluster_view.php index 998ad659..fed4ed89 100644 --- a/cluster_view.php +++ b/cluster_view.php @@ -372,7 +372,7 @@ function get_cluster_overview($showhosts, $overview["cluster_load"] = join(", ", $cluster_load); $avg_cpu_num = find_avg($clustername, "", "cpu_num"); - if ($avg_cpu_num == 0) + if ((float)$avg_cpu_num == 0) $avg_cpu_num = 1; $cluster_util = sprintf("%.0f%%", diff --git a/dwoo/Dwoo/Core.php b/dwoo/Dwoo/Core.php index 8ec104bf..24440e3a 100644 --- a/dwoo/Dwoo/Core.php +++ b/dwoo/Dwoo/Core.php @@ -1250,7 +1250,7 @@ public function readVarInto($varstr, $data, $safeRead = false) } unset($varstr); - while (list($k, $sep) = each($m[1])) { + foreach ($m[1] as $k => $sep) { if ($sep === '.' || $sep === '[' || $sep === '') { // strip enclosing quotes if present $m[2][$k] = preg_replace('#^(["\']?)(.*?)\1$#', '$2', $m[2][$k]); @@ -1425,7 +1425,7 @@ public function readVar($varstr) $cur = $this->scope; } - while (list($k, $sep) = each($m[1])) { + foreach ($m[1] as $k => $sep) { if ($sep === '.' || $sep === '[' || $sep === '') { if ((is_array($cur) || $cur instanceof ArrayAccess) && isset($cur[$m[2][$k]])) { $cur = $cur[$m[2][$k]]; @@ -1470,7 +1470,7 @@ public function assignInScope($value, $scope) $cur =& $this->scope; $last = array(array_pop($m[1]), array_pop($m[2])); - while (list($k, $sep) = each($m[1])) { + foreach ($m[1] as $k => $sep) { if ($sep === '.' || $sep === '[' || $sep === '') { if (is_array($cur) === false) { $cur = array(); diff --git a/dwoo/Dwoo/Data.php b/dwoo/Dwoo/Data.php index c5f292ec..2772f15d 100644 --- a/dwoo/Dwoo/Data.php +++ b/dwoo/Dwoo/Data.php @@ -71,7 +71,7 @@ public function setData(array $data) public function mergeData(array $data) { $args = func_get_args(); - while (list(,$v) = each($args)) { + foreach ($args as $v) { if (is_array($v)) { $this->data = array_merge($this->data, $v); } @@ -90,8 +90,9 @@ public function assign($name, $val = null) { if (is_array($name)) { reset($name); - while (list($k,$v) = each($name)) + foreach ($name as $k => $v) { $this->data[$k] = $v; + } } else { $this->data[$name] = $val; } diff --git a/dwoo/plugins/builtin/blocks/textformat.php b/dwoo/plugins/builtin/blocks/textformat.php index fb0f4229..c018f1eb 100644 --- a/dwoo/plugins/builtin/blocks/textformat.php +++ b/dwoo/plugins/builtin/blocks/textformat.php @@ -67,7 +67,7 @@ public function process() // gets paragraphs $pgs = explode("\n", str_replace(array("\r\n", "\r"), "\n", $this->buffer)); - while (list($i,) = each($pgs)) { + foreach ($pgs as $i => $values) { if (empty($pgs[$i])) { continue; } diff --git a/dwoo/plugins/builtin/functions/capitalize.php b/dwoo/plugins/builtin/functions/capitalize.php index d04f39ba..59cf4fe1 100644 --- a/dwoo/plugins/builtin/functions/capitalize.php +++ b/dwoo/plugins/builtin/functions/capitalize.php @@ -25,7 +25,7 @@ function Dwoo_Plugin_capitalize(Dwoo_Core $dwoo, $value, $numwords=false) } else { $bits = explode(' ', (string) $value); $out = ''; - while (list(,$v) = each($bits)) { + foreach ($bits as $v) { if (preg_match('#^[^0-9]+$#', $v)) { $out .= ' '.mb_convert_case($v, MB_CASE_TITLE, $dwoo->getCharset()); } else { diff --git a/ganglia.php b/ganglia.php index 262b88e8..3d1b3252 100644 --- a/ganglia.php +++ b/ganglia.php @@ -350,7 +350,7 @@ function Gmetad () { } if ($debug) print "
DEBUG: Creating parser\n"; - if ( isset($context) && is_array($context) && isset($SKIP_GMETAD_CONTEXTS) && is_array($SKIP_GMETAD_CONTEXTS) && in_array($context, $SKIP_GMETAD_CONTEXTS) ) { + if ( is_array($SKIP_GMETAD_CONTEXTS) && in_array($context, $SKIP_GMETAD_CONTEXTS) ) { return TRUE; } $parser = xml_parser_create(); diff --git a/get_ganglia.php b/get_ganglia.php index 50e5fe81..d9c4f2ea 100644 --- a/get_ganglia.php +++ b/get_ganglia.php @@ -7,7 +7,7 @@ # If we are in compare_hosts, views and decompose_graph context we shouldn't attempt # any connections to the gmetad -if (! in_array($context, $SKIP_GMETAD_CONTEXTS) ) { +if (! ( is_array($SKIP_GMETAD_CONTEXTS) && in_array($context, $SKIP_GMETAD_CONTEXTS) ) ) { if (! Gmetad($conf['ganglia_ip'], $conf['ganglia_port']) ) { print "

There was an error collecting ganglia data ". diff --git a/graph.d/metric.php b/graph.d/metric.php index e584bb8c..91b1456e 100644 --- a/graph.d/metric.php +++ b/graph.d/metric.php @@ -53,6 +53,7 @@ function graph_metric ( &$rrdtool_graph ) { } $prefix = $summary ? $metricname : $hostname; + $value = (float)$value; $value = ($value > 1000) ? number_format($value) : number_format($value, 2); diff --git a/graph.php b/graph.php index e8a7a9c2..bf34014c 100644 --- a/graph.php +++ b/graph.php @@ -1552,7 +1552,7 @@ function execute_graph_command($graph_engine, $command) { // Fix from Phil Radden, but step is not always 15 anymore. if ($range == "month") - $rrdtool_graph['end'] = floor($rrdtool_graph['end'] / 672) * 672; + $rrdtool_graph['end'] = floor((int)$rrdtool_graph['end'] / 672) * 672; /////////////////////////////////////////////////////////////////////////////// // Are we generating aggregate graphs diff --git a/meta_view.php b/meta_view.php index aa79e150..e6490af6 100644 --- a/meta_view.php +++ b/meta_view.php @@ -119,7 +119,7 @@ $clusname = $source == $self ? '' : $source; $avg_cpu_num = find_avg($clusname, "", "cpu_num"); - if ($avg_cpu_num == 0) $avg_cpu_num = 1; + if ((float)$avg_cpu_num == 0) $avg_cpu_num = 1; $cluster_util = sprintf("%.0f", ((double) find_avg($clusname, "", "load_one") / $avg_cpu_num ) * 100); $sources[$source]["name"] = $name; diff --git a/mobile_helper.php b/mobile_helper.php index db45bb74..d9e20cbf 100644 --- a/mobile_helper.php +++ b/mobile_helper.php @@ -266,7 +266,7 @@ } else if (isset($reports[$metric_name]) and $reports[$metric]) continue; else { - $metric_graphargs = "c=".rawurlencode($clustername)."&h=".rawurlencode($hostname)."&v=".rawurlencode($metric_attributes[VAL]) + $metric_graphargs = "c=".rawurlencode($clustername)."&h=".rawurlencode($hostname)."&v=".rawurlencode($metric_attributes['VAL']) ."&m=$metric_name&r=".rawurlencode($range)."&z=$size&jr=$jobrange" ."&js=$jobstart&st=$cluster[LOCALTIME]"; if ($cs) diff --git a/physical_view.php b/physical_view.php index 8d5c3bc1..d50e51c0 100644 --- a/physical_view.php +++ b/physical_view.php @@ -99,7 +99,7 @@ function physical_racks() { else { ksort($racks); reset($racks); - while (list($rack,) = each($racks)) { + foreach ($racks as $rack => $values) { # In our convention, y=0 is close to the floor. (Easier to wire up) krsort($racks[$rack]); } diff --git a/pie.php b/pie.php index 0e94bbe9..24afad91 100644 --- a/pie.php +++ b/pie.php @@ -276,7 +276,11 @@ function draw_slices( $x, $y, $angles, $colors ) { $x; //PHPCS $y; //PHPCS - $pie_count = count( $angles ); + if is_null( $angles ) { + $pie_count = 0; + } else { + $pie_count = count( $angles ); + } $PIE_THICKNESS = ($this->diameter * 0.075); for( $j = ($this->center_y+$PIE_THICKNESS); $j > $this->center_y; $j-- ) { diff --git a/templates/default/footer.tpl b/templates/default/footer.tpl index af9fb5eb..548a8e4e 100644 --- a/templates/default/footer.tpl +++ b/templates/default/footer.tpl @@ -92,7 +92,7 @@ Loading view, please wait...