]> git.mxchange.org Git - friendica.git/commitdiff
Don't transmit smiley links to external systems
authorMichael <heluecht@pirati.ca>
Tue, 4 May 2021 21:07:41 +0000 (21:07 +0000)
committerMichael <heluecht@pirati.ca>
Tue, 4 May 2021 21:07:41 +0000 (21:07 +0000)
src/Content/Text/BBCode.php
src/Protocol/ActivityPub/Transmitter.php

index e121778296a862447397c14f45609d7a3a323135..137a6a5d1390a1ce4d32c2161a002131bf189720 100644 (file)
@@ -53,6 +53,7 @@ class BBCode
        const VERSION = '2021-05-01';
 
        const INTERNAL = 0;
+       const EXTERNAL = 1;
        const API = 2;
        const DIASPORA = 3;
        const CONNECTORS = 4;
@@ -1386,7 +1387,7 @@ class BBCode
                                // Handle attached links or videos
                                if ($simple_html == self::ACTIVITYPUB) {
                                        $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);
                                } else {
                                        $text = self::convertAttachment($text, $simple_html, $try_oembed);
@@ -1396,9 +1397,9 @@ class BBCode
                                $text = str_replace('[nosmile]', '', $text);
 
                                // Replace non graphical smilies for external posts
-                               if (!$nosmile && !$for_plaintext) {
-                                       $text = self::performWithEscapedTags($text, ['img'], function ($text) {
-                                               return Smilies::replace($text);
+                               if (!$nosmile) {
+                                       $text = self::performWithEscapedTags($text, ['img'], function ($text) use ($simple_html, $for_plaintext) {
+                                               return Smilies::replace($text, ($simple_html != self::INTERNAL) || $for_plaintext);
                                        });
                                }
 
index 1fd493ccf3b4985ffc735edece4ed5c4f77c1ef5..4f8f48c153915997268048689fe968e4550f45d5 100644 (file)
@@ -1556,7 +1556,7 @@ class Transmitter
                        $richbody = preg_replace_callback($regexp, ['self', 'mentionCallback'], $item['body']);
                        $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"];