X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fdiaspora.php;h=eca22092d81352987a2a8a0e6981c8c7aa3fb206;hb=bb59f105e719ef420a5cd0dcacfa3e3955dc5a0c;hp=fdbc0479f906a3439d37c9119aad05dfabed8412;hpb=a9833a395ff129a5fc4978b7ea08f0d2a84f9be6;p=friendica.git diff --git a/include/diaspora.php b/include/diaspora.php index fdbc0479f9..eca22092d8 100644 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -8,6 +8,8 @@ * This will change in the future. */ +use \Friendica\Core\Config; + require_once("include/items.php"); require_once("include/bb2diaspora.php"); require_once("include/Scrape.php"); @@ -309,10 +311,6 @@ class Diaspora { return false; } - // Use a dummy importer to import the data for the public copy - $importer = array("uid" => 0, "page-flags" => PAGE_FREELOVE); - $message_id = self::dispatch($importer,$msg); - // Now distribute it to the followers $r = q("SELECT `user`.* FROM `user` WHERE `user`.`uid` IN (SELECT `contact`.`uid` FROM `contact` WHERE `contact`.`network` = '%s' AND `contact`.`addr` = '%s') @@ -320,13 +318,22 @@ class Diaspora { dbesc(NETWORK_DIASPORA), dbesc($msg["author"]) ); - if ($r) { + + if (dbm::is_result($r)) { foreach ($r as $rr) { logger("delivering to: ".$rr["username"]); self::dispatch($rr,$msg); } } else { - logger("No subscribers for ".$msg["author"]." ".print_r($msg, true), LOGGER_DEBUG); + $social_relay = (bool)Config::get('system', 'relay_subscribe', false); + + // Use a dummy importer to import the data for the public copy + if ($social_relay) { + $importer = array("uid" => 0, "page-flags" => PAGE_FREELOVE); + $message_id = self::dispatch($importer,$msg); + } else { + logger("Unwanted message from ".$msg["author"]." send by ".$_SERVER["REMOTE_ADDR"]." with ".$_SERVER["HTTP_USER_AGENT"].": ".print_r($msg, true), LOGGER_DEBUG); + } } return $message_id;