diff --git a/core/event.class.php b/core/event.class.php
index cb9b9985..1bd47edb 100644
--- a/core/event.class.php
+++ b/core/event.class.php
@@ -223,9 +223,10 @@ class TextFormattingEvent extends Event {
var $stripped;
public function TextFormattingEvent($text) {
- $this->original = $text;
- $this->formatted = $text;
- $this->stripped = $text;
+ $h_text = html_escape(trim($text));
+ $this->original = $h_text;
+ $this->formatted = $h_text;
+ $this->stripped = $h_text;
}
}
diff --git a/ext/bbcode/main.php b/ext/bbcode/main.php
index aa6128e6..b2f705fb 100644
--- a/ext/bbcode/main.php
+++ b/ext/bbcode/main.php
@@ -9,8 +9,6 @@ class BBCode extends Extension {
}
private function bbcode_to_html($text) {
- $text = trim($text);
- $text = html_escape($text);
$text = preg_replace("/\[b\](.*?)\[\/b\]/s", "\\1", $text);
$text = preg_replace("/\[i\](.*?)\[\/i\]/s", "\\1", $text);
$text = preg_replace("/\[u\](.*?)\[\/u\]/s", "\\1", $text);
@@ -36,8 +34,6 @@ class BBCode extends Extension {
}
private function bbcode_to_text($text) {
- $text = trim($text);
- $text = html_escape($text);
$text = preg_replace("/\[b\](.*?)\[\/b\]/s", "\\1", $text);
$text = preg_replace("/\[i\](.*?)\[\/i\]/s", "\\1", $text);
$text = preg_replace("/\[u\](.*?)\[\/u\]/s", "\\1", $text);