'pending' => false,
'blocked' => false,
];
- $condition = DBA::buildCondition($parameters);
- $sql = "SELECT COUNT(*) as `count`
- FROM `contact`
- JOIN `apcontact` ON `apcontact`.`url` = `contact`.`url`
- " . $condition;
+ $condition = DBA::mergeConditions($parameters, ["`url` IN (SELECT `url` FROM `apcontact`)"]);
- $contacts = DBA::fetchFirst($sql, ...$parameters);
+ $total = DBA::count('contact', $condition);
$modulePath = '/' . $module . '/';
$data = ['@context' => ActivityPub::CONTEXT];
$data['id'] = DI::baseUrl() . $modulePath . $owner['nickname'];
$data['type'] = 'OrderedCollection';
- $data['totalItems'] = $contacts['count'];
+ $data['totalItems'] = $total;
// When we hide our friends we will only show the pure number but don't allow more.
$profile = Profile::getByUID($owner['uid']);
$data['type'] = 'OrderedCollectionPage';
$list = [];
- $sql = "SELECT `contact`.`url`
- FROM `contact`
- JOIN `apcontact` ON `apcontact`.`url` = `contact`.`url`
- " . $condition . "
- LIMIT ?, ?";
-
- $parameters[] = ($page - 1) * 100;
- $parameters[] = 100;
-
- $contacts = DBA::p($sql, ...$parameters);
+ $contacts = DBA::select('contact', ['url'], $condition, ['limit' => [($page - 1) * 100, 100]]);
while ($contact = DBA::fetch($contacts)) {
$list[] = $contact['url'];
}
$permissionSets = DI::permissionSet()->selectByContactId($requester_id, $owner['uid']);
if (!empty($permissionSets)) {
$condition = ['psid' => array_merge($permissionSets->column('id'),
- [DI::permissionSet()->getIdFromACL($owner['uid'], '', '', '', '')])];
+ [DI::permissionSet()->selectEmptyForUser($owner['uid'])])];
}
}
}