- $wildcard = Strings::escapeHtml('%' . $search . '%');
-
- $condition = [
- 'NOT `unsearchable`
- AND `network` IN (?, ?, ?, ?)
- AND NOT `failed` AND `uid` = ?
- AND (`url` LIKE ? OR `name` LIKE ? OR `location` LIKE ?
- OR `addr` LIKE ? OR `about` LIKE ? OR `keywords` LIKE ?)
- AND `forum` = ?',
- Protocol::ACTIVITYPUB, Protocol::DFRN, $ostatus, $diaspora, 0,
- $wildcard, $wildcard, $wildcard,
- $wildcard, $wildcard, $wildcard,
- ($type === self::TYPE_FORUM),
- ];
-
- $count = DBA::count('contact', $condition);
-
- $resultList = new ResultList($start, $itemPage, $count);
-
- if (empty($count)) {
- return $resultList;
- }
-
- $data = DBA::select('contact', [], $condition, [
- 'group_by' => ['nurl', 'updated'],
- 'limit' => [$start, $itemPage],
- 'order' => ['updated' => 'DESC']
- ]);
-
- if (!DBA::isResult($data)) {
- return $resultList;
- }
-
- while ($contact = DBA::fetch($data)) {