diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:29:16 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-14 13:29:16 +0000 |
commit | 8a985929ed84cdb458a13c66b25f84e41133b24f (patch) | |
tree | 102a3d6e3cb731c6d23263095d0098f99572626d /library/Reporting/Reports | |
parent | Adding upstream version 0.10.0. (diff) | |
download | icingaweb2-module-reporting-upstream.tar.xz icingaweb2-module-reporting-upstream.zip |
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/Reporting/Reports')
-rw-r--r-- | library/Reporting/Reports/SystemReport.php | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/library/Reporting/Reports/SystemReport.php b/library/Reporting/Reports/SystemReport.php index 8a3d8dd..5c9a544 100644 --- a/library/Reporting/Reports/SystemReport.php +++ b/library/Reporting/Reports/SystemReport.php @@ -1,8 +1,10 @@ <?php + // Icinga Reporting | (c) 2018 Icinga GmbH | GPLv2 namespace Icinga\Module\Reporting\Reports; +use Icinga\Application\Icinga; use Icinga\Module\Reporting\Hook\ReportHook; use Icinga\Module\Reporting\Timerange; use ipl\Html\HtmlString; @@ -18,22 +20,29 @@ class SystemReport extends ReportHook { ob_start(); phpinfo(); + /** @var string $html */ $html = ob_get_clean(); - $doc = new \DOMDocument(); - @$doc->loadHTML($html); + if (! Icinga::app()->isCli()) { + $doc = new \DOMDocument(); + @$doc->loadHTML($html); + + $style = $doc->getElementsByTagName('style')->item(0); + $style->parentNode->removeChild($style); - $style = $doc->getElementsByTagName('style')->item(0); - $style->parentNode->removeChild($style); + $title = $doc->getElementsByTagName('title')->item(0); + $title->parentNode->removeChild($title); - $title = $doc->getElementsByTagName('title')->item(0); - $title->parentNode->removeChild($title); + $meta = $doc->getElementsByTagName('meta')->item(0); + $meta->parentNode->removeChild($meta); - $meta = $doc->getElementsByTagName('meta')->item(0); - $meta->parentNode->removeChild($meta); + $doc->getElementsByTagName('div')->item(0)->setAttribute('class', 'system-report'); - $doc->getElementsByTagName('div')->item(0)->setAttribute('class', 'system-report'); + $html = $doc->saveHTML(); + } else { + $html = nl2br($html); + } - return new HtmlString($doc->saveHTML()); + return new HtmlString($html); } } |