mirror of
https://github.com/friendica/friendica
synced 2025-04-26 15:50:10 +00:00
Merge remote-tracking branch 'upstream/2023.03-rc' into npf2
This commit is contained in:
commit
58a4469f25
39 changed files with 587 additions and 316 deletions
|
@ -3504,16 +3504,17 @@ class Contact
|
|||
/**
|
||||
* Search contact table by nick or name
|
||||
*
|
||||
* @param string $search Name or nick
|
||||
* @param string $mode Search mode (e.g. "community")
|
||||
* @param int $uid User ID
|
||||
* @param int $limit Maximum amount of returned values
|
||||
* @param int $offset Limit offset
|
||||
* @param string $search Name or nick
|
||||
* @param string $mode Search mode (e.g. "community")
|
||||
* @param bool $show_blocked Show users from blocked servers. Default is false
|
||||
* @param int $uid User ID
|
||||
* @param int $limit Maximum amount of returned values
|
||||
* @param int $offset Limit offset
|
||||
*
|
||||
* @return array with search results
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public static function searchByName(string $search, string $mode = '', int $uid = 0, int $limit = 0, int $offset = 0): array
|
||||
public static function searchByName(string $search, string $mode = '', bool $show_blocked = false, int $uid = 0, int $limit = 0, int $offset = 0): array
|
||||
{
|
||||
if (empty($search)) {
|
||||
return [];
|
||||
|
@ -3529,7 +3530,18 @@ class Contact
|
|||
$networks[] = Protocol::OSTATUS;
|
||||
}
|
||||
|
||||
$condition = ['network' => $networks, 'failed' => false, 'deleted' => false, 'uid' => $uid];
|
||||
$condition = [
|
||||
'network' => $networks,
|
||||
'server-failed' => false,
|
||||
'failed' => false,
|
||||
'deleted' => false,
|
||||
'unsearchable' => false,
|
||||
'uid' => $uid
|
||||
];
|
||||
|
||||
if (!$show_blocked) {
|
||||
$condition['server-blocked'] = true;
|
||||
}
|
||||
|
||||
if ($uid == 0) {
|
||||
$condition['blocked'] = false;
|
||||
|
@ -3553,10 +3565,9 @@ class Contact
|
|||
}
|
||||
|
||||
$condition = DBA::mergeConditions($condition,
|
||||
["(NOT `unsearchable` OR `nurl` IN (SELECT `nurl` FROM `owner-view` WHERE `publish` OR `net-publish`))
|
||||
AND (`addr` LIKE ? OR `name` LIKE ? OR `nick` LIKE ?)", $search, $search, $search]);
|
||||
["(`addr` LIKE ? OR `name` LIKE ? OR `nick` LIKE ?)", $search, $search, $search]);
|
||||
|
||||
return self::selectToArray([], $condition, $params);
|
||||
return DBA::selectToArray('account-user-view', [], $condition, $params);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -795,14 +795,16 @@ class Profile
|
|||
$visitor = Contact::getById($cid);
|
||||
|
||||
// Authenticate the visitor.
|
||||
$_SESSION['authenticated'] = 1;
|
||||
$_SESSION['visitor_id'] = $visitor['id'];
|
||||
$_SESSION['visitor_handle'] = $visitor['addr'];
|
||||
$_SESSION['visitor_home'] = $visitor['url'];
|
||||
$_SESSION['my_url'] = $visitor['url'];
|
||||
$_SESSION['remote_comment'] = $visitor['subscribe'];
|
||||
DI::userSession()->setMultiple([
|
||||
'authenticated' => 1,
|
||||
'visitor_id' => $visitor['id'],
|
||||
'visitor_handle' => $visitor['addr'],
|
||||
'visitor_home' => $visitor['url'],
|
||||
'my_url' => $visitor['url'],
|
||||
'remote_comment' => $visitor['subscribe'],
|
||||
]);
|
||||
|
||||
DI::userSession()->setVisitorsContacts();
|
||||
DI::userSession()->setVisitorsContacts($visitor['url']);
|
||||
|
||||
$a->setContactId($visitor['id']);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue