- $condition = ['rel' => [Contact::FOLLOWER, Contact::FRIEND], 'network' => Protocol::FEDERATED, 'uid' => $owner['uid'],
- 'self' => false, 'deleted' => false, 'hidden' => false, 'archive' => false, 'pending' => false];
- $count = DBA::count('contact', $condition);
-
- $data = ['@context' => ActivityPub::CONTEXT];
- $data['id'] = DI::baseUrl() . '/followers/' . $owner['nickname'];
- $data['type'] = 'OrderedCollection';
- $data['totalItems'] = $count;
-
- // When we hide our friends we will only show the pure number but don't allow more.
- $profile = Profile::getByUID($owner['uid']);
- if (!empty($profile['hide-friends'])) {
- return $data;
- }
-
- if (empty($page)) {
- $data['first'] = DI::baseUrl() . '/followers/' . $owner['nickname'] . '?page=1';
- } else {
- $data['type'] = 'OrderedCollectionPage';
- $list = [];
-
- $contacts = DBA::select('contact', ['url'], $condition, ['limit' => [($page - 1) * 100, 100]]);
- while ($contact = DBA::fetch($contacts)) {
- $list[] = $contact['url'];
- }
- DBA::close($contacts);
-
- if (!empty($list)) {
- $data['next'] = DI::baseUrl() . '/followers/' . $owner['nickname'] . '?page=' . ($page + 1);
- }
-
- $data['partOf'] = DI::baseUrl() . '/followers/' . $owner['nickname'];