From 7bda4ce42be506e97b0f505e927f145329ee7432 Mon Sep 17 00:00:00 2001 From: Matthias Jentsch Date: Mon, 6 Jul 2015 15:36:43 +0200 Subject: [PATCH] Do not escape certain HTML markup for plugin output Use specialized escape functions for plugin output that allow certain HTML formatting to be allowed. refs #9036 --- .../monitoring/application/views/helpers/PluginOutput.php | 7 +++++-- .../monitoring/application/views/scripts/list/hosts.phtml | 2 +- .../application/views/scripts/list/notifications.phtml | 2 +- .../application/views/scripts/list/services.phtml | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/monitoring/application/views/helpers/PluginOutput.php b/modules/monitoring/application/views/helpers/PluginOutput.php index 8f96ac67b..0a328b126 100644 --- a/modules/monitoring/application/views/helpers/PluginOutput.php +++ b/modules/monitoring/application/views/helpers/PluginOutput.php @@ -40,11 +40,14 @@ class Zend_View_Helper_PluginOutput extends Zend_View_Helper_Abstract ); } else { // Plaintext - $output = '
' . preg_replace(
+            $output = preg_replace(
                 self::$txtPatterns,
                 self::$txtReplacements,
                 $this->view->escape($output)
-            ) . '
'; + ); + } + if (! $raw) { + $output = '
' . $output . '
'; } $output = $this->fixLinks($output); return $output; diff --git a/modules/monitoring/application/views/scripts/list/hosts.phtml b/modules/monitoring/application/views/scripts/list/hosts.phtml index 0d033eaad..b697c8f6a 100644 --- a/modules/monitoring/application/views/scripts/list/hosts.phtml +++ b/modules/monitoring/application/views/scripts/list/hosts.phtml @@ -90,7 +90,7 @@ if (count($hosts) === 0) { ) ) ?>) -

escape($this->ellipsis($host->host_output, 10000)) ?>

+

pluginOutput($this->ellipsis($host->host_output, 10000), true) ?>

addColumns as $col): ?> escape($host->$col) ?> diff --git a/modules/monitoring/application/views/scripts/list/notifications.phtml b/modules/monitoring/application/views/scripts/list/notifications.phtml index f94266210..06a9e80a0 100644 --- a/modules/monitoring/application/views/scripts/list/notifications.phtml +++ b/modules/monitoring/application/views/scripts/list/notifications.phtml @@ -48,7 +48,7 @@ if (count($notifications) === 0) { link()->host($notification->host_name, $notification->host_display_name) ?>
- escape($this->ellipsis($notification->notification_output, 10000)) ?> + pluginOutput($this->ellipsis($notification->notification_output, 10000), true) ?>
contact): ?> diff --git a/modules/monitoring/application/views/scripts/list/services.phtml b/modules/monitoring/application/views/scripts/list/services.phtml index 15f702d10..887757537 100644 --- a/modules/monitoring/application/views/scripts/list/services.phtml +++ b/modules/monitoring/application/views/scripts/list/services.phtml @@ -82,7 +82,7 @@ if (count($services) === 0) { ) ) ?>
perfdata($service->service_perfdata, true, 5) ?>
-

escape($this->ellipsis($service->service_output, 10000)) ?>

+

pluginOutput($this->ellipsis($service->service_output, 10000), true) ?>

addColumns as $col): ?> escape($service->$col) ?>