namespace Friendica\Protocol;
use Friendica\Content\Feature;
-use Friendica\Content\PageInfo;
use Friendica\Content\Text\BBCode;
use Friendica\Content\Text\Markdown;
use Friendica\Core\Cache\Duration;
* 'key' => The public key of the author
* @throws \Exception
*/
- private static function message($guid, $server, $level = 0)
+ public static function message($guid, $server, $level = 0)
{
if ($level > 5) {
return false;
// Will be overwritten for sharing accounts in Item::insert
if ($fetched) {
- $datarray["post-type"] = Item::PT_FETCHED;
+ $datarray["post-reason"] = Item::PR_FETCHED;
} elseif ($datarray["uid"] == 0) {
- $datarray["post-type"] = Item::PT_GLOBAL;
+ $datarray["post-reason"] = Item::PR_GLOBAL;
} else {
- $datarray["post-type"] = Item::PT_COMMENT;
+ $datarray["post-reason"] = Item::PR_COMMENT;
}
$datarray["guid"] = $guid;
$datarray['thr-parent'] = $thr_parent ?: $toplevel_parent_item['uri'];
$datarray["object-type"] = Activity\ObjectType::COMMENT;
+ $datarray["post-type"] = Item::PT_NOTE;
$datarray["protocol"] = Conversation::PARCEL_DIASPORA;
$datarray["source"] = $xml;
$item["body"] = self::replacePeopleGuid($item["body"], $item["author-link"]);
- // Add OEmbed and other information to the body
- $item["body"] = PageInfo::searchAndAppendToBody($item["body"], false, true);
-
return $item;
} else {
return $item;
Tag::storeFromBody($datarray['uri-id'], $datarray["body"]);
- Post\Media::copy($original_item['uri-id'], $datarray['uri-id']);
$datarray["app"] = $original_item["app"];
$datarray["plink"] = self::plink($author, $guid);
if ($data->photo) {
foreach ($data->photo as $photo) {
self::storePhotoAsMedia($datarray['uri-id'], $photo);
- $body = "[img]".XML::unescape($photo->remote_photo_path).
- XML::unescape($photo->remote_photo_name)."[/img]\n".$body;
}
$datarray["object-type"] = Activity\ObjectType::IMAGE;
+ $datarray["post-type"] = Item::PT_IMAGE;
} else {
$datarray["object-type"] = Activity\ObjectType::NOTE;
-
- // Add OEmbed and other information to the body
- if (!self::isHubzilla($contact["url"])) {
- $body = PageInfo::searchAndAppendToBody($body, false, true);
- }
+ $datarray["post-type"] = Item::PT_NOTE;
}
/// @todo enable support for polls
$datarray["direction"] = $fetched ? Conversation::PULL : Conversation::PUSH;
if ($fetched) {
- $datarray["post-type"] = Item::PT_FETCHED;
+ $datarray["post-reason"] = Item::PR_FETCHED;
} elseif ($datarray["uid"] == 0) {
- $datarray["post-type"] = Item::PT_GLOBAL;
+ $datarray["post-reason"] = Item::PR_GLOBAL;
}
$datarray["body"] = self::replacePeopleGuid($body, $contact["url"]);
return false;
}
- $aes_key = openssl_random_pseudo_bytes(32);
+ $aes_key = random_bytes(32);
$b_aes_key = base64_encode($aes_key);
- $iv = openssl_random_pseudo_bytes(16);
+ $iv = random_bytes(16);
$b_iv = base64_encode($iv);
$ciphertext = self::aesEncrypt($aes_key, $iv, $msg);
$type = "reshare";
} else {
$title = $item["title"];
- $body = $item["body"];
+ $body = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']);
// Fetch the title from an attached link - if there is one
if (empty($item["title"]) && DI::pConfig()->get($owner['uid'], 'system', 'attach_link_title')) {
$thread_parent_item = Post::selectFirst(['guid', 'author-id', 'author-link', 'gravity'], ['uri' => $item['thr-parent'], 'uid' => $item['uid']]);
}
- $body = $item["body"];
+ $body = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']);
// The replied to autor mention is prepended for clarity if:
// - Item replied isn't yours
return false;
}
- $parent = Post::selectFirst(['parent-uri'], ['uri' => $item['thr-parent']]);
- if (!DBA::isResult($parent)) {
- return;
+ // This is only needed for the automated tests
+ if (empty($owner['uprvkey'])) {
+ return false;
}
- $item['parent-uri'] = $parent['parent-uri'];
-
$message = self::constructComment($item, $owner);
if ($message === false) {
return false;