]> git.mxchange.org Git - friendica.git/commitdiff
There was no check for duplicated GUIDs, so doubled posts could occur.
authorMichael Vogel <icarus@dabo.de>
Sun, 10 May 2015 18:43:41 +0000 (20:43 +0200)
committerMichael Vogel <icarus@dabo.de>
Sun, 10 May 2015 18:43:41 +0000 (20:43 +0200)
include/items.php

index 279169e506d9c378108a188d313d3559bf6cfae4..5a0aa9ed51649921a2206ebdc4512946dce8f82e 100644 (file)
@@ -1237,6 +1237,18 @@ function item_store($arr,$force_parent = false, $notify = false, $dontcache = fa
                logger("item_store: Set network to ".$arr["network"]." for ".$arr["uri"], LOGGER_DEBUG);
        }
 
+       if ($arr['guid'] != "") {
+               // Checking if there is already an item with the same guid
+               logger('checking for an item for user '.$arr['uid'].' on network '.$arr['network'].' with the guid '.$arr['guid'], LOGGER_DEBUG);
+               $r = q("SELECT `guid` FROM `item` WHERE `guid` = '%s' AND `network` = '%s' AND `uid` = '%d' LIMIT 1",
+                       dbesc($arr['guid']), dbesc($arr['network']), intval($arr['uid']));
+
+               if(count($r)) {
+                       logger('found item with guid '.$arr['guid'].' for user '.$arr['uid'].' on network '.$arr['network'], LOGGER_DEBUG);
+                       return 0;
+               }
+       }
+
        // Check for hashtags in the body and repair or add hashtag links
        item_body_set_hashtags($arr);