From dff6c16bf8538444bd5ab0afd664315bcf50d471 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 16 Jan 2018 15:37:30 +0100 Subject: [PATCH 1/2] PluginOutput: Properly handle whitespace for html output refs #2846 --- .../views/helpers/PluginOutput.php | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/modules/monitoring/application/views/helpers/PluginOutput.php b/modules/monitoring/application/views/helpers/PluginOutput.php index 5224185bc..063d81c7d 100644 --- a/modules/monitoring/application/views/helpers/PluginOutput.php +++ b/modules/monitoring/application/views/helpers/PluginOutput.php @@ -51,6 +51,30 @@ class Zend_View_Helper_PluginOutput extends Zend_View_Helper_Abstract '@@@@@@', ); + /** + * Patterns to be replaced in html plugin output + * + * @var array + */ + protected static $htmlPatterns = array( + '~\\\n~', + '~\\\t~', + '~\\\n\\\n~', + '~]*["/\'][^>]*>~', $output)) { // HTML $output = preg_replace( - '~getPurifier()->purify($output) ); $isHtml = true; From 061071893008ae0c3eaab5f4cc867314cac2efb8 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 16 Jan 2018 15:38:04 +0100 Subject: [PATCH 2/2] PluginOutput: Allow ordered and unordered lists in html output refs #2846 --- .../monitoring/application/views/helpers/PluginOutput.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/monitoring/application/views/helpers/PluginOutput.php b/modules/monitoring/application/views/helpers/PluginOutput.php index 063d81c7d..673b95edd 100644 --- a/modules/monitoring/application/views/helpers/PluginOutput.php +++ b/modules/monitoring/application/views/helpers/PluginOutput.php @@ -191,8 +191,11 @@ class Zend_View_Helper_PluginOutput extends Zend_View_Helper_Abstract $config = HTMLPurifier_Config::createDefault(); $config->set('Core.EscapeNonASCIICharacters', true); - $config->set('HTML.Allowed', 'p,br,b,a[href|target],i,table,tr,th[colspan],td[colspan],div,*[class]'); $config->set('Attr.AllowedFrameTargets', array('_blank')); + $config->set( + 'HTML.Allowed', + 'p,br,b,a[href|target],i,ul,ol,li,table,tr,th[colspan],td[colspan],div,*[class]' + ); // This avoids permission problems: // $config->set('Core.DefinitionCache', null); $config->set('Cache.DefinitionImpl', null);