mirror of
https://github.com/friendica/friendica
synced 2025-04-27 03:50:11 +00:00
Use "User::getIdForURL"
This commit is contained in:
parent
f1a8db4e76
commit
5aba1df497
2 changed files with 27 additions and 18 deletions
|
@ -162,14 +162,24 @@ class User
|
|||
* @return integer user id
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function getIdForURL($url)
|
||||
public static function getIdForURL(string $url)
|
||||
{
|
||||
$self = DBA::selectFirst('contact', ['uid'], ['nurl' => Strings::normaliseLink($url), 'self' => true]);
|
||||
if (!DBA::isResult($self)) {
|
||||
return false;
|
||||
} else {
|
||||
$self = Contact::selectFirst(['uid'], ['self' => true, 'nurl' => Strings::normaliseLink($url)]);
|
||||
if (!empty($self['uid'])) {
|
||||
return $self['uid'];
|
||||
}
|
||||
|
||||
$self = Contact::selectFirst(['uid'], ['self' => true, 'addr' => $url]);
|
||||
if (!empty($self['uid'])) {
|
||||
return $self['uid'];
|
||||
}
|
||||
|
||||
$self = Contact::selectFirst(['uid'], ['self' => true, 'alias' => [$url, Strings::normaliseLink($url)]]);
|
||||
if (!empty($self['uid'])) {
|
||||
return $self['uid'];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue