Skip to content

Commit

Permalink
Merge pull request #376 from berlin2123/berlin2123-patch-1
Browse files Browse the repository at this point in the history
update for PHP 8
  • Loading branch information
vvuksan authored Feb 21, 2024
2 parents 4c219ce + 6c7513f commit 0f92146
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 12 deletions.
6 changes: 3 additions & 3 deletions cluster_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ function get_load_heatmap($hosts_up, $host_regex, $metrics, $load_scale, $tpl_da
if (array_key_exists($user_metricname, $metrics))
$units = $metrics[$user_metricname]['UNITS'];
} else {
if (array_key_exists($user_metricname, $metrics[key($metrics)]))
if ((!is_null($metrics[key($metrics)])) && array_key_exists($user_metricname, $metrics[key($metrics)]))
if (isset($metrics[key($metrics)][$user_metricname]['UNITS']))
$units = $metrics[key($metrics)][$user_metricname]['UNITS'];
else
Expand All @@ -614,7 +614,7 @@ function get_load_heatmap($hosts_up, $host_regex, $metrics, $load_scale, $tpl_da
$user['ce'],
$conf['zoom_support'],
$conf['default_optional_graph_size'],
$cluster[LOCALTIME],
$cluster['LOCALTIME'],
$tpl_data);

//////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -761,7 +761,7 @@ function get_load_heatmap($hosts_up, $host_regex, $metrics, $load_scale, $tpl_da
show_stacked_graphs($user['clustername'],
$user['metricname'],
$user['range'],
$cluster[LOCALTIME],
$cluster['LOCALTIME'],
$user['host_regex'],
$user['cs'],
$user['ce'],
Expand Down
6 changes: 3 additions & 3 deletions dwoo/Dwoo/Compiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -1820,7 +1820,7 @@ protected function parseFunction($in, $from, $to, $parsingParams = false, $curBl
if ($func === 'tif') {
$params[] = $tokens;
}
$output = call_user_func_array($funcCompiler, $params);
$output = call_user_func_array($funcCompiler, array_values($params));
} else {
array_unshift($params, '$this');
$params = self::implode_r($params);
Expand Down Expand Up @@ -2527,7 +2527,7 @@ protected function parseOthers($in, $from, $to, $parsingParams = false, $curBloc
}

$breaker = false;
while (list($k,$char) = each($breakChars)) {
foreach ( $breakChars as $k => $char ) {
$test = strpos($substr, $char);
if ($test !== false && $test < $end) {
$end = $test;
Expand Down Expand Up @@ -3041,7 +3041,7 @@ protected function mapParams(array $params, $callback, $callType=2, $map = null)
}

// loops over the param map and assigns values from the template or default value for unset optional params
while (list($k,$v) = each($map)) {
foreach ( $map as $k => $v ) {
if ($v[0] === '*') {
// "rest" array parameter, fill every remaining params in it and then break
if (count($ps) === 0) {
Expand Down
2 changes: 1 addition & 1 deletion dwoo/plugins/builtin/blocks/if.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static function replaceKeywords(array $params, array $tokens, Dwoo_Compil
$p = array();

reset($params);
while (list($k,$v) = each($params)) {
foreach ( $params as $k => $v ) {
$v = (string) $v;
if(substr($v, 0, 1) === '"' || substr($v, 0, 1) === '\'') {
$vmod = strtolower(substr($v, 1, -1));
Expand Down
2 changes: 1 addition & 1 deletion functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ function get_view_graph_elements($view) {
case "standard":
// Does view have any items/graphs defined
if ( count($view['items']) == 0 ) {
continue;
break;
// print "No graphs defined for this view. Please add some";
} else {
// Loop through graph items
Expand Down
2 changes: 1 addition & 1 deletion ganglia.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ function Gmetad () {
}

if ($debug) print "<br/>DEBUG: Creating parser\n";
if ( in_array($context, $SKIP_GMETAD_CONTEXTS) ) {
if ( isset($context) && is_array($context) && isset($SKIP_GMETAD_CONTEXTS) && is_array($SKIP_GMETAD_CONTEXTS) && in_array($context, $SKIP_GMETAD_CONTEXTS) ) {
return TRUE;
}
$parser = xml_parser_create();
Expand Down
6 changes: 5 additions & 1 deletion meta_view.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,11 @@
# above the image. Not easy with template blocks.
$cols=5;
$i = 0;
$count=count($names);
if (is_null($names)) {
$count=0;
} else {
$count=count($names);
}
while ($i < $count)
{
$snapnames = "";
Expand Down
4 changes: 2 additions & 2 deletions stacked.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
$command .= "TZ='" . sanitize($_SESSION['tz']) . "' ";

$command .= $conf['rrdtool'] . " graph - $rrd_options -E";
$command .= " --start '" . sanitize(${start}) . "'";
$command .= " --end '" . sanitize(${end}) . "'";
$command .= " --start '" . sanitize($start) . "'";
$command .= " --end '" . sanitize($end) . "'";
$command .= " --width 700";
$command .= " --height 300";

Expand Down

0 comments on commit 0f92146

Please sign in to comment.