Don't transmit smiley links to external systems
This commit is contained in:
parent
53d4312903
commit
8f318e492e
|
@ -53,6 +53,7 @@ class BBCode
|
||||||
const VERSION = '2021-05-01';
|
const VERSION = '2021-05-01';
|
||||||
|
|
||||||
const INTERNAL = 0;
|
const INTERNAL = 0;
|
||||||
|
const EXTERNAL = 1;
|
||||||
const API = 2;
|
const API = 2;
|
||||||
const DIASPORA = 3;
|
const DIASPORA = 3;
|
||||||
const CONNECTORS = 4;
|
const CONNECTORS = 4;
|
||||||
|
@ -1386,7 +1387,7 @@ class BBCode
|
||||||
// Handle attached links or videos
|
// Handle attached links or videos
|
||||||
if ($simple_html == self::ACTIVITYPUB) {
|
if ($simple_html == self::ACTIVITYPUB) {
|
||||||
$text = self::removeAttachment($text);
|
$text = self::removeAttachment($text);
|
||||||
} elseif (!in_array($simple_html, [self::INTERNAL, self::CONNECTORS])) {
|
} elseif (!in_array($simple_html, [self::INTERNAL, self::EXTERNAL, self::CONNECTORS])) {
|
||||||
$text = self::removeAttachment($text, true);
|
$text = self::removeAttachment($text, true);
|
||||||
} else {
|
} else {
|
||||||
$text = self::convertAttachment($text, $simple_html, $try_oembed);
|
$text = self::convertAttachment($text, $simple_html, $try_oembed);
|
||||||
|
@ -1396,9 +1397,9 @@ class BBCode
|
||||||
$text = str_replace('[nosmile]', '', $text);
|
$text = str_replace('[nosmile]', '', $text);
|
||||||
|
|
||||||
// Replace non graphical smilies for external posts
|
// Replace non graphical smilies for external posts
|
||||||
if (!$nosmile && !$for_plaintext) {
|
if (!$nosmile) {
|
||||||
$text = self::performWithEscapedTags($text, ['img'], function ($text) {
|
$text = self::performWithEscapedTags($text, ['img'], function ($text) use ($simple_html, $for_plaintext) {
|
||||||
return Smilies::replace($text);
|
return Smilies::replace($text, ($simple_html != self::INTERNAL) || $for_plaintext);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1556,7 +1556,7 @@ class Transmitter
|
||||||
$richbody = preg_replace_callback($regexp, ['self', 'mentionCallback'], $item['body']);
|
$richbody = preg_replace_callback($regexp, ['self', 'mentionCallback'], $item['body']);
|
||||||
$richbody = BBCode::removeAttachment($richbody);
|
$richbody = BBCode::removeAttachment($richbody);
|
||||||
|
|
||||||
$data['contentMap'][$language] = BBCode::convert($richbody, false);
|
$data['contentMap'][$language] = BBCode::convert($richbody, false, BBCode::EXTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
$data['source'] = ['content' => $item['body'], 'mediaType' => "text/bbcode"];
|
$data['source'] = ['content' => $item['body'], 'mediaType' => "text/bbcode"];
|
||||||
|
|
Loading…
Reference in New Issue
Block a user