mirror of
https://github.com/friendica/friendica
synced 2025-04-28 11:44:23 +02:00
Merge branch 'master' into develop
- Updated new develop version label - Incremented database build number
This commit is contained in:
commit
93daf7883e
474 changed files with 75160 additions and 91301 deletions
|
@ -50,9 +50,9 @@ require_once "include/text.php";
|
|||
class DFRN
|
||||
{
|
||||
|
||||
const DFRN_TOP_LEVEL = 0; // Top level posting
|
||||
const DFRN_REPLY = 1; // Regular reply that is stored locally
|
||||
const DFRN_REPLY_RC = 2; // Reply that will be relayed
|
||||
const TOP_LEVEL = 0; // Top level posting
|
||||
const REPLY = 1; // Regular reply that is stored locally
|
||||
const REPLY_RC = 2; // Reply that will be relayed
|
||||
|
||||
/**
|
||||
* @brief Generates the atom entries for delivery.php
|
||||
|
@ -2146,10 +2146,6 @@ class DFRN
|
|||
Item::update($fields, $condition);
|
||||
|
||||
$changed = true;
|
||||
|
||||
if ($entrytype == DFRN_REPLY_RC) {
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "comment-import", $current["id"]);
|
||||
}
|
||||
}
|
||||
return $changed;
|
||||
}
|
||||
|
@ -2217,12 +2213,12 @@ class DFRN
|
|||
}
|
||||
|
||||
if ($is_a_remote_action) {
|
||||
return DFRN_REPLY_RC;
|
||||
return DFRN::REPLY_RC;
|
||||
} else {
|
||||
return DFRN_REPLY;
|
||||
return DFRN::REPLY;
|
||||
}
|
||||
} else {
|
||||
return DFRN_TOP_LEVEL;
|
||||
return DFRN::TOP_LEVEL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2296,7 +2292,7 @@ class DFRN
|
|||
{
|
||||
logger("Process verb ".$item["verb"]." and object-type ".$item["object-type"]." for entrytype ".$entrytype, LOGGER_DEBUG);
|
||||
|
||||
if (($entrytype == DFRN_TOP_LEVEL)) {
|
||||
if (($entrytype == DFRN::TOP_LEVEL)) {
|
||||
// The filling of the the "contact" variable is done for legcy reasons
|
||||
// The functions below are partly used by ostatus.php as well - where we have this variable
|
||||
$r = q("SELECT * FROM `contact` WHERE `id` = %d", intval($importer["id"]));
|
||||
|
@ -2640,7 +2636,7 @@ class DFRN
|
|||
$entrytype = self::getEntryType($importer, $item);
|
||||
|
||||
// Now assign the rest of the values that depend on the type of the message
|
||||
if (in_array($entrytype, [DFRN_REPLY, DFRN_REPLY_RC])) {
|
||||
if (in_array($entrytype, [DFRN::REPLY, DFRN::REPLY_RC])) {
|
||||
if (!isset($item["object-type"])) {
|
||||
$item["object-type"] = ACTIVITY_OBJ_COMMENT;
|
||||
}
|
||||
|
@ -2662,10 +2658,10 @@ class DFRN
|
|||
}
|
||||
}
|
||||
|
||||
if ($entrytype == DFRN_REPLY_RC) {
|
||||
if ($entrytype == DFRN::REPLY_RC) {
|
||||
$item["type"] = "remote-comment";
|
||||
$item["wall"] = 1;
|
||||
} elseif ($entrytype == DFRN_TOP_LEVEL) {
|
||||
} elseif ($entrytype == DFRN::TOP_LEVEL) {
|
||||
if (!isset($item["object-type"])) {
|
||||
$item["object-type"] = ACTIVITY_OBJ_NOTE;
|
||||
}
|
||||
|
@ -2714,7 +2710,7 @@ class DFRN
|
|||
return;
|
||||
}
|
||||
|
||||
if (in_array($entrytype, [DFRN_REPLY, DFRN_REPLY_RC])) {
|
||||
if (in_array($entrytype, [DFRN::REPLY, DFRN::REPLY_RC])) {
|
||||
$posted_id = Item::insert($item);
|
||||
$parent = 0;
|
||||
|
||||
|
@ -2725,26 +2721,9 @@ class DFRN
|
|||
Item::distribute($posted_id);
|
||||
}
|
||||
|
||||
$item["id"] = $posted_id;
|
||||
|
||||
$r = q(
|
||||
"SELECT `parent`, `parent-uri` FROM `item` WHERE `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($posted_id),
|
||||
intval($importer["importer_uid"])
|
||||
);
|
||||
if (DBM::is_result($r)) {
|
||||
$parent = $r[0]["parent"];
|
||||
$parent_uri = $r[0]["parent-uri"];
|
||||
}
|
||||
|
||||
if ($posted_id && $parent && ($entrytype == DFRN_REPLY_RC)) {
|
||||
logger("Notifying followers about comment ".$posted_id, LOGGER_DEBUG);
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "comment-import", $posted_id);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
} else { // $entrytype == DFRN_TOP_LEVEL
|
||||
} else { // $entrytype == DFRN::TOP_LEVEL
|
||||
if (($importer["uid"] == 0) && ($importer["importer_uid"] != 0)) {
|
||||
logger("Contact ".$importer["id"]." isn't known to user ".$importer["importer_uid"].". The post will be ignored.", LOGGER_DEBUG);
|
||||
return;
|
||||
|
@ -2835,23 +2814,13 @@ class DFRN
|
|||
}
|
||||
}
|
||||
|
||||
$entrytype = self::getEntryType($importer, $item);
|
||||
|
||||
if (!$item["deleted"]) {
|
||||
logger('deleting item '.$item["id"].' uri='.$uri, LOGGER_DEBUG);
|
||||
} else {
|
||||
if ($item["deleted"]) {
|
||||
return;
|
||||
}
|
||||
|
||||
Item::deleteById($item["id"]);
|
||||
logger('deleting item '.$item['id'].' uri='.$uri, LOGGER_DEBUG);
|
||||
|
||||
if ($entrytype != DFRN_TOP_LEVEL) {
|
||||
// if this is a relayed delete, propagate it to other recipients
|
||||
if ($entrytype == DFRN_REPLY_RC) {
|
||||
logger("Notifying followers about deletion of post " . $item["id"], LOGGER_DEBUG);
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "drop", $item["id"]);
|
||||
}
|
||||
}
|
||||
Item::delete(['id' => $item['id']]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -920,7 +920,7 @@ class Diaspora
|
|||
// Note that Friendica contacts will return a "Diaspora person"
|
||||
// if Diaspora connectivity is enabled on their server
|
||||
if ($r && ($r["network"] === NETWORK_DIASPORA)) {
|
||||
self::addFContact($r, $update);
|
||||
self::updateFContact($r);
|
||||
|
||||
// Fetch the updated or added contact
|
||||
$person = dba::selectFirst('fcontact', [], ['network' => NETWORK_DIASPORA, 'addr' => $handle]);
|
||||
|
@ -936,70 +936,21 @@ class Diaspora
|
|||
/**
|
||||
* @brief Updates the fcontact table
|
||||
*
|
||||
* @param array $arr The fcontact data
|
||||
* @param bool $update Update or insert?
|
||||
*
|
||||
* @return string The id of the fcontact entry
|
||||
* @param array $arr The fcontact data
|
||||
*/
|
||||
private static function addFContact($arr, $update = false)
|
||||
private static function updateFContact($arr)
|
||||
{
|
||||
if ($update) {
|
||||
$r = q(
|
||||
"UPDATE `fcontact` SET
|
||||
`name` = '%s',
|
||||
`photo` = '%s',
|
||||
`request` = '%s',
|
||||
`nick` = '%s',
|
||||
`addr` = '%s',
|
||||
`guid` = '%s',
|
||||
`batch` = '%s',
|
||||
`notify` = '%s',
|
||||
`poll` = '%s',
|
||||
`confirm` = '%s',
|
||||
`alias` = '%s',
|
||||
`pubkey` = '%s',
|
||||
`updated` = '%s'
|
||||
WHERE `url` = '%s' AND `network` = '%s'",
|
||||
dbesc($arr["name"]),
|
||||
dbesc($arr["photo"]),
|
||||
dbesc($arr["request"]),
|
||||
dbesc($arr["nick"]),
|
||||
dbesc(strtolower($arr["addr"])),
|
||||
dbesc($arr["guid"]),
|
||||
dbesc($arr["batch"]),
|
||||
dbesc($arr["notify"]),
|
||||
dbesc($arr["poll"]),
|
||||
dbesc($arr["confirm"]),
|
||||
dbesc($arr["alias"]),
|
||||
dbesc($arr["pubkey"]),
|
||||
dbesc(DateTimeFormat::utcNow()),
|
||||
dbesc($arr["url"]),
|
||||
dbesc($arr["network"])
|
||||
);
|
||||
} else {
|
||||
$r = q(
|
||||
"INSERT INTO `fcontact` (`url`,`name`,`photo`,`request`,`nick`,`addr`, `guid`,
|
||||
`batch`, `notify`,`poll`,`confirm`,`network`,`alias`,`pubkey`,`updated`)
|
||||
VALUES ('%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s')",
|
||||
dbesc($arr["url"]),
|
||||
dbesc($arr["name"]),
|
||||
dbesc($arr["photo"]),
|
||||
dbesc($arr["request"]),
|
||||
dbesc($arr["nick"]),
|
||||
dbesc($arr["addr"]),
|
||||
dbesc($arr["guid"]),
|
||||
dbesc($arr["batch"]),
|
||||
dbesc($arr["notify"]),
|
||||
dbesc($arr["poll"]),
|
||||
dbesc($arr["confirm"]),
|
||||
dbesc($arr["network"]),
|
||||
dbesc($arr["alias"]),
|
||||
dbesc($arr["pubkey"]),
|
||||
dbesc(DateTimeFormat::utcNow())
|
||||
);
|
||||
}
|
||||
$fields = ['name' => $arr["name"], 'photo' => $arr["photo"],
|
||||
'request' => $arr["request"], 'nick' => $arr["nick"],
|
||||
'addr' => strtolower($arr["addr"]), 'guid' => $arr["guid"],
|
||||
'batch' => $arr["batch"], 'notify' => $arr["notify"],
|
||||
'poll' => $arr["poll"], 'confirm' => $arr["confirm"],
|
||||
'alias' => $arr["alias"], 'pubkey' => $arr["pubkey"],
|
||||
'updated' => DateTimeFormat::utcNow()];
|
||||
|
||||
return $r;
|
||||
$condition = ['url' => $arr["url"], 'network' => $arr["network"]];
|
||||
|
||||
dba::update('fcontact', $fields, $condition, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1796,6 +1747,12 @@ class Diaspora
|
|||
|
||||
self::fetchGuid($datarray);
|
||||
|
||||
// If we are the origin of the parent we store the original data.
|
||||
// We notify our followers during the item storage.
|
||||
if ($parent_item["origin"]) {
|
||||
$datarray['diaspora_signed_text'] = json_encode($data);
|
||||
}
|
||||
|
||||
$message_id = Item::insert($datarray);
|
||||
|
||||
if ($message_id <= 0) {
|
||||
|
@ -1805,20 +1762,10 @@ class Diaspora
|
|||
if ($message_id) {
|
||||
logger("Stored comment ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||
if ($datarray['uid'] == 0) {
|
||||
Item::distribute($message_id);
|
||||
Item::distribute($message_id, json_encode($data));
|
||||
}
|
||||
}
|
||||
|
||||
// If we are the origin of the parent we store the original data and notify our followers
|
||||
if ($message_id && $parent_item["origin"]) {
|
||||
// Formerly we stored the signed text, the signature and the author in different fields.
|
||||
// We now store the raw data so that we are more flexible.
|
||||
dba::insert('sign', ['iid' => $message_id, 'signed_text' => json_encode($data)]);
|
||||
|
||||
// notify others
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "comment-import", $message_id);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2120,6 +2067,20 @@ class Diaspora
|
|||
|
||||
$datarray["body"] = self::constructLikeBody($contact, $parent_item, $guid);
|
||||
|
||||
// like on comments have the comment as parent. So we need to fetch the toplevel parent
|
||||
if ($parent_item["id"] != $parent_item["parent"]) {
|
||||
$toplevel = dba::selectFirst('item', ['origin'], ['id' => $parent_item["parent"]]);
|
||||
$origin = $toplevel["origin"];
|
||||
} else {
|
||||
$origin = $parent_item["origin"];
|
||||
}
|
||||
|
||||
// If we are the origin of the parent we store the original data.
|
||||
// We notify our followers during the item storage.
|
||||
if ($origin) {
|
||||
$datarray['diaspora_signed_text'] = json_encode($data);
|
||||
}
|
||||
|
||||
$message_id = Item::insert($datarray);
|
||||
|
||||
if ($message_id <= 0) {
|
||||
|
@ -2129,28 +2090,10 @@ class Diaspora
|
|||
if ($message_id) {
|
||||
logger("Stored like ".$datarray["guid"]." with message id ".$message_id, LOGGER_DEBUG);
|
||||
if ($datarray['uid'] == 0) {
|
||||
Item::distribute($message_id);
|
||||
Item::distribute($message_id, json_encode($data));
|
||||
}
|
||||
}
|
||||
|
||||
// like on comments have the comment as parent. So we need to fetch the toplevel parent
|
||||
if ($parent_item["id"] != $parent_item["parent"]) {
|
||||
$toplevel = dba::selectFirst('item', ['origin'], ['id' => $parent_item["parent"]]);
|
||||
$origin = $toplevel["origin"];
|
||||
} else {
|
||||
$origin = $parent_item["origin"];
|
||||
}
|
||||
|
||||
// If we are the origin of the parent we store the original data and notify our followers
|
||||
if ($message_id && $origin) {
|
||||
// Formerly we stored the signed text, the signature and the author in different fields.
|
||||
// We now store the raw data so that we are more flexible.
|
||||
dba::insert('sign', ['iid' => $message_id, 'signed_text' => json_encode($data)]);
|
||||
|
||||
// notify others
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "comment-import", $message_id);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2398,21 +2341,17 @@ class Diaspora
|
|||
$birthday = $contact["bd"];
|
||||
}
|
||||
|
||||
$r = q(
|
||||
"UPDATE `contact` SET `name` = '%s', `nick` = '%s', `addr` = '%s', `name-date` = '%s', `bd` = '%s',
|
||||
`location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `id` = %d AND `uid` = %d",
|
||||
dbesc($name),
|
||||
dbesc($nick),
|
||||
dbesc($author),
|
||||
dbesc(DateTimeFormat::utcNow()),
|
||||
dbesc($birthday),
|
||||
dbesc($location),
|
||||
dbesc($about),
|
||||
dbesc($keywords),
|
||||
dbesc($gender),
|
||||
intval($contact["id"]),
|
||||
intval($importer["uid"])
|
||||
);
|
||||
$fields = ['name' => $name, 'location' => $location,
|
||||
'name-date' => DateTimeFormat::utcNow(),
|
||||
'about' => $about, 'gender' => $gender,
|
||||
'addr' => $author, 'nick' => $nick,
|
||||
'keywords' => $keywords];
|
||||
|
||||
if (!empty($birthday)) {
|
||||
$fields['bd'] = $birthday;
|
||||
}
|
||||
|
||||
dba::update('contact', $fields, ['id' => $contact['id']]);
|
||||
|
||||
$gcontact = ["url" => $contact["url"], "network" => NETWORK_DIASPORA, "generation" => 2,
|
||||
"photo" => $image_url, "name" => $name, "location" => $location,
|
||||
|
@ -2447,78 +2386,6 @@ class Diaspora
|
|||
['id' => $contact["id"], 'uid' => $importer["uid"]]
|
||||
);
|
||||
}
|
||||
// send notification
|
||||
|
||||
$r = q(
|
||||
"SELECT `hide-friends` FROM `profile` WHERE `uid` = %d AND `is-default` = 1 LIMIT 1",
|
||||
intval($importer["uid"])
|
||||
);
|
||||
|
||||
if ($r && !$r[0]["hide-friends"] && !$contact["hidden"] && intval(PConfig::get($importer["uid"], "system", "post_newfriend"))) {
|
||||
$self = q(
|
||||
"SELECT * FROM `contact` WHERE `self` AND `uid` = %d LIMIT 1",
|
||||
intval($importer["uid"])
|
||||
);
|
||||
|
||||
// they are not CONTACT_IS_FOLLOWER anymore but that's what we have in the array
|
||||
|
||||
if ($self && $contact["rel"] == CONTACT_IS_FOLLOWER) {
|
||||
$arr = [];
|
||||
$arr["protocol"] = PROTOCOL_DIASPORA;
|
||||
$arr["uri"] = $arr["parent-uri"] = item_new_uri($a->get_hostname(), $importer["uid"]);
|
||||
$arr["uid"] = $importer["uid"];
|
||||
$arr["contact-id"] = $self[0]["id"];
|
||||
$arr["wall"] = 1;
|
||||
$arr["type"] = 'wall';
|
||||
$arr["gravity"] = 0;
|
||||
$arr["origin"] = 1;
|
||||
$arr["author-name"] = $arr["owner-name"] = $self[0]["name"];
|
||||
$arr["author-link"] = $arr["owner-link"] = $self[0]["url"];
|
||||
$arr["author-avatar"] = $arr["owner-avatar"] = $self[0]["thumb"];
|
||||
$arr["verb"] = ACTIVITY_FRIEND;
|
||||
$arr["object-type"] = ACTIVITY_OBJ_PERSON;
|
||||
|
||||
$A = "[url=".$self[0]["url"]."]".$self[0]["name"]."[/url]";
|
||||
$B = "[url=".$contact["url"]."]".$contact["name"]."[/url]";
|
||||
$BPhoto = "[url=".$contact["url"]."][img]".$contact["thumb"]."[/img][/url]";
|
||||
$arr["body"] = L10n::t('%1$s is now friends with %2$s', $A, $B)."\n\n\n".$BPhoto;
|
||||
|
||||
$arr["object"] = self::constructNewFriendObject($contact);
|
||||
|
||||
$user = dba::selectFirst('user', ['allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'], ['uid' => $importer["uid"]]);
|
||||
|
||||
$arr["allow_cid"] = $user["allow_cid"];
|
||||
$arr["allow_gid"] = $user["allow_gid"];
|
||||
$arr["deny_cid"] = $user["deny_cid"];
|
||||
$arr["deny_gid"] = $user["deny_gid"];
|
||||
|
||||
$i = Item::insert($arr);
|
||||
if ($i) {
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "activity", $i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a XML object for a "new friend" message
|
||||
*
|
||||
* @param array $contact Array of the contact
|
||||
*
|
||||
* @return string The XML
|
||||
*/
|
||||
private static function constructNewFriendObject($contact)
|
||||
{
|
||||
$objtype = ACTIVITY_OBJ_PERSON;
|
||||
$link = '<link rel="alternate" type="text/html" href="'.$contact["url"].'" />'."\n".
|
||||
'<link rel="photo" type="image/jpeg" href="'.$contact["thumb"].'" />'."\n";
|
||||
|
||||
$xmldata = ["object" => ["type" => $objtype,
|
||||
"title" => $contact["name"],
|
||||
"id" => $contact["url"]."/".$contact["name"],
|
||||
"link" => $link]];
|
||||
|
||||
return XML::fromArray($xmldata, $xml, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2918,7 +2785,7 @@ class Diaspora
|
|||
|
||||
while ($item = dba::fetch($r)) {
|
||||
// Fetch the parent item
|
||||
$parent = dba::selectFirst('item', ['author-link', 'origin'], ['id' => $item["parent"]]);
|
||||
$parent = dba::selectFirst('item', ['author-link'], ['id' => $item["parent"]]);
|
||||
|
||||
// Only delete it if the parent author really fits
|
||||
if (!link_compare($parent["author-link"], $contact["url"]) && !link_compare($item["author-link"], $contact["url"])) {
|
||||
|
@ -2926,15 +2793,9 @@ class Diaspora
|
|||
continue;
|
||||
}
|
||||
|
||||
Item::deleteById($item["id"]);
|
||||
Item::delete(['id' => $item['id']]);
|
||||
|
||||
logger("Deleted target ".$target_guid." (".$item["id"].") from user ".$item["uid"]." parent: ".$item["parent"], LOGGER_DEBUG);
|
||||
|
||||
// Now check if the retraction needs to be relayed by us
|
||||
if ($parent["origin"]) {
|
||||
// notify others
|
||||
Worker::add(PRIORITY_HIGH, "Notifier", "drop", $item["id"]);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -3568,6 +3429,10 @@ class Diaspora
|
|||
$ret["root_handle"] = self::handleFromContact($item["contact-id"]);
|
||||
$ret["root_guid"] = $guid;
|
||||
return $ret;
|
||||
} elseif ($complete) {
|
||||
// We are resharing something that isn't a DFRN or Diaspora post.
|
||||
// So we have to return "false" on "$complete" to not trigger a reshare.
|
||||
return false;
|
||||
}
|
||||
} elseif (($guid == "") && $complete) {
|
||||
return false;
|
||||
|
|
|
@ -430,6 +430,9 @@ class Feed {
|
|||
$item['guid'] = Item::guidFromUri($orig_plink, $a->get_hostname());
|
||||
unset($item['uri']);
|
||||
unset($item['parent-uri']);
|
||||
|
||||
// Set the delivery priority for "remote self" to "medium"
|
||||
$notify = PRIORITY_MEDIUM;
|
||||
}
|
||||
|
||||
$id = Item::insert($item, false, $notify);
|
||||
|
|
|
@ -537,13 +537,12 @@ class OStatus
|
|||
private static function deleteNotice($item)
|
||||
{
|
||||
$condition = ['uid' => $item['uid'], 'author-link' => $item['author-link'], 'uri' => $item['uri']];
|
||||
$deleted = dba::selectFirst('item', ['id', 'parent-uri'], $condition);
|
||||
if (!DBM::is_result($deleted)) {
|
||||
logger('Item from '.$item['author-link'].' with uri '.$item['uri'].' for user '.$item['uid']." wasn't found. We don't delete it. ");
|
||||
if (!dba::exists('item', $condition)) {
|
||||
logger('Item from '.$item['author-link'].' with uri '.$item['uri'].' for user '.$item['uid']." wasn't found. We don't delete it.");
|
||||
return;
|
||||
}
|
||||
|
||||
Item::deleteById($deleted["id"]);
|
||||
Item::delete($condition);
|
||||
|
||||
logger('Deleted item with uri '.$item['uri'].' for user '.$item['uid']);
|
||||
}
|
||||
|
|
|
@ -522,7 +522,12 @@ class PortableContact
|
|||
}
|
||||
}
|
||||
|
||||
$fields = ['updated' => $last_updated, 'last_contact' => DateTimeFormat::utcNow()];
|
||||
$fields = ['last_contact' => DateTimeFormat::utcNow()];
|
||||
|
||||
if (!empty($last_updated)) {
|
||||
$fields['updated'] = $last_updated;
|
||||
}
|
||||
|
||||
dba::update('gcontact', $fields, ['nurl' => normalise_link($profile)]);
|
||||
|
||||
if (($gcontacts[0]["generation"] == 0)) {
|
||||
|
@ -1415,7 +1420,7 @@ class PortableContact
|
|||
}
|
||||
|
||||
foreach ($tags as $tag) {
|
||||
dba::insert('gserver-tag', ['gserver-id' => $gserver['id'], 'tag' => $tag]);
|
||||
dba::insert('gserver-tag', ['gserver-id' => $gserver['id'], 'tag' => $tag], true);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1424,11 +1429,19 @@ class PortableContact
|
|||
if (isset($data->protocols)) {
|
||||
if (isset($data->protocols->diaspora)) {
|
||||
$fields['network'] = NETWORK_DIASPORA;
|
||||
$fields['batch'] = $data->protocols->diaspora;
|
||||
if (isset($data->protocols->diaspora->receive)) {
|
||||
$fields['batch'] = $data->protocols->diaspora->receive;
|
||||
} elseif (is_string($data->protocols->diaspora)) {
|
||||
$fields['batch'] = $data->protocols->diaspora;
|
||||
}
|
||||
}
|
||||
if (isset($data->protocols->dfrn)) {
|
||||
$fields['network'] = NETWORK_DFRN;
|
||||
$fields['batch'] = $data->protocols->dfrn;
|
||||
if (isset($data->protocols->dfrn->receive)) {
|
||||
$fields['batch'] = $data->protocols->dfrn->receive;
|
||||
} elseif (is_string($data->protocols->dfrn)) {
|
||||
$fields['batch'] = $data->protocols->dfrn;
|
||||
}
|
||||
}
|
||||
}
|
||||
Diaspora::setRelayContact($server_url, $fields);
|
||||
|
@ -1502,8 +1515,10 @@ class PortableContact
|
|||
if ($serverdata) {
|
||||
$servers = json_decode($serverdata);
|
||||
|
||||
foreach ($servers->pods as $server) {
|
||||
Worker::add(PRIORITY_LOW, "DiscoverPoCo", "server", "https://".$server->host);
|
||||
if (is_array($servers->pods)) {
|
||||
foreach ($servers->pods as $server) {
|
||||
Worker::add(PRIORITY_LOW, "DiscoverPoCo", "server", "https://".$server->host);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue