$person = DBA::selectFirst('fcontact', [], ['network' => Protocol::DIASPORA, 'addr' => $handle]);
if (!DBA::isResult($person)) {
$person = $r;
+ $person['id'] = 0;
}
}
}
);
preg_replace_callback(
- "&\[url=/posts/([^\[\]]*)\](.*)\[\/url\]&Usi",
+ "&\[url=/?posts/([^\[\]]*)\](.*)\[\/url\]&Usi",
function ($match) use ($item) {
self::fetchGuidSub($match, $item);
},
unset($parts['path']);
$host_url = Network::unparseURL($parts);
- return $host_url . '/object/' . $guid;
+ return $host_url . '/objects/' . $guid;
}
return "";
$datarray["contact-id"] = $author_contact["cid"];
$datarray["network"] = $author_contact["network"];
- $datarray["author-link"] = $person["url"];
- $datarray["author-id"] = Contact::getIdForURL($person["url"], 0);
-
- $datarray["owner-link"] = $contact["url"];
- $datarray["owner-id"] = Contact::getIdForURL($contact["url"], 0);
+ $datarray["owner-link"] = $datarray["author-link"] = $person["url"];
+ $datarray["owner-id"] = $datarray["author-id"] = Contact::getIdForURL($person["url"], 0);
$datarray["guid"] = $guid;
$datarray["uri"] = self::getUriFromGuid($author, $guid);
if (!intval(Config::get("system", "diaspora_test"))) {
$content_type = (($public_batch) ? "application/magic-envelope+xml" : "application/json");
- Network::post($dest_url."/", $envelope, ["Content-Type: ".$content_type]);
- $return_code = $a->get_curl_code();
+ $postResult = Network::post($dest_url."/", $envelope, ["Content-Type: ".$content_type]);
+ $return_code = $postResult->getReturnCode();
} else {
logger("test_mode");
return 200;
logger("transmit: ".$logid."-".$guid." to ".$dest_url." returns: ".$return_code);
- if (!$return_code || (($return_code == 503) && (stristr($a->get_curl_headers(), "retry-after")))) {
+ if (!$return_code || (($return_code == 503) && (stristr($postResult->getHeader(), "retry-after")))) {
if (!$no_queue && !empty($contact['contact-type']) && ($contact['contact-type'] != Contact::ACCOUNT_TYPE_RELAY)) {
logger("queue message");
// queue message for redelivery
$author = self::myHandle($owner);
$message = ["author" => $author,
- "guid" => System::createGUID(32),
+ "guid" => System::createUUID(),
"parent_type" => "Post",
"parent_guid" => $item["guid"]];
/// @todo - establish "all day" events in Friendica
$eventdata["all_day"] = "false";
- if (!$event['adjust']) {
+ $eventdata['timezone'] = 'UTC';
+ if (!$event['adjust'] && $user['timezone']) {
$eventdata['timezone'] = $user['timezone'];
-
- if ($eventdata['timezone'] == "") {
- $eventdata['timezone'] = 'UTC';
- }
}
if ($event['start']) {
*
* @return string The message
*/
- private static function messageFromSignature(array $item, array $signature)
+ private static function messageFromSignature(array $item)
{
// Split the signed text
- $signed_parts = explode(";", $signature['signed_text']);
+ $signed_parts = explode(";", $item['signed_text']);
if ($item["deleted"]) {
- $message = ["author" => $signature['signer'],
+ $message = ["author" => $item['signer'],
"target_guid" => $signed_parts[0],
"target_type" => $signed_parts[1]];
} elseif (in_array($item["verb"], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) {
"parent_guid" => $signed_parts[3],
"parent_type" => $signed_parts[2],
"positive" => $signed_parts[0],
- "author_signature" => $signature['signature'],
+ "author_signature" => $item['signature'],
"parent_author_signature" => ""];
} else {
// Remove the comment guid
"guid" => $guid,
"parent_guid" => $parent_guid,
"text" => implode(";", $signed_parts),
- "author_signature" => $signature['signature'],
+ "author_signature" => $item['signature'],
"parent_author_signature" => ""];
}
return $message;
logger("Got relayable data ".$type." for item ".$item["guid"]." (".$item["id"].")", LOGGER_DEBUG);
- // fetch the original signature
- $fields = ['signed_text', 'signature', 'signer'];
- $signature = DBA::selectFirst('sign', $fields, ['iid' => $item["id"]]);
- if (!DBA::isResult($signature)) {
- logger("Couldn't fetch signatur for item ".$item["guid"]." (".$item["id"].")", LOGGER_DEBUG);
- return false;
- }
-
// Old way - is used by the internal Friendica functions
/// @todo Change all signatur storing functions to the new format
- if ($signature['signed_text'] && $signature['signature'] && $signature['signer']) {
- $message = self::messageFromSignature($item, $signature);
+ if ($item['signed_text'] && $item['signature'] && $item['signer']) {
+ $message = self::messageFromSignature($item);
} else {// New way
- $msg = json_decode($signature['signed_text'], true);
+ $msg = json_decode($item['signed_text'], true);
$message = [];
if (is_array($msg)) {
$message[$field] = $data;
}
} else {
- logger("Signature text for item ".$item["guid"]." (".$item["id"].") couldn't be extracted: ".$signature['signed_text'], LOGGER_DEBUG);
+ logger("Signature text for item ".$item["guid"]." (".$item["id"].") couldn't be extracted: ".$item['signed_text'], LOGGER_DEBUG);
}
}