monitoring: Use nl2br instead of str_replace for downtime comment and comment text

This commit is contained in:
Eric Lippmann 2015-01-23 09:45:43 +01:00
parent f47dae1092
commit d07e1329e8
2 changed files with 5 additions and 5 deletions

View File

@ -34,7 +34,7 @@
foreach ($object->comments as $comment) {
// Ticket hook sample
$text = $this->tickets ? preg_replace_callback(
$commentText = $this->tickets ? preg_replace_callback(
$this->tickets->getPattern(),
array($this->tickets, 'createLink'),
$this->escape($comment->comment)
@ -56,11 +56,11 @@ foreach ($object->comments as $comment) {
(<?= ucfirst($comment->type) ?>):
</td>
<td style="padding-left: .5em;">
<?= str_replace(array('\r\n', '\n'), '<br>', $text) ?>
<?= nl2br($commentText) ?>
</td>
</tr>
</table>
</td>
</tr>
<?php } // endforeach ?>
<?php } // endforeach ?>

View File

@ -34,7 +34,7 @@
foreach ($object->downtimes as $downtime) {
// Ticket hook sample
$text = $this->tickets ? preg_replace_callback(
$commentText = $this->tickets ? preg_replace_callback(
$this->tickets->getPattern(),
array($this->tickets, 'createLink'),
$this->escape($downtime->comment)
@ -66,7 +66,7 @@ foreach ($object->downtimes as $downtime) {
<?= $state ?>
</td>
<td style="padding-left: .5em;">
<?= str_replace(array('\r\n', '\n'), '<br>', $text) ?>
<?= nl2br($commentText) ?>
</td>
</tr>
</table>