]> git.mxchange.org Git - friendica.git/blobdiff - mod/item.php
Merge pull request #11780 from annando/untrusted
[friendica.git] / mod / item.php
index 34475188ea61cb27d826722efdc6096a6cb4ff13..ce4cd45ca7e2e1124a3cc28669e787d13c1a3dd3 100644 (file)
@@ -439,8 +439,13 @@ function item_post(App $a) {
                                // Ensure to only modify attachments that you own
                                $srch = '<' . intval($contact_id) . '>';
 
-                               $condition = ['allow_cid' => $srch, 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '',
-                                               'id' => $attach];
+                               $condition = [
+                                       'allow_cid' => $srch,
+                                       'allow_gid' => '',
+                                       'deny_cid' => '',
+                                       'deny_gid' => '',
+                                       'id' => $attach,
+                               ];
                                if (!Attach::exists($condition)) {
                                        continue;
                                }
@@ -520,7 +525,7 @@ function item_post(App $a) {
                $origin = $_REQUEST['origin'];
        }
 
-       $uri = Item::newURI($api_source ? $profile_uid : $uid, $guid);
+       $uri = Item::newURI($guid);
 
        // Fallback so that we alway have a parent uri
        if (!$thr_parent_uri || !$toplevel_item_id) {
@@ -590,16 +595,6 @@ function item_post(App $a) {
        $datarray['protocol'] = Conversation::PARCEL_DIRECT;
        $datarray['direction'] = Conversation::PUSH;
 
-       $conversation = DBA::selectFirst('conversation', ['conversation-uri', 'conversation-href'], ['item-uri' => $datarray['thr-parent']]);
-       if (DBA::isResult($conversation)) {
-               if ($conversation['conversation-uri'] != '') {
-                       $datarray['conversation-uri'] = $conversation['conversation-uri'];
-               }
-               if ($conversation['conversation-href'] != '') {
-                       $datarray['conversation-href'] = $conversation['conversation-href'];
-               }
-       }
-
        if ($orig_post) {
                $datarray['edit'] = true;
        } else {
@@ -623,7 +618,9 @@ function item_post(App $a) {
                $datarray["author-network"] = Protocol::DFRN;
                $datarray["author-updated"] = '';
                $datarray["author-gsid"] = 0;
+               $datarray["author-uri-id"] = ItemURI::getIdByURI($datarray["author-link"]);
                $datarray["owner-updated"] = '';
+               $datarray["has-media"] = false;
 
                $o = DI::conversation()->create([array_merge($contact_record, $datarray)], 'search', false, true);
 
@@ -672,7 +669,8 @@ function item_post(App $a) {
                        'attach' => $datarray['attach'],
                        'file' => $datarray['file'],
                        'edited' => DateTimeFormat::utcNow(),
-                       'changed' => DateTimeFormat::utcNow()];
+                       'changed' => DateTimeFormat::utcNow()
+               ];
 
                Item::update($fields, ['id' => $post_id]);
                Item::updateDisplayCache($datarray['uri-id']);