]> git.mxchange.org Git - friendica.git/blobdiff - include/feed.php
Issue 2122: Make sure to always return the correct number of entries
[friendica.git] / include / feed.php
index 18d96e6abb15c1bef9d3d2716b54b16728572192..d7bbb24cbfcd5a6bcb35222defcfe5713eb37276 100644 (file)
@@ -106,12 +106,22 @@ function feed_import($xml,$importer,&$contact, &$hub) {
        $header["wall"] = 0;
        $header["origin"] = 0;
        $header["gravity"] = GRAVITY_PARENT;
+       $header["private"] = 2;
+       $header["verb"] = ACTIVITY_POST;
+       $header["object-type"] = ACTIVITY_OBJ_NOTE;
 
        $header["contact-id"] = $contact["id"];
 
+       if(!strlen($contact["notify"])) {
+               // one way feed - no remote comment ability
+               $header["last-child"] = 0;
+       }
+
        if (!is_object($entries))
                return;
 
+       $entrylist = array();
+
        foreach ($entries AS $entry)
                $entrylist[] = $entry;
 
@@ -193,8 +203,8 @@ function feed_import($xml,$importer,&$contact, &$hub) {
 
                //$item["object"] = $xml;
 
-               $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s'",
-                       intval($importer["uid"]), dbesc($item["uri"]));
+               $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s' AND `network` IN ('%s', '%s')",
+                       intval($importer["uid"]), dbesc($item["uri"]), dbesc(NETWORK_FEED), dbesc(NETWORK_DFRN));
                if ($r) {
                        logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$r[0]["id"], LOGGER_DEBUG);
                        continue;