mirror of
https://github.com/friendica/friendica
synced 2024-12-24 00:40:16 +00:00
Merge pull request #10211 from annando/no-smiley
Don't transmit smiley links to external systems
This commit is contained in:
commit
83de8fa891
2 changed files with 6 additions and 5 deletions
|
@ -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 a new issue