diff --git a/boot.php b/boot.php index 48eaeb6f3b..b10ba7a63f 100644 --- a/boot.php +++ b/boot.php @@ -43,7 +43,7 @@ define('FRIENDICA_PLATFORM', 'Friendica'); define('FRIENDICA_CODENAME', 'Asparagus'); define('FRIENDICA_VERSION', '3.6-dev'); define('DFRN_PROTOCOL_VERSION', '2.23'); -define('DB_UPDATE_VERSION', 1239); +define('DB_UPDATE_VERSION', 1240); define('NEW_UPDATE_ROUTINE_VERSION', 1170); /** diff --git a/doc/database/db_oembed.md b/doc/database/db_oembed.md index 080c9824cb..651a52e740 100644 --- a/doc/database/db_oembed.md +++ b/doc/database/db_oembed.md @@ -4,6 +4,7 @@ Table oembed | Field | Description | Type | Null | Key | Default | Extra | | ------------ | ---------------------------------- | ------------ | ---- | --- | ------------------- | ----- | | url | page url | varchar(255) | NO | PRI | NULL | | +| maxwidth | Maximum width passed to Oembed | int(11) | NO | PRI | 0 | | | content | OEmbed data of the page | text | NO | | NULL | | | created | datetime of creation | datetime | NO | MUL | 0001-01-01 00:00:00 | | diff --git a/include/bbcode.php b/include/bbcode.php index fed535db57..08bfab3ed7 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -46,16 +46,16 @@ function bb_map_location($match) { * Note: Can produce a [bookmark] tag in the returned string * * @brief Processes [attachment] tags - * @param string $Text + * @param string $return * @param bool|int $simplehtml * @param bool $tryoembed * @return string */ -function bb_attachment($Text, $simplehtml = false, $tryoembed = true) +function bb_attachment($return, $simplehtml = false, $tryoembed = true) { - $data = get_attachment_data($Text); + $data = get_attachment_data($return); if (!$data) { - return $Text; + return $return; } if (isset($data["title"])) { @@ -68,49 +68,46 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) $data["image"] = ""; } + $return = ''; if ($simplehtml == 7) { - $text = style_url_for_mastodon($data["url"]); + $return = style_url_for_mastodon($data["url"]); } elseif (($simplehtml != 4) && ($simplehtml != 0)) { - $text = sprintf('%s
', $data["url"], $data["title"]); + $return = sprintf('%s
', $data["url"], $data["title"]); } else { - if ($simplehtml != 4) { - $text = sprintf('', $data["type"]); - } - - $oembed = sprintf('[bookmark=%s]%s[/bookmark]', $data['url'], $data['title']); - if ($tryoembed) { - try { - $oembed = OEmbed::getHTML($data['url'], $data['title']); - } catch (Exception $e) { - // $oembed isn't modified + try { + if ($tryoembed) { + $return = OEmbed::getHTML($data['url'], $data['title']); + } else { + throw new Exception('OEmbed is disabled for this attachment.'); + } + } catch (Exception $e) { + if ($simplehtml != 4) { + $return = sprintf('', $data["type"]); } - } - if (stripos($oembed, "