N°3581 - Dashlet plain text: Fix line returns while keeping XSS protection

This commit is contained in:
Molkobain
2021-03-18 20:22:55 +01:00
parent b3e3a27555
commit f567f581c3
2 changed files with 5 additions and 1 deletions

View File

@@ -849,6 +849,7 @@ class DashletPlainText extends Dashlet
public function Render($oPage, $bEditMode = false, $aExtraParams = array())
{
$sText = $this->aProperties['text'];
$sText = utils::EscapeHtml($sText);
$sText = str_replace(array("\r\n", "\n", "\r"), "<br/>", $sText);
$sId = 'plaintext_'.($bEditMode ? 'edit_' : '').$this->sId;

View File

@@ -1,5 +1,8 @@
{# @copyright Copyright (C) 2010-2021 Combodo SARL #}
{# @license http://opensource.org/licenses/AGPL-3.0 #}
{% apply spaceless %}
<div id="{{ oUIBlock.GetId() }}" class="ibo-dashlet-text {% if oUIBlock.IsHidden() %}ibo-is-hidden{% endif %}" data-role="ibo-dashlet-text">{{ oUIBlock.GetText() }}</div>
<div id="{{ oUIBlock.GetId() }}" class="ibo-dashlet-text {% if oUIBlock.IsHidden() %}ibo-is-hidden{% endif %}" data-role="ibo-dashlet-text">
{# |raw filter is ok here as the escaping is already done by the \DashletPlainText class itself #}
{{ oUIBlock.GetText()|raw }}
</div>
{% endapply %}