// Detect the directory type
$serverdata['directory-type'] = self::DT_NONE;
- $serverdata = self::checkPoCo($url, $serverdata);
+
$serverdata = self::checkMastodonDirectory($url, $serverdata);
+ if ($serverdata['directory-type'] == self::DT_NONE) {
+ $serverdata = self::checkPoCo($url, $serverdata);
+ }
+
// We can't detect the network type. Possibly it is some system that we don't know yet
if (empty($serverdata['network'])) {
$serverdata['network'] = Protocol::PHANTOM;
$contact = Contact::selectFirst(['id'], ['uid' => 0, 'failed' => false, 'gsid' => $gserver['id']]);
// Via probing we can be sure that the server is responding
- if (Contact::updateFromProbe($contact['id'])) {
+ if (!empty($contact['id']) && Contact::updateFromProbe($contact['id'])) {
$contact = Contact::selectFirst(['network', 'failed'], ['id' => $contact['id']]);
if (!$contact['failed'] && in_array($contact['network'], Protocol::FEDERATED)) {
$serverdata['network'] = $contact['network'];
$posts = Post\Collection::selectToArrayForContact($pcid, Post\Collection::FEATURED);
if (!empty($posts)) {
$old_featured = array_column($posts, 'uri-id');
+ } else {
+ $old_featured = [];
}
$featured = ActivityPub::fetchItems($apcontact['featured']);
'author-id' => $author,
'owner-id' => $author,
'body' => $post,
- 'allow_cid' => $owner['allow_cid'],
- 'allow_gid' => $owner['allow_gid'],
- 'deny_cid' => $owner['deny_cid'],
- 'deny_gid' => $owner['deny_gid'],
+ 'allow_cid' => $owner['allow_cid'] ?? '',
+ 'allow_gid' => $owner['allow_gid']?? '',
+ 'deny_cid' => $owner['deny_cid'] ?? '',
+ 'deny_gid' => $owner['deny_gid'] ?? '',
];
if (!empty($item['allow_cid'] . $item['allow_gid'] . $item['deny_cid'] . $item['deny_gid'])) {