diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index d6d880f1..a58dfc1c 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -14,7 +14,6 @@ use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Renderer; use Friendica\Database\DBA; -use Friendica\Protocol\Activity; use Friendica\Util\Network; use Friendica\Model\Item; @@ -123,7 +122,7 @@ function mailstream_post_hook(&$a, &$item) { return; } if (PConfig::get($item['uid'], 'mailstream', 'nolikes')) { - if ($item['verb'] == Activity::LIKE) { + if ($item['verb'] == ACTIVITY_LIKE) { Logger::debug('mailstream: like item ' . $item['id']); return; } diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index e8b740c2..537bf280 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -21,8 +21,6 @@ use Friendica\Model\Contact; use Friendica\Model\Group; use Friendica\Model\Item; use Friendica\Model\User; -use Friendica\Protocol\Activity; -use Friendica\Protocol\ActivityNamespace; use Friendica\Util\ConfigFileLoader; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; @@ -482,7 +480,7 @@ function pumpio_send(App $a, array &$b) } } - if ($b['verb'] == Activity::LIKE) { + if ($b['verb'] == ACTIVITY_LIKE) { if ($b['deleted']) { pumpio_action($a, $b["uid"], $b["thr-parent"], "unlike"); } else { @@ -491,15 +489,15 @@ function pumpio_send(App $a, array &$b) return; } - if ($b['verb'] == Activity::DISLIKE) { + if ($b['verb'] == ACTIVITY_DISLIKE) { return; } - if (($b['verb'] == Activity::POST) && ($b['created'] !== $b['edited']) && !$b['deleted']) { + if (($b['verb'] == ACTIVITY_POST) && ($b['created'] !== $b['edited']) && !$b['deleted']) { pumpio_action($a, $b["uid"], $b["uri"], "update", $b["body"]); } - if (($b['verb'] == Activity::POST) && $b['deleted']) { + if (($b['verb'] == ACTIVITY_POST) && $b['deleted']) { pumpio_action($a, $b["uid"], $b["uri"], "delete"); } @@ -562,8 +560,8 @@ function pumpio_send(App $a, array &$b) $inReplyTo = ["id" => $orig_post["uri"], "objectType" => "note"]; - if (($orig_post["object-type"] != "") && (strstr($orig_post["object-type"], ActivityNamespace::ACTIVITY_SCHEMA))) { - $inReplyTo["objectType"] = str_replace(ActivityNamespace::ACTIVITY_SCHEMA, '', $orig_post["object-type"]); + if (($orig_post["object-type"] != "") && (strstr($orig_post["object-type"], NAMESPACE_ACTIVITY_SCHEMA))) { + $inReplyTo["objectType"] = str_replace(NAMESPACE_ACTIVITY_SCHEMA, '', $orig_post["object-type"]); } $params["object"] = [ @@ -638,8 +636,8 @@ function pumpio_action(App $a, $uid, $uri, $action, $content = "") $uri = $orig_post["uri"]; } - if (($orig_post["object-type"] != "") && (strstr($orig_post["object-type"], ActivityNamespace::ACTIVITY_SCHEMA))) { - $objectType = str_replace(ActivityNamespace::ACTIVITY_SCHEMA, '', $orig_post["object-type"]); + if (($orig_post["object-type"] != "") && (strstr($orig_post["object-type"], NAMESPACE_ACTIVITY_SCHEMA))) { + $objectType = str_replace(NAMESPACE_ACTIVITY_SCHEMA, '', $orig_post["object-type"]); } elseif (strstr($uri, "/api/comment/")) { $objectType = "comment"; } elseif (strstr($uri, "/api/note/")) { @@ -916,7 +914,7 @@ function pumpio_dounlike(App $a, $uid, $self, $post, $own_id) } } - Item::delete(['verb' => Activity::LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']]); + Item::delete(['verb' => ACTIVITY_LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']]); if (DBA::isResult($r)) { Logger::log("pumpio_dounlike: unliked existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']); @@ -971,7 +969,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion = } } - $condition = ['verb' => Activity::LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']]; + $condition = ['verb' => ACTIVITY_LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']]; if (Item::exists($condition)) { Logger::log("pumpio_dolike: found existing like. User ".$own_id." ".$uid." Contact: ".$contactid." Url ".$orig_post['uri']); return; @@ -979,7 +977,7 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion = $likedata = []; $likedata['parent'] = $orig_post['id']; - $likedata['verb'] = Activity::LIKE; + $likedata['verb'] = ACTIVITY_LIKE; $likedata['gravity'] = GRAVITY_ACTIVITY; $likedata['uid'] = $uid; $likedata['wall'] = 0; @@ -998,11 +996,11 @@ function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion = $objauthor = '[url=' . $orig_post['author-link'] . ']' . $orig_post['author-name'] . '[/url]'; $post_type = L10n::t('status'); $plink = '[url=' . $orig_post['plink'] . ']' . $post_type . '[/url]'; - $likedata['object-type'] = Activity\ObjectType::NOTE; + $likedata['object-type'] = ACTIVITY_OBJ_NOTE; $likedata['body'] = L10n::t('%1$s likes %2$s\'s %3$s', $author, $objauthor, $plink); - $likedata['object'] = '' . Activity\ObjectType::NOTE . '1' . + $likedata['object'] = '' . ACTIVITY_OBJ_NOTE . '1' . '' . $orig_post['uri'] . '' . XML::escape('') . '' . $orig_post['title'] . '' . $orig_post['body'] . ''; $ret = Item::insert($likedata); @@ -1149,7 +1147,7 @@ function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcomp $postarray['uid'] = $uid; $postarray['wall'] = 0; $postarray['uri'] = $post->object->id; - $postarray['object-type'] = ActivityNamespace::ACTIVITY_SCHEMA . strtolower($post->object->objectType); + $postarray['object-type'] = NAMESPACE_ACTIVITY_SCHEMA.strtolower($post->object->objectType); if ($post->object->objectType != "comment") { $contact_id = pumpio_get_contact($uid, $post->actor); @@ -1232,7 +1230,7 @@ function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcomp } $postarray['contact-id'] = $contact_id; - $postarray['verb'] = Activity::POST; + $postarray['verb'] = ACTIVITY_POST; $postarray['owner-name'] = $post->actor->displayName; $postarray['owner-link'] = $post->actor->url; $postarray['author-name'] = $postarray['owner-name']; diff --git a/remote_permissions/remote_permissions.php b/remote_permissions/remote_permissions.php index 6c25df27..5adfc028 100644 --- a/remote_permissions/remote_permissions.php +++ b/remote_permissions/remote_permissions.php @@ -7,14 +7,12 @@ * Status: Unsupported */ -use Friendica\BaseObject; use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\L10n; use Friendica\Core\PConfig; use Friendica\Core\Renderer; use Friendica\Database\DBA; -use Friendica\Util\ACLFormatter; use Friendica\Util\Strings; function remote_permissions_install() { @@ -125,13 +123,10 @@ function remote_permissions_content($a, $item_copy) { $item = $r[0]; - /** @var ACLFormatter $aclFormatter */ - $aclFormatter = BaseObject::getClass(ACLFormatter::class); - - $allowed_users = $aclFormatter->expand($item['allow_cid'] ?? ''); - $allowed_groups = $aclFormatter->expand($item['allow_gid'] ?? ''); - $deny_users = $aclFormatter->expand($item['deny_cid'] ?? ''); - $deny_groups = $aclFormatter->expand($item['deny_gid'] ?? ''); + $allowed_users = expand_acl($item['allow_cid']); + $allowed_groups = expand_acl($item['allow_gid']); + $deny_users = expand_acl($item['deny_cid']); + $deny_groups = expand_acl($item['deny_gid']); $o = L10n::t('Visible to:') . '
'; $allow = []; diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index fee8fd82..ed7b87d8 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -36,7 +36,6 @@ define('STATUSNET_DEFAULT_POLL_INTERVAL', 5); // given in minutes require_once __DIR__ . DIRECTORY_SEPARATOR . 'library' . DIRECTORY_SEPARATOR . 'statusnetoauth.php'; - use CodebirdSN\CodebirdSN; use Friendica\App; use Friendica\Content\OEmbed; @@ -49,6 +48,7 @@ use Friendica\Core\Logger; use Friendica\Core\PConfig; use Friendica\Core\Protocol; use Friendica\Core\Renderer; +use Friendica\Core\System; use Friendica\Database\DBA; use Friendica\Model\Contact; use Friendica\Model\Group; @@ -56,7 +56,6 @@ use Friendica\Model\Item; use Friendica\Model\ItemContent; use Friendica\Model\Photo; use Friendica\Model\User; -use Friendica\Protocol\Activity; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; use Friendica\Util\Strings; @@ -551,11 +550,11 @@ function statusnet_post_hook(App $a, &$b) } } - if (($b['verb'] == Activity::POST) && $b['deleted']) { + if (($b['verb'] == ACTIVITY_POST) && $b['deleted']) { statusnet_action($a, $b["uid"], substr($orig_post["uri"], $hostlength), "delete"); } - if ($b['verb'] == Activity::LIKE) { + if ($b['verb'] == ACTIVITY_LIKE) { Logger::log("statusnet_post_hook: parameter 2 " . substr($b["thr-parent"], $hostlength), Logger::DEBUG); if ($b['deleted']) statusnet_action($a, $b["uid"], substr($b["thr-parent"], $hostlength), "unlike"); @@ -1140,11 +1139,11 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex $postarray['thr-parent'] = $item['uri']; $postarray['parent-uri'] = $item['parent-uri']; $postarray['parent'] = $item['parent']; - $postarray['object-type'] = Activity\ObjectType::COMMENT; + $postarray['object-type'] = ACTIVITY_OBJ_COMMENT; } else { $postarray['thr-parent'] = $postarray['uri']; $postarray['parent-uri'] = $postarray['uri']; - $postarray['object-type'] = Activity\ObjectType::NOTE; + $postarray['object-type'] = ACTIVITY_OBJ_NOTE; } // Is it me? @@ -1168,7 +1167,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex $create_user = false; } else { $postarray['parent-uri'] = $postarray['uri']; - $postarray['object-type'] = Activity\ObjectType::NOTE; + $postarray['object-type'] = ACTIVITY_OBJ_NOTE; } if ($contactid == 0) { @@ -1185,7 +1184,7 @@ function statusnet_createpost(App $a, $uid, $post, $self, $create_user, $only_ex $postarray['contact-id'] = $contactid; - $postarray['verb'] = Activity::POST; + $postarray['verb'] = ACTIVITY_POST; $postarray['author-name'] = $content->user->name; $postarray['author-link'] = $content->user->statusnet_profile_url; diff --git a/twitter/twitter.php b/twitter/twitter.php index 11f21a89..c4a1a57e 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -85,7 +85,6 @@ use Friendica\Model\Item; use Friendica\Model\ItemContent; use Friendica\Model\User; use Friendica\Object\Image; -use Friendica\Protocol\Activity; use Friendica\Util\ConfigFileLoader; use Friendica\Util\DateTimeFormat; use Friendica\Util\Network; @@ -110,7 +109,7 @@ function twitter_install() Hook::register('expire' , __FILE__, 'twitter_expire'); Hook::register('prepare_body' , __FILE__, 'twitter_prepare_body'); Hook::register('check_item_notification', __FILE__, 'twitter_check_item_notification'); - Logger::log("installed twitter"); + Logger::info("installed twitter"); } function twitter_uninstall() @@ -155,7 +154,7 @@ function twitter_check_item_notification(App $a, array &$notification_data) function twitter_follow(App $a, array &$contact) { - Logger::log("twitter_follow: Check if contact is twitter contact. " . $contact["url"], Logger::DEBUG); + Logger::info('Check if contact is twitter contact', ['url' => $contact["url"]]); if (!strstr($contact["url"], "://twitter.com") && !strstr($contact["url"], "@twitter.com")) { return; @@ -240,7 +239,7 @@ function twitter_settings_post(App $a) } else { if (isset($_POST['twitter-pin'])) { // if the user supplied us with a PIN from Twitter, let the magic of OAuth happen - Logger::log('got a Twitter PIN'); + Logger::notice('got a Twitter PIN'); $ckey = Config::get('twitter', 'consumerkey'); $csecret = Config::get('twitter', 'consumersecret'); // the token and secret for which the PIN was generated were hidden in the settings @@ -429,7 +428,7 @@ function twitter_hook_fork(App $a, array &$b) if (PConfig::get($post['uid'], 'twitter', 'import')) { // Don't fork if it isn't a reply to a twitter post if (($post['parent'] != $post['id']) && !Item::exists(['id' => $post['parent'], 'network' => Protocol::TWITTER])) { - Logger::log('No twitter parent found for item ' . $post['id']); + Logger::notice('No twitter parent found', ['item' => $post['id']]); $b['execute'] = false; return; } @@ -557,11 +556,11 @@ function twitter_post_hook(App $a, array &$b) } } - if (($b['verb'] == Activity::POST) && $b['deleted']) { + if (($b['verb'] == ACTIVITY_POST) && $b['deleted']) { twitter_action($a, $b["uid"], substr($orig_post["uri"], 9), "delete"); } - if ($b['verb'] == Activity::LIKE) { + if ($b['verb'] == ACTIVITY_LIKE) { Logger::log("twitter_post_hook: parameter 2 " . substr($b["thr-parent"], 9), Logger::DEBUG); if ($b['deleted']) { twitter_action($a, $b["uid"], substr($b["thr-parent"], 9), "unlike"); @@ -624,7 +623,7 @@ function twitter_post_hook(App $a, array &$b) $b['body'] = twitter_update_mentions($b['body']); $msgarr = ItemContent::getPlaintextPost($b, $max_char, true, 8); - Logger::info('Got plaintext', $msgarr); + Logger::info('Got plaintext', ['id' => $b['id'], 'message' => $msgarr]); $msg = $msgarr["text"]; if (($msg == "") && isset($msgarr["title"])) { @@ -641,6 +640,7 @@ function twitter_post_hook(App $a, array &$b) } if (empty($msg)) { + Logger::info('Empty message', ['id' => $b['id']]); return; } @@ -648,6 +648,7 @@ function twitter_post_hook(App $a, array &$b) $post = []; if (!empty($msgarr['images'])) { + Logger::info('Got images', ['id' => $b['id'], 'images' => $msgarr['images']]); try { $media_ids = []; foreach ($msgarr['images'] as $image) { @@ -660,6 +661,7 @@ function twitter_post_hook(App $a, array &$b) $tempfile = tempnam(get_temppath(), 'cache'); file_put_contents($tempfile, $img_str); + Logger::info('Uploading', ['id' => $b['id'], 'image' => $image['url']]); $media = $connection->upload('media/upload', ['media' => $tempfile]); unlink($tempfile); @@ -671,10 +673,10 @@ function twitter_post_hook(App $a, array &$b) $data = ['media_id' => $media->media_id_string, 'alt_text' => ['text' => substr($image['description'], 0, 420)]]; $ret = $cb->media_metadata_create($data); - Logger::info('Metadata create', ['data' => $data, 'return' => json_encode($ret)]); + Logger::info('Metadata create', ['id' => $b['id'], 'data' => $data, 'return' => json_encode($ret)]); } } else { - throw new Exception('Failed upload of ' . $image['url']); + throw new Exception('Failed upload', ['id' => $b['id'], 'image' => $image['url']]); } } $post['media_ids'] = implode(',', $media_ids); @@ -682,7 +684,7 @@ function twitter_post_hook(App $a, array &$b) unset($post['media_ids']); } } catch (Exception $e) { - Logger::log('Exception when trying to send to Twitter: ' . $e->getMessage()); + Logger::info('Exception when trying to send to Twitter', ['id' => $b['id'], 'message' => $e->getMessage()]); } } @@ -694,17 +696,17 @@ function twitter_post_hook(App $a, array &$b) $url = 'statuses/update'; $result = $connection->post($url, $post); - Logger::log('twitter_post send, result: ' . print_r($result, true), Logger::DEBUG); + Logger::info('twitter_post send', ['id' => $b['id'], 'result' => $result]); if (!empty($result->source)) { Config::set("twitter", "application_name", strip_tags($result->source)); } if (!empty($result->errors)) { - Logger::log('Send to Twitter failed: "' . print_r($result->errors, true) . '"'); + Logger::info('Send to Twitter failed', ['id' => $b['id'], 'error' => $result->errors]); Worker::defer(); } elseif ($iscomment) { - Logger::log('twitter_post: Update extid ' . $result->id_str . " for post id " . $b['id']); + Logger::info('Update extid', ['id' => $b['id'], 'extid' => $result->id_str]); Item::update(['extid' => "twitter::" . $result->id_str], ['id' => $b['id']]); } } @@ -743,16 +745,16 @@ function twitter_cron(App $a) if ($last) { $next = $last + ($poll_interval * 60); if ($next > time()) { - Logger::log('twitter: poll intervall not reached'); + Logger::notice('twitter: poll intervall not reached'); return; } } - Logger::log('twitter: cron_start'); + Logger::notice('twitter: cron_start'); $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'mirror_posts' AND `v` = '1'"); if (DBA::isResult($r)) { foreach ($r as $rr) { - Logger::log('twitter: fetching for user ' . $rr['uid']); + Logger::notice('Fetching', ['user' => $rr['uid']]); Worker::add(['priority' => PRIORITY_MEDIUM, 'force_priority' => true], "addon/twitter/twitter_sync.php", 1, (int) $rr['uid']); } } @@ -770,12 +772,12 @@ function twitter_cron(App $a) if ($abandon_days != 0) { $user = q("SELECT `login_date` FROM `user` WHERE uid=%d AND `login_date` >= '%s'", $rr['uid'], $abandon_limit); if (!DBA::isResult($user)) { - Logger::log('abandoned account: timeline from user ' . $rr['uid'] . ' will not be imported'); + Logger::notice('abandoned account: timeline from user will not be imported', ['user' => $rr['uid']]); continue; } } - Logger::log('twitter: importing timeline from user ' . $rr['uid']); + Logger::notice('importing timeline', ['user' => $rr['uid']]); Worker::add(['priority' => PRIORITY_MEDIUM, 'force_priority' => true], "addon/twitter/twitter_sync.php", 2, (int) $rr['uid']); /* // To-Do @@ -794,7 +796,7 @@ function twitter_cron(App $a) } } - Logger::log('twitter: cron_end'); + Logger::notice('twitter: cron_end'); Config::set('twitter', 'last_poll', time()); } @@ -813,17 +815,17 @@ function twitter_expire(App $a) } DBA::close($r); - Logger::log('twitter_expire: expire_start'); + Logger::notice('twitter_expire: expire_start'); $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'twitter' AND `k` = 'import' AND `v` = '1' ORDER BY RAND()"); if (DBA::isResult($r)) { foreach ($r as $rr) { - Logger::log('twitter_expire: user ' . $rr['uid']); + Logger::notice('twitter_expire', ['user' => $rr['uid']]); Item::expire($rr['uid'], $days, Protocol::TWITTER, true); } } - Logger::log('twitter_expire: expire_end'); + Logger::notice('twitter_expire: expire_end'); } function twitter_prepare_body(App $a, array &$b) @@ -957,12 +959,12 @@ function twitter_fetchtimeline(App $a, $uid) try { $items = $connection->get('statuses/user_timeline', $parameters); } catch (TwitterOAuthException $e) { - Logger::log('Error fetching timeline for user ' . $uid . ': ' . $e->getMessage()); + Logger::notice('Error fetching timeline', ['user' => $uid, 'message' => $e->getMessage()]); return; } if (!is_array($items)) { - Logger::log('No items for user ' . $uid, Logger::INFO); + Logger::notice('No items', ['user' => $uid]); return; } @@ -1341,7 +1343,7 @@ function twitter_media_entities($post, array &$postarray) $media[$medium->url] .= "\n[img]" . $medium->media_url_https . '[/img]'; } - $postarray['object-type'] = Activity\ObjectType::IMAGE; + $postarray['object-type'] = ACTIVITY_OBJ_IMAGE; break; case 'video': case 'animated_gif': @@ -1352,7 +1354,7 @@ function twitter_media_entities($post, array &$postarray) $media[$medium->url] .= "\n[img]" . $medium->media_url_https . '[/img]'; } - $postarray['object-type'] = Activity\ObjectType::VIDEO; + $postarray['object-type'] = ACTIVITY_OBJ_VIDEO; if (is_array($medium->video_info->variants)) { $bitrate = 0; // We take the video with the highest bitrate @@ -1409,11 +1411,11 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl $postarray['thr-parent'] = $parent_item['uri']; $postarray['parent-uri'] = $parent_item['parent-uri']; $postarray['parent'] = $parent_item['parent']; - $postarray['object-type'] = Activity\ObjectType::COMMENT; + $postarray['object-type'] = ACTIVITY_OBJ_COMMENT; } else { $postarray['thr-parent'] = $postarray['uri']; $postarray['parent-uri'] = $postarray['uri']; - $postarray['object-type'] = Activity\ObjectType::NOTE; + $postarray['object-type'] = ACTIVITY_OBJ_NOTE; } // Is it me? @@ -1438,7 +1440,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl $create_user = false; } else { $postarray['parent-uri'] = $postarray['uri']; - $postarray['object-type'] = Activity\ObjectType::NOTE; + $postarray['object-type'] = ACTIVITY_OBJ_NOTE; } if ($contactid == 0) { @@ -1458,7 +1460,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl $postarray['contact-id'] = $contactid; - $postarray['verb'] = Activity::POST; + $postarray['verb'] = ACTIVITY_POST; $postarray['author-name'] = $postarray['owner-name']; $postarray['author-link'] = $postarray['owner-link']; $postarray['author-avatar'] = $postarray['owner-avatar']; @@ -1481,7 +1483,7 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl // When the post contains links then use the correct object type if (count($post->entities->urls) > 0) { - $postarray['object-type'] = Activity\ObjectType::BOOKMARK; + $postarray['object-type'] = ACTIVITY_OBJ_BOOKMARK; } // Search for media links @@ -1519,9 +1521,9 @@ function twitter_createpost(App $a, $uid, $post, array $self, $create_user, $onl Item::insert($retweet); // CHange the other post into a reshare activity - $postarray['verb'] = Activity::ANNOUNCE; + $postarray['verb'] = ACTIVITY2_ANNOUNCE; $postarray['gravity'] = GRAVITY_ACTIVITY; - $postarray['object-type'] = Activity\ObjectType::NOTE; + $postarray['object-type'] = ACTIVITY_OBJ_NOTE; $postarray['thr-parent'] = $retweet['uri']; $postarray['parent-uri'] = $retweet['uri'];