summaryrefslogtreecommitdiffstats
path: root/library/Reporting/Reports/SystemReport.php
diff options
context:
space:
mode:
Diffstat (limited to 'library/Reporting/Reports/SystemReport.php')
-rw-r--r--library/Reporting/Reports/SystemReport.php29
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);
}
}