diff --git a/include/bbcode.php b/include/bbcode.php
index 08bfab3ed..d389f302b 100644
--- a/include/bbcode.php
+++ b/include/bbcode.php
@@ -75,7 +75,7 @@ function bb_attachment($return, $simplehtml = false, $tryoembed = true)
$return = sprintf('%s
', $data["url"], $data["title"]);
} else {
try {
- if ($tryoembed) {
+ if ($tryoembed && OEmbed::isAllowedURL($data['url'])) {
$return = OEmbed::getHTML($data['url'], $data['title']);
} else {
throw new Exception('OEmbed is disabled for this attachment.');
@@ -94,7 +94,7 @@ function bb_attachment($return, $simplehtml = false, $tryoembed = true)
if (($data["type"] == "photo") && ($data["url"] != "") && ($data["image"] != "")) {
$return .= sprintf('', $data["url"], proxy_url($data["image"]), $data["title"]);
} else {
- $return .= sprintf('[bookmark=%s]%s[/bookmark]', $data['url'], $data['title']);
+ $return .= sprintf('