X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=include%2Fitems.php;h=549027671d5e11c827c81ca43454a23acd0ee95f;hb=a0f3fe6fde55a61291ce96f657262c6b084b5894;hp=e8905ae256ed27d86a954d5b879409037154ac7d;hpb=1eae40592ca67868a29acf9684f6c47c7ad10755;p=friendica.git diff --git a/include/items.php b/include/items.php index e8905ae256..549027671d 100644 --- a/include/items.php +++ b/include/items.php @@ -1338,6 +1338,10 @@ 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["gcontact-id"] == 0) + $arr["gcontact-id"] = get_gcontact_id(array("url" => $arr['author-link'], "network" => $arr['network'], + "photo" => $arr['author-avatar'], "name" => $arr['author-name'])); + 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); @@ -2768,20 +2772,20 @@ function consume_feed($xml,$importer,&$contact, &$hub, $datedir = 0, $pass = 0) $datarray['gravity'] = GRAVITY_LIKE; // only one like or dislike per person // splitted into two queries for performance issues - $r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 and (`parent-uri` = '%s') limit 1", + $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `author-link` = '%s' AND `verb` = '%s' AND `parent-uri` = '%s' AND NOT `deleted` LIMIT 1", intval($datarray['uid']), - intval($datarray['contact-id']), + dbesc($datarray['author-link']), dbesc($datarray['verb']), - dbesc($parent_uri) + dbesc($datarray['parent-uri']) ); if($r && count($r)) continue; - $r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 and (`thr-parent` = '%s') limit 1", + $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `author-link` = '%s' AND `verb` = '%s' AND `thr-parent` = '%s' AND NOT `deleted` LIMIT 1", intval($datarray['uid']), - intval($datarray['contact-id']), + dbesc($datarray['author-link']), dbesc($datarray['verb']), - dbesc($parent_uri) + dbesc($datarray['parent-uri']) ); if($r && count($r)) continue; @@ -3717,7 +3721,7 @@ function local_delivery($importer,$data) { $datarray['owner-avatar'] = $own[0]['thumb']; $datarray['contact-id'] = $importer['id']; - if(($datarray['verb'] === ACTIVITY_LIKE) + if(($datarray['verb'] === ACTIVITY_LIKE) || ($datarray['verb'] === ACTIVITY_DISLIKE) || ($datarray['verb'] === ACTIVITY_ATTEND) || ($datarray['verb'] === ACTIVITY_ATTENDNO) @@ -3728,19 +3732,18 @@ function local_delivery($importer,$data) { $datarray['last-child'] = 0; // only one like or dislike per person // splitted into two queries for performance issues - $r = q("select id from item where uid = %d and `contact-id` = %d and verb = '%s' and (`parent-uri` = '%s') and deleted = 0 limit 1", + $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `author-link` = '%s' AND `verb` = '%s' AND `parent-uri` = '%s' AND NOT `deleted` LIMIT 1", intval($datarray['uid']), - intval($datarray['contact-id']), + dbesc($datarray['author-link']), dbesc($datarray['verb']), dbesc($datarray['parent-uri']) - ); if($r && count($r)) continue; - $r = q("select id from item where uid = %d and `contact-id` = %d and verb = '%s' and (`thr-parent` = '%s') and deleted = 0 limit 1", + $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `author-link` = '%s' AND `verb` = '%s' AND `thr-parent` = '%s' AND NOT `deleted` LIMIT 1", intval($datarray['uid']), - intval($datarray['contact-id']), + dbesc($datarray['author-link']), dbesc($datarray['verb']), dbesc($datarray['parent-uri']) @@ -3910,7 +3913,7 @@ function local_delivery($importer,$data) { $datarray['parent-uri'] = $parent_uri; $datarray['uid'] = $importer['importer_uid']; $datarray['contact-id'] = $importer['id']; - if(($datarray['verb'] === ACTIVITY_LIKE) + if(($datarray['verb'] === ACTIVITY_LIKE) || ($datarray['verb'] === ACTIVITY_DISLIKE) || ($datarray['verb'] === ACTIVITY_ATTEND) || ($datarray['verb'] === ACTIVITY_ATTENDNO) @@ -3919,20 +3922,20 @@ function local_delivery($importer,$data) { $datarray['gravity'] = GRAVITY_LIKE; // only one like or dislike per person // splitted into two queries for performance issues - $r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 and (`parent-uri` = '%s') limit 1", + $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `author-link` = '%s' AND `verb` = '%s' AND `parent-uri` = '%s' AND NOT `deleted` LIMIT 1", intval($datarray['uid']), - intval($datarray['contact-id']), + dbesc($datarray['author-link']), dbesc($datarray['verb']), - dbesc($parent_uri) + dbesc($datarray['parent-uri']) ); if($r && count($r)) continue; - $r = q("select id from item where uid = %d and `contact-id` = %d and verb ='%s' and deleted = 0 and (`thr-parent` = '%s') limit 1", + $r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `author-link` = '%s' AND `verb` = '%s' AND `thr-parent` = '%s' AND NOT `deleted` LIMIT 1", intval($datarray['uid']), - intval($datarray['contact-id']), + dbesc($datarray['author-link']), dbesc($datarray['verb']), - dbesc($parent_uri) + dbesc($datarray['parent-uri']) ); if($r && count($r)) continue;