From cddcdba3c9be7e32454d0c54efd1d60e7cef7518 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 14 Apr 2024 15:21:35 +0200 Subject: Adding upstream version 1.2.4. Signed-off-by: Daniel Baumann --- application/clicommands/Icinga2Command.php | 2 ++ application/controllers/GraphController.php | 4 ++-- application/controllers/HostsController.php | 6 +++--- application/controllers/MonitoringGraphController.php | 10 +++++----- application/controllers/ServicesController.php | 6 +++--- application/forms/TimeRangePicker/CommonForm.php | 2 +- application/forms/TimeRangePicker/CustomForm.php | 7 +++++-- 7 files changed, 21 insertions(+), 16 deletions(-) (limited to 'application') diff --git a/application/clicommands/Icinga2Command.php b/application/clicommands/Icinga2Command.php index 816e063..e0e0ee4 100644 --- a/application/clicommands/Icinga2Command.php +++ b/application/clicommands/Icinga2Command.php @@ -138,6 +138,8 @@ EOT } } + assert(isset($service), '$service not initialized in the loop'); + $monObj = $service ? [ "apply Service \"{$icinga2CfgObjPrefix}_{$checkCommand}\" {", diff --git a/application/controllers/GraphController.php b/application/controllers/GraphController.php index c8dc7db..2c59171 100644 --- a/application/controllers/GraphController.php +++ b/application/controllers/GraphController.php @@ -152,8 +152,8 @@ class GraphController extends Controller $charts[0] ->setFrom($this->graphParams['start']) ->setUntil($this->graphParams['end']) - ->setWidth($this->graphParams['width']) - ->setHeight($this->graphParams['height']) + ->setWidth((int) $this->graphParams['width']) + ->setHeight((int) $this->graphParams['height']) ->setBackgroundColor($this->graphParams['bgcolor']) ->setForegroundColor($this->graphParams['fgcolor']) ->setMajorGridLineColor($this->graphParams['majorGridLineColor']) diff --git a/application/controllers/HostsController.php b/application/controllers/HostsController.php index f77281a..85cd2db 100644 --- a/application/controllers/HostsController.php +++ b/application/controllers/HostsController.php @@ -30,7 +30,7 @@ class HostsController extends IcingadbGraphiteController // shift graph params to avoid exception $graphRange = $this->params->shift('graph_range'); $baseFilter = $graphRange ? Filter::equal('graph_range', $graphRange) : null; - foreach ($this->graphParams as $param) { + foreach ($this->preservedParams as $param) { $this->params->shift($param); } @@ -51,7 +51,7 @@ class HostsController extends IcingadbGraphiteController $hosts, array_merge( [$limitControl->getLimitParam(), $sortControl->getSortParam()], - $this->graphParams + $this->preservedParams ) ); @@ -102,7 +102,7 @@ class HostsController extends IcingadbGraphiteController Host::on($this->getDb()), array_merge( [LimitControl::DEFAULT_LIMIT_PARAM, SortControl::DEFAULT_SORT_PARAM], - $this->graphParams + $this->preservedParams ) ); diff --git a/application/controllers/MonitoringGraphController.php b/application/controllers/MonitoringGraphController.php index 583c859..7b9f3f3 100644 --- a/application/controllers/MonitoringGraphController.php +++ b/application/controllers/MonitoringGraphController.php @@ -67,7 +67,7 @@ class MonitoringGraphController extends MonitoringAwareController ->fetchRow(); if ($host === false) { - throw new HttpNotFoundException('%s', $this->translate('No such host')); + throw new HttpNotFoundException($this->translate('No such host')); } $this->supplyImage(new Host($this->backend, $hostName), $host->host_check_command, $host->$checkCommandColumn); @@ -87,7 +87,7 @@ class MonitoringGraphController extends MonitoringAwareController ->fetchRow(); if ($service === false) { - throw new HttpNotFoundException('%s', $this->translate('No such service')); + throw new HttpNotFoundException($this->translate('No such service')); } $this->supplyImage( @@ -135,8 +135,8 @@ class MonitoringGraphController extends MonitoringAwareController $charts[0] ->setFrom($this->graphParams['start']) ->setUntil($this->graphParams['end']) - ->setWidth($this->graphParams['width']) - ->setHeight($this->graphParams['height']) + ->setWidth((int) $this->graphParams['width']) + ->setHeight((int) $this->graphParams['height']) ->setBackgroundColor($this->graphParams['bgcolor']) ->setForegroundColor($this->graphParams['fgcolor']) ->setMajorGridLineColor($this->graphParams['majorGridLineColor']) @@ -146,7 +146,7 @@ class MonitoringGraphController extends MonitoringAwareController // not falling through, serveImage exits default: - throw new HttpBadRequestException('%s', $this->translate( + throw new HttpBadRequestException($this->translate( 'Graphite Web yields more than one metric for the given filter.' . ' Please specify a more precise filter.' )); diff --git a/application/controllers/ServicesController.php b/application/controllers/ServicesController.php index 212ad1f..48a353d 100644 --- a/application/controllers/ServicesController.php +++ b/application/controllers/ServicesController.php @@ -28,7 +28,7 @@ class ServicesController extends IcingadbGraphiteController // shift graph params to avoid exception $graphRange = $this->params->shift('graph_range'); $baseFilter = $graphRange ? Filter::equal('graph_range', $graphRange) : null; - foreach ($this->graphParams as $param) { + foreach ($this->preservedParams as $param) { $this->params->shift($param); } @@ -54,7 +54,7 @@ class ServicesController extends IcingadbGraphiteController $services, array_merge( [$limitControl->getLimitParam(), $sortControl->getSortParam()], - $this->graphParams + $this->preservedParams ) ); @@ -105,7 +105,7 @@ class ServicesController extends IcingadbGraphiteController Service::on($this->getDb()), array_merge( [LimitControl::DEFAULT_LIMIT_PARAM, SortControl::DEFAULT_SORT_PARAM], - $this->graphParams + $this->preservedParams ) ); diff --git a/application/forms/TimeRangePicker/CommonForm.php b/application/forms/TimeRangePicker/CommonForm.php index 21e2096..af0944a 100644 --- a/application/forms/TimeRangePicker/CommonForm.php +++ b/application/forms/TimeRangePicker/CommonForm.php @@ -165,7 +165,7 @@ class CommonForm extends Form unset($options['']); foreach ($options as $option => $_) { - if ($seconds === $option * $factor) { + if ($seconds === (int) $option * $factor) { $element->setValue((string) $option); return; } diff --git a/application/forms/TimeRangePicker/CustomForm.php b/application/forms/TimeRangePicker/CustomForm.php index 89b5833..7b37022 100644 --- a/application/forms/TimeRangePicker/CustomForm.php +++ b/application/forms/TimeRangePicker/CustomForm.php @@ -100,8 +100,8 @@ class CustomForm extends Form if ($start > $end) { $absoluteRangeParameters = TimeRangePickerTools::getAbsoluteRangeParameters(); $this->getRedirectUrl()->getParams() - ->set($absoluteRangeParameters['start'], $end) - ->set($absoluteRangeParameters['end'], $start); + ->set($absoluteRangeParameters['start'], (string) $end) + ->set($absoluteRangeParameters['end'], (string) $start); } $this->getRedirectUrl()->remove(TimeRangePickerTools::getRelativeRangeParameter()); @@ -126,6 +126,9 @@ class CustomForm extends Form ]); } + assert(isset($elementDecorators), '$elementDecorators not initialized in the loop'); + assert(isset($element), '$element not initialized in the loop'); + $decorators = []; foreach ($elementDecorators as $key => $decorator) { if ($key === 'Zend_Form_Decorator_ViewHelper') { -- cgit v1.2.3