mirror of
https://github.com/friendica/friendica
synced 2025-04-26 04:30:11 +00:00
normalise_link calls
implement normaliseLink function
This commit is contained in:
parent
5276c28a78
commit
ffc406d819
54 changed files with 248 additions and 222 deletions
|
@ -348,7 +348,7 @@ class Probe
|
|||
}
|
||||
|
||||
if (x($data, "photo")) {
|
||||
$data["baseurl"] = Network::getUrlMatch(normalise_link(defaults($data, "baseurl", "")), normalise_link($data["photo"]));
|
||||
$data["baseurl"] = Network::getUrlMatch(Strings::normaliseLink(defaults($data, "baseurl", "")), Strings::normaliseLink($data["photo"]));
|
||||
} else {
|
||||
$data["photo"] = System::baseUrl().'/images/person-300.jpg';
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ class Probe
|
|||
|
||||
$fields['updated'] = DateTimeFormat::utcNow();
|
||||
|
||||
$condition = ['nurl' => normalise_link($data["url"])];
|
||||
$condition = ['nurl' => Strings::normaliseLink($data["url"])];
|
||||
|
||||
$old_fields = DBA::selectFirst('gcontact', $fieldnames, $condition);
|
||||
|
||||
|
@ -474,7 +474,7 @@ class Probe
|
|||
}
|
||||
}
|
||||
|
||||
$condition = ['nurl' => normalise_link($data["url"]), 'self' => false, 'uid' => 0];
|
||||
$condition = ['nurl' => Strings::normaliseLink($data["url"]), 'self' => false, 'uid' => 0];
|
||||
|
||||
// "$old_fields" will return a "false" when the contact doesn't exist.
|
||||
// This won't trigger an insert. This is intended, since we only need
|
||||
|
@ -1010,7 +1010,7 @@ class Probe
|
|||
foreach ($webfinger["aliases"] as $alias) {
|
||||
if (empty($data["url"]) && !strstr($alias, "@")) {
|
||||
$data["url"] = $alias;
|
||||
} elseif (!strstr($alias, "@") && normalise_link($alias) != normalise_link($data["url"])) {
|
||||
} elseif (!strstr($alias, "@") && Strings::normaliseLink($alias) != Strings::normaliseLink($data["url"])) {
|
||||
$data["alias"] = $alias;
|
||||
} elseif (substr($alias, 0, 5) == 'acct:') {
|
||||
$data["addr"] = substr($alias, 5);
|
||||
|
@ -1213,7 +1213,7 @@ class Probe
|
|||
|
||||
if (!empty($webfinger["aliases"]) && is_array($webfinger["aliases"])) {
|
||||
foreach ($webfinger["aliases"] as $alias) {
|
||||
if (normalise_link($alias) != normalise_link($data["url"]) && ! strstr($alias, "@")) {
|
||||
if (Strings::normaliseLink($alias) != Strings::normaliseLink($data["url"]) && ! strstr($alias, "@")) {
|
||||
$data["alias"] = $alias;
|
||||
} elseif (substr($alias, 0, 5) == 'acct:') {
|
||||
$data["addr"] = substr($alias, 5);
|
||||
|
@ -1269,14 +1269,14 @@ class Probe
|
|||
|
||||
if (!empty($webfinger["aliases"]) && is_array($webfinger["aliases"])) {
|
||||
foreach ($webfinger["aliases"] as $alias) {
|
||||
if (strstr($alias, "@") && !strstr(normalise_link($alias), "http://")) {
|
||||
if (strstr($alias, "@") && !strstr(Strings::normaliseLink($alias), "http://")) {
|
||||
$data["addr"] = str_replace('acct:', '', $alias);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($webfinger["subject"]) && strstr($webfinger["subject"], "@")
|
||||
&& !strstr(normalise_link($webfinger["subject"]), "http://")
|
||||
&& !strstr(Strings::normaliseLink($webfinger["subject"]), "http://")
|
||||
) {
|
||||
$data["addr"] = str_replace('acct:', '', $webfinger["subject"]);
|
||||
}
|
||||
|
@ -1302,7 +1302,7 @@ class Probe
|
|||
} else {
|
||||
$pubkey = substr($pubkey, 5);
|
||||
}
|
||||
} elseif (normalise_link($pubkey) == 'http://') {
|
||||
} elseif (Strings::normaliseLink($pubkey) == 'http://') {
|
||||
$curlResult = Network::curl($pubkey);
|
||||
if ($curlResult->isTimeout()) {
|
||||
return false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue