App->contact is now removed

This commit is contained in:
Michael 2021-07-24 11:49:11 +00:00
parent f60d60e997
commit 30aad250df
16 changed files with 65 additions and 54 deletions

View file

@ -2685,7 +2685,7 @@ class Item
continue;
}
if ((local_user() == $item['uid']) && ($item['private'] == self::PRIVATE) && ($item['contact-id'] != $app->contact['id']) && ($item['network'] == Protocol::DFRN)) {
if ((local_user() == $item['uid']) && ($item['private'] == self::PRIVATE) && ($item['contact-id'] != $app->contact_id) && ($item['network'] == Protocol::DFRN)) {
$img_url = 'redir/' . $item['contact-id'] . '?url=' . urlencode($mtch[1]);
$item['body'] = str_replace($mtch[0], '[img]' . $img_url . '[/img]', $item['body']);
}

View file

@ -768,7 +768,7 @@ class Profile
Session::setVisitorsContacts();
$a->contact = $visitor;
$a->contact_id = $visitor['id'];
Logger::info('Authenticated visitor', ['url' => $visitor['url']]);
@ -829,7 +829,7 @@ class Profile
*/
Hook::callAll('magic_auth_success', $arr);
$a->contact = $arr['visitor'];
$a->contact_id = $arr['visitor']['id'];
info(DI::l10n()->t('OpenWebAuth: %1$s welcomes %2$s', DI::baseUrl()->getHostname(), $visitor['name']));

View file

@ -1569,6 +1569,38 @@ class User
return $identities;
}
/**
* Check if the given user id has delegations or is delegated
*
* @param int $uid
* @return bool
*/
public static function hasIdentities(int $uid):bool
{
if (empty($uid)) {
return false;
}
$user = DBA::selectFirst('user', ['parent-uid'], ['uid' => $uid, 'account_removed' => false]);
if (!DBA::isResult($user)) {
return false;
}
if ($user['parent-uid'] != 0) {
return true;
}
if (DBA::exists('user', ['parent-uid' => $uid, 'account_removed' => false])) {
return true;
}
if (DBA::exists('manage', ['muid' => $uid])) {
return true;
}
return false;
}
/**
* Returns statistical information about the current users of this node
*