diff --git a/ext/bbcode/main.php b/ext/bbcode/main.php
index 1f358c54..c00c7332 100644
--- a/ext/bbcode/main.php
+++ b/ext/bbcode/main.php
@@ -19,6 +19,7 @@ class BBCode extends FormatterExtension {
$text = preg_replace("/>>([^\d].+)/", "
\\1
", $text);
$text = preg_replace("/\[url=((?:https?|ftp|irc|mailto):\/\/.*?)\](.*?)\[\/url\]/s", "\\2", $text);
$text = preg_replace("/\[url\]((?:https?|ftp|irc|mailto):\/\/.*?)\[\/url\]/s", "\\1", $text);
+ $text = preg_replace("/\[email\](.*?)\[\/email\]/s", "\\1", $text);
$text = preg_replace("/\[img\](https?:\/\/.*?)\[\/img\]/s", "
", $text);
$text = preg_replace("/\[\[([^\|\]]+)\|([^\]]+)\]\]/s", "\\2", $text);
$text = preg_replace("/\[\[([^\]]+)\]\]/s", "\\1", $text);
@@ -60,6 +61,7 @@ class BBCode extends FormatterExtension {
$text = preg_replace("/\[code\](.*?)\[\/code\]/s", "\\1", $text);
$text = preg_replace("/\[url=(.*?)\](.*?)\[\/url\]/s", "\\2", $text);
$text = preg_replace("/\[url\](.*?)\[\/url\]/s", "\\1", $text);
+ $text = preg_replace("/\[email\](.*?)\[\/email\]/s", "\\1", $text);
$text = preg_replace("/\[img\](.*?)\[\/img\]/s", "", $text);
$text = preg_replace("/\[\[([^\|\]]+)\|([^\]]+)\]\]/s", "\\2", $text);
$text = preg_replace("/\[\[([^\]]+)\]\]/s", "\\1", $text);
diff --git a/ext/bbcode/test.php b/ext/bbcode/test.php
index 6951c5b6..da44d2e0 100644
--- a/ext/bbcode/test.php
+++ b/ext/bbcode/test.php
@@ -62,6 +62,12 @@ class BBCodeUnitTest extends UnitTestCase {
"[url=javascript:alert("owned")]click to fail[/url]");
}
+ public function testURL() {
+ $this->assertEqual(
+ $this->filter("[email]spam@shishnet.org[/email]"),
+ "spam@shishnet.org");
+ }
+
private function filter($in) {
$bb = new BBCode();
$tfe = new TextFormattingEvent($in);