X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=statusnet%2Fstatusnet.php;h=5cb65b91fdb90d4ebec3c975d4a001086cefe3b5;hb=802c5ca87f5d851a9be776bfc6245c1606ff6c6e;hp=97281a3994191233de2b5b649dc43fcf4e241e34;hpb=b84d05b602a7f6531e5b0048baf9c3eba56e844c;p=friendica-addons.git diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 97281a39..5cb65b91 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -366,7 +366,7 @@ function statusnet_hook_fork(App $a, array &$b) } } else { // Comments are never exported when we don't import the GNU Social timeline - if (!strstr($post['postopts'], 'statusnet') || ($post['parent'] != $post['id']) || $post['private']) { + if (strpos($post['postopts'] ?? '', 'statusnet') === false || ($post['parent'] != $post['id']) || $post['private']) { $b['execute'] = false; return; } @@ -762,7 +762,6 @@ function statusnet_fetchtimeline(App $a, int $uid) $osecret = DI::pConfig()->get($uid, 'statusnet', 'oauthsecret'); $lastid = DI::pConfig()->get($uid, 'statusnet', 'lastid'); - require_once 'mod/item.php'; // get the application name for the SN app // 1st try personal config, then system config and fallback to the // hostname of the node if neither one is set. @@ -819,46 +818,33 @@ function statusnet_fetchtimeline(App $a, int $uid) } if (!stristr($post->source, $application_name)) { - $_SESSION['authenticated'] = true; - $_SESSION['uid'] = $uid; - - unset($_REQUEST); - $_REQUEST['api_source'] = true; - $_REQUEST['profile_uid'] = $uid; - //$_REQUEST['source'] = 'StatusNet'; - $_REQUEST['source'] = $post->source; - $_REQUEST['extid'] = Protocol::STATUSNET; - - if (isset($post->id)) { - $_REQUEST['message_id'] = Item::newURI(Protocol::STATUSNET . ':' . $post->id); - } - - //$_REQUEST['date'] = $post->created_at; + $postarray['uid'] = $uid; + $postarray['app'] = $post->source; + $postarray['extid'] = Protocol::STATUSNET; - $_REQUEST['title'] = ''; + $postarray['title'] = ''; - $_REQUEST['body'] = $post->text; + $postarray['body'] = $post->text; if (is_string($post->place->name)) { - $_REQUEST['location'] = $post->place->name; + $postarray['location'] = $post->place->name; } if (is_string($post->place->full_name)) { - $_REQUEST['location'] = $post->place->full_name; + $postarray['location'] = $post->place->full_name; } if (is_array($post->geo->coordinates)) { - $_REQUEST['coord'] = $post->geo->coordinates[0] . ' ' . $post->geo->coordinates[1]; + $postarray['coord'] = $post->geo->coordinates[0] . ' ' . $post->geo->coordinates[1]; } if (is_array($post->coordinates->coordinates)) { - $_REQUEST['coord'] = $post->coordinates->coordinates[1] . ' ' . $post->coordinates->coordinates[0]; + $postarray['coord'] = $post->coordinates->coordinates[1] . ' ' . $post->coordinates->coordinates[0]; } - //print_r($_REQUEST); - if ($_REQUEST['body'] != '') { + if ($postarray['body'] != '') { Logger::notice('statusnet: posting for user ' . $uid); - item_post($a); + Item::insert($postarray, true); } } }