]> git.mxchange.org Git - friendica.git/commitdiff
ensure D* photos only attached once
authorFriendika <info@friendika.com>
Thu, 6 Oct 2011 04:02:00 +0000 (21:02 -0700)
committerFriendika <info@friendika.com>
Thu, 6 Oct 2011 04:02:00 +0000 (21:02 -0700)
include/diaspora.php

index d4edc3f11363579cbb1336bccc7efa76e50f78c0..cdb1d6d11b20fa915ea0a6c9707b5424c86e6977 100644 (file)
@@ -762,11 +762,13 @@ function diaspora_photo($importer,$xml,$msg) {
 
        $link_text = '[img]' . $remote_photo_path . $remote_photo_name . '[/img]' . "\n";
 
-       $r = q("update item set `body` = '%s' where `id` = %d and `uid` = %d limit 1",
-               dbesc($link_text . $parent_item['body']),
-               intval($parent_item['id']),
-               intval($parent_item['uid'])
-       );
+       if(! strstr($parent_item['body'],$link_text)) {
+               $r = q("update item set `body` = '%s' where `id` = %d and `uid` = %d limit 1",
+                       dbesc($link_text . $parent_item['body']),
+                       intval($parent_item['id']),
+                       intval($parent_item['uid'])
+               );
+       }
 
        return;
 }