From a3d5bd80f9ac9c4500dc2b111a16d92647d52691 Mon Sep 17 00:00:00 2001 From: Daniel Cebrian Date: Tue, 25 Jul 2023 14:25:16 +0200 Subject: [PATCH] #11326 fixed dark theme in security hardening --- pandora_console/include/graphs/fgraph.php | 16 +++ .../artica/phpchartjs/src/Options/Scale.php | 30 +++- .../src/Options/Scales/AngleLines.php | 135 ++++++++++++++++++ 3 files changed, 180 insertions(+), 1 deletion(-) create mode 100644 pandora_console/vendor/artica/phpchartjs/src/Options/Scales/AngleLines.php diff --git a/pandora_console/include/graphs/fgraph.php b/pandora_console/include/graphs/fgraph.php index 38b3e3e51a..7da82a2ba8 100644 --- a/pandora_console/include/graphs/fgraph.php +++ b/pandora_console/include/graphs/fgraph.php @@ -1108,6 +1108,22 @@ function get_build_setup_charts($type, $options, $data) && empty($options['scales']['r']['pointLabels']) === false && is_array($options['scales']['r']['pointLabels']) === true ) { + if (isset($options['scales']['r']['pointLabels']['color']) === true) { + $scales->getR()->pointLabels()->setColor($options['scales']['r']['pointLabels']['color']); + } + + if (isset($options['scales']['r']['grid']['display']) === true) { + $scales->getR()->grid()->setDrawOnChartArea($options['scales']['r']['grid']['display']); + } + + if (isset($options['scales']['r']['grid']['color']) === true) { + $scales->getR()->grid()->setColor($options['scales']['r']['grid']['color']); + } + + if (isset($options['scales']['r']['angleLines']['color']) === true) { + $scales->getR()->angleLines()->setColor($options['scales']['r']['angleLines']['color']); + } + if (isset($options['scales']['r']['pointLabels']['fonts']) === true && empty($options['scales']['r']['pointLabels']['fonts']) === false && is_array($options['scales']['r']['pointLabels']['fonts']) === true diff --git a/pandora_console/vendor/artica/phpchartjs/src/Options/Scale.php b/pandora_console/vendor/artica/phpchartjs/src/Options/Scale.php index d34eec4826..8f1581dd97 100644 --- a/pandora_console/vendor/artica/phpchartjs/src/Options/Scale.php +++ b/pandora_console/vendor/artica/phpchartjs/src/Options/Scale.php @@ -4,6 +4,7 @@ namespace Artica\PHPChartJS\Options; use Artica\PHPChartJS\ArraySerializableInterface; use Artica\PHPChartJS\Delegate\ArraySerializable; +use Artica\PHPChartJS\Options\Scales\AngleLines; use Artica\PHPChartJS\Options\Scales\GridLines; use Artica\PHPChartJS\Options\Scales\PointLabels; use Artica\PHPChartJS\Options\Scales\ScaleLabel; @@ -129,6 +130,13 @@ abstract class Scale implements ArraySerializableInterface, JsonSerializable */ protected $grid; + /** + * AngleLines + * + * @var AngleLines + */ + protected $angleLines; + /** * @var ScaleLabel */ @@ -164,7 +172,7 @@ abstract class Scale implements ArraySerializableInterface, JsonSerializable return $this; } - + /** * @return string */ @@ -585,6 +593,26 @@ abstract class Scale implements ArraySerializableInterface, JsonSerializable return $this->grid; } + /** + * @return AngleLines + */ + public function getAngleLines() + { + return $this->angleLines; + } + + /** + * @return AngleLines + */ + public function angleLines() + { + if (is_null($this->angleLines)) { + $this->angleLines = new AngleLines(); + } + + return $this->angleLines; + } + /** * @return ScaleLabel */ diff --git a/pandora_console/vendor/artica/phpchartjs/src/Options/Scales/AngleLines.php b/pandora_console/vendor/artica/phpchartjs/src/Options/Scales/AngleLines.php new file mode 100644 index 0000000000..549c6baf96 --- /dev/null +++ b/pandora_console/vendor/artica/phpchartjs/src/Options/Scales/AngleLines.php @@ -0,0 +1,135 @@ +display; + } + + /** + * @param bool $display + * + * @return $this + */ + public function setDisplay($display) + { + $this->display = $display; + + return $this; + } + + /** + * @return string|string[] + */ + public function getColor() + { + return $this->color; + } + + /** + * @param string|string[] $color + * + * @return $this + */ + public function setColor($color) + { + if (is_array($color)) { + $this->color = $this->recursiveToString($color); + } else { + $this->color = is_null($color) ? null : strval($color); + } + + return $this; + } + + /** + * @return float[]|null + */ + public function getBorderDash() + { + return $this->borderDash; + } + + /** + * @param float[] $borderDash + * + * @return $this + */ + public function setBorderDash($borderDash) + { + if (is_array($borderDash)) { + $this->borderDash = $this->recursiveToFloat($borderDash); + } + + return $this; + } + + /** + * @return float + */ + public function getBorderDashOffset() + { + return $this->borderDashOffset; + } + + /** + * @param float $borderDashOffset + * + * @return $this + */ + public function setBorderDashOffset($borderDashOffset) + { + $this->borderDashOffset = floatval($borderDashOffset); + + return $this; + } + + /** + * @return array + */ + public function jsonSerialize() + { + return $this->getArrayCopy(); + } +}