From 5530b6fc75cb947b13fb54b6c42e9f369e6676b4 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 5 Nov 2022 19:48:51 +0100 Subject: [PATCH] reviews --- src/Worker/CheckRelMeProfileLink.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Worker/CheckRelMeProfileLink.php b/src/Worker/CheckRelMeProfileLink.php index f1ab25e231..8e6f95a4ad 100644 --- a/src/Worker/CheckRelMeProfileLink.php +++ b/src/Worker/CheckRelMeProfileLink.php @@ -28,6 +28,7 @@ use Friendica\Model\Profile; use Friendica\Model\User; use Friendica\Network\HTTPClient\Client\HttpClientAccept; use Friendica\Network\HTTPClient\Client\HttpClientOptions; +use Friendica\Util\Network; use Friendica\Util\Strings; /* This class is used to verify the homepage link of a user profile. @@ -74,27 +75,26 @@ class CheckRelMeProfileLink } else { foreach ($doc->getElementsByTagName('a') as $link) { $rel = $link->getAttribute('rel'); - if ($rel=='me') { + if ($rel == 'me') { $href = $link->getAttribute('href'); - if (strpos($href, 'http')!==false) { - if (!$homepageUrlVerified) { - $homepageUrlVerified = Strings::compareLink($owner['url'], $href); - } + if (strpos($href, 'http')!==false && !$homepageUrlVerified && Network::isUrlValid($href)) { + $homepageUrlVerified = Strings::compareLink($owner['url'], $href); } } } } if ($homepageUrlVerified) { - Profile::update(['homepage_verified' => 1], $uid); + Profile::update(['homepage_verified' => true], $uid); Logger::notice('Homepage URL verified', [$uid, $owner['homepage']]); } else { - Profile::update(['homepage_verified' => 0], $uid); + Profile::update(['homepage_verified' => false], $uid); Logger::notice('Homepage URL could not be verified', [$uid, $owner['homepage']]); } } } } else { Logger::notice('The user has no homepage link.', [$uid]); + Profile::update(['homepage_verified' => false], $uid); } } } -- 2.39.5