X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FProtocol%2FRelay.php;h=d98fda46d7620289bae4fe4eb1218b6b829689e3;hb=b04809ced4577d75be4316a34e65f2e813c86756;hp=b604f5ab37951459d22ee643c7055ecdacd6cfca;hpb=6cba99f9c948e60abc18e1f2176b5fbaf1f7cece;p=friendica.git diff --git a/src/Protocol/Relay.php b/src/Protocol/Relay.php index b604f5ab37..d98fda46d7 100644 --- a/src/Protocol/Relay.php +++ b/src/Protocol/Relay.php @@ -37,9 +37,15 @@ use Friendica\Util\Strings; /** * Base class for relay handling + * @see https://github.com/jaywink/social-relay + * @see https://wiki.diasporafoundation.org/Relay_servers_for_public_posts */ class Relay { + const SCOPE_NONE = ''; + const SCOPE_ALL = 'all'; + const SCOPE_TAGS = 'tags'; + /** * Check if a post is wanted * @@ -55,7 +61,7 @@ class Relay $scope = $config->get('system', 'relay_scope'); - if ($scope == SR_SCOPE_NONE) { + if ($scope == self::SCOPE_NONE) { Logger::info('Server does not accept relay posts - rejected', ['network' => $network, 'url' => $url]); return false; } @@ -74,10 +80,10 @@ class Relay $userTags = []; $denyTags = []; - if ($scope == SR_SCOPE_TAGS) { + if ($scope == self::SCOPE_TAGS) { $server_tags = $config->get('system', 'relay_server_tags'); $tagitems = explode(',', mb_strtolower($server_tags)); - foreach ($tagitems AS $tag) { + foreach ($tagitems as $tag) { $systemTags[] = trim($tag, '# '); } @@ -90,7 +96,7 @@ class Relay $deny_tags = $config->get('system', 'relay_deny_tags'); $tagitems = explode(',', mb_strtolower($deny_tags)); - foreach ($tagitems AS $tag) { + foreach ($tagitems as $tag) { $tag = trim($tag, '# '); $denyTags[] = $tag; } @@ -119,7 +125,7 @@ class Relay } } - if ($scope == SR_SCOPE_ALL) { + if ($scope == self::SCOPE_ALL) { Logger::info('Server accept all posts - accepted', ['network' => $network, 'url' => $url]); return true; }