X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fostatus_conversation.php;h=36ba207abefeba2cf500df8a514184c6946d8cf2;hb=1b74e3ff100426b86f0f7cdd2f967b7781d6f8fa;hp=cdaf80d76b1eeedcc990f373fa617ed116c1e042;hpb=280b72b9e665c730b9d02319f5ba0d7930b98326;p=friendica.git diff --git a/include/ostatus_conversation.php b/include/ostatus_conversation.php index cdaf80d76b..36ba207abe 100644 --- a/include/ostatus_conversation.php +++ b/include/ostatus_conversation.php @@ -1,5 +1,6 @@ time()) { - logger('complete_conversation: poll intervall not reached'); + logger('complete_conversation: poll interval not reached'); return; } } logger('complete_conversation: cron_start'); - $start = date("Y-m-d H:i:s", time() - 86400); + $start = date("Y-m-d H:i:s", time() - ($poll_timeframe * 60)); $conversations = q("SELECT * FROM `term` WHERE `type` = 7 AND `term` > '%s'", dbesc($start)); foreach ($conversations AS $conversation) { @@ -75,6 +84,9 @@ function complete_conversation($itemid, $conversation_url, $only_add_conversatio $conv_as = json_decode($conv_as); $first_id = ""; + + if (!is_array($conv_as->items)) + return; $items = array_reverse($conv_as->items); foreach ($items as $single_conv) { @@ -97,18 +109,18 @@ function complete_conversation($itemid, $conversation_url, $only_add_conversatio else $parent_uri = $parent["uri"]; - if ($parent["id"] != 0) { - $message_exists = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s' LIMIT 1", + $message_exists = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s' LIMIT 1", intval($message["uid"]), dbesc($single_conv->id)); - if ($message_exists) { + if ($message_exists) { + if ($parent["id"] != 0) { $existing_message = $message_exists[0]; $r = q("UPDATE `item` SET `parent` = %d, `parent-uri` = '%s', `thr-parent` = '%s' WHERE `id` = %d LIMIT 1", intval($parent["id"]), dbesc($parent["uri"]), dbesc($parent_uri), intval($existing_message["id"])); - continue; } + continue; } $arr = array();