From 30b9a57a37ff0ed9b48dc1212680fd35185a99c6 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 5 Nov 2022 09:59:12 +0100 Subject: [PATCH 01/21] Let the Worker check the homepage of a profile daily --- src/Worker/Cron.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index 21d2f8a20..cd155dbbb 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -27,6 +27,7 @@ use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Tag; +use Friendica\Model\User; use Friendica\Protocol\ActivityPub\Queue; use Friendica\Protocol\Relay; @@ -85,6 +86,7 @@ class Cron // Hourly cron calls if (DI::config()->get('system', 'last_cron_hourly', 0) + 3600 < time()) { + // Update trending tags cache for the community page Tag::setLocalTrendingHashtags(24, 20); Tag::setGlobalTrendingHashtags(24, 20); @@ -132,6 +134,10 @@ class Cron Worker::add(Worker::PRIORITY_LOW, 'OptimizeTables'); } + foreach (User::getList($start=1, $limit=PHP_INT_MAX, $type='active') as $user) { + Worker::add(Worker::PRIORITY_LOW, 'CheckRelMeProfileLink', $user['uid']); + } + // Resubscribe to relay servers Relay::reSubscribe(); From c8636db9f6c784a6d95d8c27bbd712ca03af07c3 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 5 Nov 2022 10:00:22 +0100 Subject: [PATCH 02/21] When the profile is updated, let the Worker verify the homepage link --- src/Module/Settings/Profile/Index.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Module/Settings/Profile/Index.php b/src/Module/Settings/Profile/Index.php index 14fe613c1..5c6f753ce 100644 --- a/src/Module/Settings/Profile/Index.php +++ b/src/Module/Settings/Profile/Index.php @@ -38,6 +38,7 @@ use Friendica\Module\Security\Login; use Friendica\Network\HTTPException; use Friendica\Util\DateTimeFormat; use Friendica\Util\Temporal; +use Friendica\Core\Worker; class Index extends BaseSettings { @@ -127,6 +128,8 @@ class Index extends BaseSettings DI::userSession()->getLocalUserId() ); + Worker::add(Worker::PRIORITY_MEDIUM, 'CheckRelMeProfileLink', DI::userSession()->getLocalUserId()); + if (!$result) { DI::sysmsg()->addNotice(DI::l10n()->t('Profile couldn\'t be updated.')); return; From 0104930fb37933759f5eced266771aaa32687771 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 5 Nov 2022 15:34:50 +0100 Subject: [PATCH 03/21] add homepage help text to the templates --- view/templates/settings/profile/index.tpl | 1 + view/theme/vier/templates/settings/profile/index.tpl | 1 + 2 files changed, 2 insertions(+) diff --git a/view/templates/settings/profile/index.tpl b/view/templates/settings/profile/index.tpl index d888e0910..69812c5a8 100644 --- a/view/templates/settings/profile/index.tpl +++ b/view/templates/settings/profile/index.tpl @@ -73,6 +73,7 @@ +
{{$homepage.3}}
diff --git a/view/theme/vier/templates/settings/profile/index.tpl b/view/theme/vier/templates/settings/profile/index.tpl index 842b6aaef..f52de3703 100644 --- a/view/theme/vier/templates/settings/profile/index.tpl +++ b/view/theme/vier/templates/settings/profile/index.tpl @@ -78,6 +78,7 @@
+
{{$homepage.3}}
From 028d823d962070f0325181184c7df3b92c3a5d3f Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 5 Nov 2022 15:35:53 +0100 Subject: [PATCH 04/21] add a help text to the profile settings indicating how to verify the homepage, or that the homepage is verified --- src/Module/Settings/Profile/Index.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Module/Settings/Profile/Index.php b/src/Module/Settings/Profile/Index.php index 5c6f753ce..52f61efd4 100644 --- a/src/Module/Settings/Profile/Index.php +++ b/src/Module/Settings/Profile/Index.php @@ -213,6 +213,12 @@ class Index extends BaseSettings $personal_account = ($profile['account-type'] != User::ACCOUNT_TYPE_COMMUNITY); + if ($profile['homepage_verified']) { + $homepage_help_text = DI::l10n()->t('The homepage is verified. A rel="me" link back to your Friendica profile page was found on the homepage.'); + } else { + $homepage_help_text = DI::l10n()->t('To verify your homepage, add a rel="me" link to it, pointing to your profile URL (%s).', $profile['url']); + } + $tpl = Renderer::getMarkupTemplate('settings/profile/index.tpl'); $o .= Renderer::replaceMacros($tpl, [ '$personal_account' => $personal_account, @@ -248,7 +254,7 @@ class Index extends BaseSettings '$age' => ((intval($profile['dob'])) ? '(' . DI::l10n()->t('Age: ') . DI::l10n()->tt('%d year old', '%d years old', Temporal::getAgeByTimezone($profile['dob'], $profile['timezone'])) . ')' : ''), '$xmpp' => ['xmpp', DI::l10n()->t('XMPP (Jabber) address:'), $profile['xmpp'], DI::l10n()->t('The XMPP address will be published so that people can follow you there.')], '$matrix' => ['matrix', DI::l10n()->t('Matrix (Element) address:'), $profile['matrix'], DI::l10n()->t('The Matrix address will be published so that people can follow you there.')], - '$homepage' => ['homepage', DI::l10n()->t('Homepage URL:'), $profile['homepage']], + '$homepage' => ['homepage', DI::l10n()->t('Homepage URL:'), $profile['homepage'], $homepage_help_text], '$pub_keywords' => ['pub_keywords', DI::l10n()->t('Public Keywords:'), $profile['pub_keywords'], DI::l10n()->t('(Used for suggesting potential friends, can be seen by others)')], '$prv_keywords' => ['prv_keywords', DI::l10n()->t('Private Keywords:'), $profile['prv_keywords'], DI::l10n()->t('(Used for searching profiles, never shown to others)')], '$custom_fields_description' => DI::l10n()->t("

Custom fields appear on your profile page.

From a98d3213767392dcce399188f65b5f976caf98e6 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 5 Nov 2022 15:37:13 +0100 Subject: [PATCH 05/21] add the homepage_verified field to the profile table and the owner-view --- database.sql | 4 +- doc/database/db_profile.md | 91 ++++++++++++++++++----------------- static/dbstructure.config.php | 3 +- static/dbview.config.php | 1 + 4 files changed, 52 insertions(+), 47 deletions(-) diff --git a/database.sql b/database.sql index ab8c300a8..891b830a4 100644 --- a/database.sql +++ b/database.sql @@ -1,6 +1,6 @@ -- ------------------------------------------ -- Friendica 2022.12-dev (Giant Rhubarb) --- DB_UPDATE_VERSION 1486 +-- DB_UPDATE_VERSION 1487 -- ------------------------------------------ @@ -1577,6 +1577,7 @@ CREATE TABLE IF NOT EXISTS `profile` ( `education` text COMMENT 'Deprecated', `contact` text COMMENT 'Deprecated', `homepage` varchar(255) NOT NULL DEFAULT '' COMMENT '', + `homepage_verified` boolean NOT NULL DEFAULT '0' COMMENT 'was the homepage verified by a rel-me link back to the profile', `xmpp` varchar(255) NOT NULL DEFAULT '' COMMENT 'XMPP address', `matrix` varchar(255) NOT NULL DEFAULT '' COMMENT 'Matrix address', `photo` varbinary(383) NOT NULL DEFAULT '' COMMENT '', @@ -2674,6 +2675,7 @@ CREATE VIEW `owner-view` AS SELECT `profile`.`postal-code` AS `postal-code`, `profile`.`country-name` AS `country-name`, `profile`.`homepage` AS `homepage`, + `profile`.`homepage_verified` AS `homepage_verified`, `profile`.`dob` AS `dob` FROM `user` INNER JOIN `contact` ON `contact`.`uid` = `user`.`uid` AND `contact`.`self` diff --git a/doc/database/db_profile.md b/doc/database/db_profile.md index c180332c5..ec47b94ec 100644 --- a/doc/database/db_profile.md +++ b/doc/database/db_profile.md @@ -6,51 +6,52 @@ user profiles data Fields ------ -| Field | Description | Type | Null | Key | Default | Extra | -| ------------ | --------------------------------------------- | ------------------ | ---- | --- | ---------- | -------------- | -| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment | -| uid | Owner User id | mediumint unsigned | NO | | 0 | | -| profile-name | Deprecated | varchar(255) | YES | | NULL | | -| is-default | Deprecated | boolean | YES | | NULL | | -| hide-friends | Hide friend list from viewers of this profile | boolean | NO | | 0 | | -| name | | varchar(255) | NO | | | | -| pdesc | Deprecated | varchar(255) | YES | | NULL | | -| dob | Day of birth | varchar(32) | NO | | 0000-00-00 | | -| address | | varchar(255) | NO | | | | -| locality | | varchar(255) | NO | | | | -| region | | varchar(255) | NO | | | | -| postal-code | | varchar(32) | NO | | | | -| country-name | | varchar(255) | NO | | | | -| hometown | Deprecated | varchar(255) | YES | | NULL | | -| gender | Deprecated | varchar(32) | YES | | NULL | | -| marital | Deprecated | varchar(255) | YES | | NULL | | -| with | Deprecated | text | YES | | NULL | | -| howlong | Deprecated | datetime | YES | | NULL | | -| sexual | Deprecated | varchar(255) | YES | | NULL | | -| politic | Deprecated | varchar(255) | YES | | NULL | | -| religion | Deprecated | varchar(255) | YES | | NULL | | -| pub_keywords | | text | YES | | NULL | | -| prv_keywords | | text | YES | | NULL | | -| likes | Deprecated | text | YES | | NULL | | -| dislikes | Deprecated | text | YES | | NULL | | -| about | Profile description | text | YES | | NULL | | -| summary | Deprecated | varchar(255) | YES | | NULL | | -| music | Deprecated | text | YES | | NULL | | -| book | Deprecated | text | YES | | NULL | | -| tv | Deprecated | text | YES | | NULL | | -| film | Deprecated | text | YES | | NULL | | -| interest | Deprecated | text | YES | | NULL | | -| romance | Deprecated | text | YES | | NULL | | -| work | Deprecated | text | YES | | NULL | | -| education | Deprecated | text | YES | | NULL | | -| contact | Deprecated | text | YES | | NULL | | -| homepage | | varchar(255) | NO | | | | -| xmpp | XMPP address | varchar(255) | NO | | | | -| matrix | Matrix address | varchar(255) | NO | | | | -| photo | | varbinary(383) | NO | | | | -| thumb | | varbinary(383) | NO | | | | -| publish | publish default profile in local directory | boolean | NO | | 0 | | -| net-publish | publish profile in global directory | boolean | NO | | 0 | | +| Field | Description | Type | Null | Key | Default | Extra | +| ----------------- | -------------------------------------------------------------- | ------------------ | ---- | --- | ---------- | -------------- | +| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment | +| uid | Owner User id | mediumint unsigned | NO | | 0 | | +| profile-name | Deprecated | varchar(255) | YES | | NULL | | +| is-default | Deprecated | boolean | YES | | NULL | | +| hide-friends | Hide friend list from viewers of this profile | boolean | NO | | 0 | | +| name | | varchar(255) | NO | | | | +| pdesc | Deprecated | varchar(255) | YES | | NULL | | +| dob | Day of birth | varchar(32) | NO | | 0000-00-00 | | +| address | | varchar(255) | NO | | | | +| locality | | varchar(255) | NO | | | | +| region | | varchar(255) | NO | | | | +| postal-code | | varchar(32) | NO | | | | +| country-name | | varchar(255) | NO | | | | +| hometown | Deprecated | varchar(255) | YES | | NULL | | +| gender | Deprecated | varchar(32) | YES | | NULL | | +| marital | Deprecated | varchar(255) | YES | | NULL | | +| with | Deprecated | text | YES | | NULL | | +| howlong | Deprecated | datetime | YES | | NULL | | +| sexual | Deprecated | varchar(255) | YES | | NULL | | +| politic | Deprecated | varchar(255) | YES | | NULL | | +| religion | Deprecated | varchar(255) | YES | | NULL | | +| pub_keywords | | text | YES | | NULL | | +| prv_keywords | | text | YES | | NULL | | +| likes | Deprecated | text | YES | | NULL | | +| dislikes | Deprecated | text | YES | | NULL | | +| about | Profile description | text | YES | | NULL | | +| summary | Deprecated | varchar(255) | YES | | NULL | | +| music | Deprecated | text | YES | | NULL | | +| book | Deprecated | text | YES | | NULL | | +| tv | Deprecated | text | YES | | NULL | | +| film | Deprecated | text | YES | | NULL | | +| interest | Deprecated | text | YES | | NULL | | +| romance | Deprecated | text | YES | | NULL | | +| work | Deprecated | text | YES | | NULL | | +| education | Deprecated | text | YES | | NULL | | +| contact | Deprecated | text | YES | | NULL | | +| homepage | | varchar(255) | NO | | | | +| homepage_verified | was the homepage verified by a rel-me link back to the profile | boolean | NO | | 0 | | +| xmpp | XMPP address | varchar(255) | NO | | | | +| matrix | Matrix address | varchar(255) | NO | | | | +| photo | | varbinary(383) | NO | | | | +| thumb | | varbinary(383) | NO | | | | +| publish | publish default profile in local directory | boolean | NO | | 0 | | +| net-publish | publish profile in global directory | boolean | NO | | 0 | | Indexes ------------ diff --git a/static/dbstructure.config.php b/static/dbstructure.config.php index 262d7d307..79b1539f8 100644 --- a/static/dbstructure.config.php +++ b/static/dbstructure.config.php @@ -55,7 +55,7 @@ use Friendica\Database\DBA; if (!defined('DB_UPDATE_VERSION')) { - define('DB_UPDATE_VERSION', 1486); + define('DB_UPDATE_VERSION', 1487); } return [ @@ -1580,6 +1580,7 @@ return [ "education" => ["type" => "text", "comment" => "Deprecated"], "contact" => ["type" => "text", "comment" => "Deprecated"], "homepage" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""], + "homepage_verified" => ["type" => "boolean", "not null" => 1, "default" => "0", "comment" => "was the homepage verified by a rel-me link back to the profile"], "xmpp" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "XMPP address"], "matrix" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "Matrix address"], "photo" => ["type" => "varbinary(383)", "not null" => "1", "default" => "", "comment" => ""], diff --git a/static/dbview.config.php b/static/dbview.config.php index c12cccb4c..925f82462 100644 --- a/static/dbview.config.php +++ b/static/dbview.config.php @@ -919,6 +919,7 @@ "postal-code" => ["profile", "postal-code"], "country-name" => ["profile", "country-name"], "homepage" => ["profile", "homepage"], + "homepage_verified" => ["profile", "homepage_verified"], "dob" => ["profile", "dob"], ], "query" => "FROM `user` From a1d57abfe45d832aa36f9615eea35c6900c6f5b8 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 5 Nov 2022 15:38:28 +0100 Subject: [PATCH 06/21] add the new CheckRelMeProfileLink class to the worker --- src/Worker/CheckRelMeProfileLink.php | 102 +++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 src/Worker/CheckRelMeProfileLink.php diff --git a/src/Worker/CheckRelMeProfileLink.php b/src/Worker/CheckRelMeProfileLink.php new file mode 100644 index 000000000..691931bdc --- /dev/null +++ b/src/Worker/CheckRelMeProfileLink.php @@ -0,0 +1,102 @@ +. + * + */ + +namespace Friendica\Worker; + +use DOMDocument; +use Friendica\DI; +use Friendica\Database\DBA; +use Friendica\Core\Logger; +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. + * To do so, we look for rel="me" links in the given homepage, if one + * of them points to the Friendica profile of the user, a verification + * mark is added to the link. + * + * To reverse the process, if a homepage link is given, it is displayed + * with the rel="me" attribute as well, so that 3rd party tools can + * verify the connection between the two pages. + * + * This task will be performed by the worker on a daily basis _and_ every + * time the user changes their homepage link. In the first case the priority + * of the task is set to LOW, with the second case it is MEDIUM. + * + * rel-me microformat docs https://microformats.org/wiki/rel-me + */ +class CheckRelMeProfileLink +{ + /* Cheks the homepage of a profile for a rel-me link back to the user profile + * + * @param $uid (int) the UID of the user + */ + public static function execute(int $uid) + { + Logger::notice('Verifying the homepage', [$uid]); + $homepageUrlVerified = false; + $owner = User::getOwnerDataById($uid); + Logger::notice(print_r($owner)); + if (!empty($owner['homepage'])) { + $xrd_timeout = DI::config()->get('system', 'xrd_timeout', 20); + $curlResult = DI::httpClient()->get($owner['homepage'], $accept_content = HttpClientAccept::HTML, [HttpClientOptions::TIMEOUT => $xrd_timeout]); + if ($curlResult->isTimeout()) { + Logger::notice('Could not check homepage link of the user because the page loading request timed out.', [$uid, $owner['homepage']]); + } else { + $content = $curlResult->getBody(); + if (!$content) { + Logger::notice('Empty body of the fetched homepage link). Cannot verify the relation to profile of UID %s.', [$uid, $owner['homepage']]); + } else { + $doc = new DOMDocument(); + $doc->loadHTML($content); + if (!$doc) { + Logger::notice('Could not parse the content'); + } else { + foreach ($doc->getElementsByTagName('a') as $link) { + $rel = $link->getAttribute('rel'); + if ($rel=='me') { + $href = $link->getAttribute('href'); + if (strpos($href, 'http')!==false) { + if (!$homepageUrlVerified) { + $homepageUrlVerified = Strings::compareLink($owner['url'], $href); + } + } + } + } + } + if ($homepageUrlVerified) { + Profile::update(['homepage_verified' => 1], $uid); + Logger::notice('Homepage URL verified', [$uid, $owner['homepage']]); + } else { + Profile::update(['homepage_verified' => 0], $uid); + Logger::notice('Homepage URL could not be verified', [$uid, $owner['homepage']]); + } + } + } + } else { + Logger::notice('The user has no homepage link.', [$uid]); + } + } +} From 457c34dd137e4682319a484bd58686e85612a5af Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 5 Nov 2022 16:22:22 +0100 Subject: [PATCH 07/21] add a checkmark to the vcards if the homepage has a rel-me back to the profile --- view/templates/profile/vcard.tpl | 2 +- view/theme/frio/templates/profile/vcard.tpl | 2 +- view/theme/quattro/templates/profile/vcard.tpl | 2 +- view/theme/vier/templates/profile/vcard.tpl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/view/templates/profile/vcard.tpl b/view/templates/profile/vcard.tpl index fed6fb251..a304a9a1f 100644 --- a/view/templates/profile/vcard.tpl +++ b/view/templates/profile/vcard.tpl @@ -39,7 +39,7 @@ {{if $updated}}{{/if}} - {{if $homepage}}
{{$homepage}}
{{$profile.homepage}}
{{/if}} + {{if $homepage}}
{{$homepage}}
{{$profile.homepage}}{{if $profile.homepage_verified}} ✔{{/if}}
{{/if}} {{if $about}}
{{$about}}
{{$profile.about nofilter}}
{{/if}} diff --git a/view/theme/frio/templates/profile/vcard.tpl b/view/theme/frio/templates/profile/vcard.tpl index b208eca88..35e3c8419 100644 --- a/view/theme/frio/templates/profile/vcard.tpl +++ b/view/theme/frio/templates/profile/vcard.tpl @@ -108,7 +108,7 @@ {{if $homepage}} {{/if}} diff --git a/view/theme/quattro/templates/profile/vcard.tpl b/view/theme/quattro/templates/profile/vcard.tpl index e66334dc2..86d4889c8 100644 --- a/view/theme/quattro/templates/profile/vcard.tpl +++ b/view/theme/quattro/templates/profile/vcard.tpl @@ -53,7 +53,7 @@ {{if $homepage}}
{{$homepage}}
-
{{$profile.homepage}}
+
{{$profile.homepage}}{{if $profile.homepage_verified}} ✔{{/if}}
{{/if}} diff --git a/view/theme/vier/templates/profile/vcard.tpl b/view/theme/vier/templates/profile/vcard.tpl index 01e75580d..0a9348015 100644 --- a/view/theme/vier/templates/profile/vcard.tpl +++ b/view/theme/vier/templates/profile/vcard.tpl @@ -45,7 +45,7 @@ {{if $updated}}{{/if}} - {{if $homepage}}
{{$homepage}}
{{$profile.homepage}}
{{/if}} + {{if $homepage}}
{{$homepage}}
{{$profile.homepage}}{{if $profile.homepage_verified}} ✔{{/if}}
{{/if}} {{if $about}}
{{$about}}
{{$profile.about nofilter}}
{{/if}} From be6809ecdd77a0706d55242287789caef227745e Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 5 Nov 2022 16:22:41 +0100 Subject: [PATCH 08/21] updated the messages.po file --- view/lang/C/messages.po | 182 ++++++++++++++++++++++------------------ 1 file changed, 99 insertions(+), 83 deletions(-) diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 1ec18f46b..341c7d4bf 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -1,3 +1,4 @@ + # FRIENDICA Distributed Social Network # Copyright (C) 2010-2022, the Friendica project # This file is distributed under the same license as the Friendica package. @@ -8,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: 2022.12-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-11-05 19:31-0400\n" +"POT-Creation-Date: 2022-11-05 15:53+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -369,7 +370,7 @@ msgid "Event Finishes:" msgstr "" #: mod/events.php:503 src/Module/Profile/Profile.php:171 -#: src/Module/Settings/Profile/Index.php:238 +#: src/Module/Settings/Profile/Index.php:247 msgid "Description:" msgstr "" @@ -401,7 +402,7 @@ msgstr "" #: src/Module/Install.php:252 src/Module/Install.php:294 #: src/Module/Install.php:331 src/Module/Invite.php:178 #: src/Module/Item/Compose.php:189 src/Module/Profile/Profile.php:246 -#: src/Module/Profile/UnkMail.php:156 src/Module/Settings/Profile/Index.php:222 +#: src/Module/Profile/UnkMail.php:156 src/Module/Settings/Profile/Index.php:231 #: src/Object/Post.php:986 view/theme/duepuntozero/config.php:85 #: view/theme/frio/config.php:171 view/theme/quattro/config.php:87 #: view/theme/vier/config.php:135 @@ -2073,7 +2074,7 @@ msgstr "" msgid "show more" msgstr "" -#: src/Content/Item.php:295 src/Model/Item.php:2870 +#: src/Content/Item.php:295 src/Model/Item.php:2875 msgid "event" msgstr "" @@ -2082,7 +2083,7 @@ msgstr "" msgid "status" msgstr "" -#: src/Content/Item.php:304 src/Model/Item.php:2872 +#: src/Content/Item.php:304 src/Model/Item.php:2877 #: src/Module/Post/Tag/Add.php:123 msgid "photo" msgstr "" @@ -2102,7 +2103,7 @@ msgstr "" #: src/Content/Item.php:389 src/Content/Item.php:407 src/Model/Contact.php:1137 #: src/Model/Contact.php:1191 src/Model/Contact.php:1200 -#: src/Module/Directory.php:157 src/Module/Settings/Profile/Index.php:225 +#: src/Module/Directory.php:157 src/Module/Settings/Profile/Index.php:234 msgid "View Profile" msgstr "" @@ -2127,12 +2128,12 @@ msgstr "" #: src/Content/Item.php:394 src/Module/Admin/Blocklist/Contact.php:100 #: src/Module/Admin/Users/Active.php:140 src/Module/Admin/Users/Index.php:154 #: src/Module/Contact.php:401 src/Module/Contact/Profile.php:349 -#: src/Module/Contact/Profile.php:468 +#: src/Module/Contact/Profile.php:450 msgid "Block" msgstr "" #: src/Content/Item.php:395 src/Module/Contact.php:402 -#: src/Module/Contact/Profile.php:350 src/Module/Contact/Profile.php:476 +#: src/Module/Contact/Profile.php:350 src/Module/Contact/Profile.php:458 #: src/Module/Notifications/Introductions.php:134 #: src/Module/Notifications/Introductions.php:206 #: src/Module/Notifications/Notification.php:89 @@ -2441,8 +2442,8 @@ msgid "" "%2$s %3$s" msgstr "" -#: src/Content/Text/BBCode.php:1243 src/Model/Item.php:3471 -#: src/Model/Item.php:3477 src/Model/Item.php:3478 +#: src/Content/Text/BBCode.php:1243 src/Model/Item.php:3476 +#: src/Model/Item.php:3482 src/Model/Item.php:3483 msgid "Link to source" msgstr "" @@ -2458,11 +2459,11 @@ msgstr "" msgid "Encrypted content" msgstr "" -#: src/Content/Text/BBCode.php:2092 +#: src/Content/Text/BBCode.php:2089 msgid "Invalid source protocol" msgstr "" -#: src/Content/Text/BBCode.php:2107 +#: src/Content/Text/BBCode.php:2104 msgid "Invalid link protocol" msgstr "" @@ -2475,7 +2476,7 @@ msgid "The end" msgstr "" #: src/Content/Text/HTML.php:882 src/Content/Widget/VCard.php:109 -#: src/Model/Profile.php:459 src/Module/Contact/Profile.php:428 +#: src/Model/Profile.php:459 msgid "Follow" msgstr "" @@ -2675,9 +2676,7 @@ msgstr "" msgid "Network:" msgstr "" -#: src/Content/Widget/VCard.php:111 src/Model/Contact.php:1195 -#: src/Model/Contact.php:1206 src/Model/Profile.php:461 -#: src/Module/Contact/Profile.php:420 +#: src/Content/Widget/VCard.php:111 src/Model/Profile.php:461 msgid "Unfollow" msgstr "" @@ -3365,6 +3364,10 @@ msgstr "" msgid "Legacy module file not found: %s" msgstr "" +#: src/Model/Contact.php:1195 src/Model/Contact.php:1206 +msgid "UnFollow" +msgstr "" + #: src/Model/Contact.php:1212 src/Module/Admin/Users/Pending.php:107 #: src/Module/Notifications/Introductions.php:132 #: src/Module/Notifications/Introductions.php:204 @@ -3555,66 +3558,66 @@ msgstr "" msgid "Edit groups" msgstr "" -#: src/Model/Item.php:1982 +#: src/Model/Item.php:1987 #, php-format msgid "Detected languages in this post:\\n%s" msgstr "" -#: src/Model/Item.php:2874 +#: src/Model/Item.php:2879 msgid "activity" msgstr "" -#: src/Model/Item.php:2876 +#: src/Model/Item.php:2881 msgid "comment" msgstr "" -#: src/Model/Item.php:2879 +#: src/Model/Item.php:2884 msgid "post" msgstr "" -#: src/Model/Item.php:3020 +#: src/Model/Item.php:3025 #, php-format msgid "Content warning: %s" msgstr "" -#: src/Model/Item.php:3383 +#: src/Model/Item.php:3388 msgid "bytes" msgstr "" -#: src/Model/Item.php:3414 +#: src/Model/Item.php:3419 #, php-format msgid "%2$s (%3$d%%, %1$d vote)" msgid_plural "%2$s (%3$d%%, %1$d votes)" msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3416 +#: src/Model/Item.php:3421 #, php-format msgid "%2$s (%1$d vote)" msgid_plural "%2$s (%1$d votes)" msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3421 +#: src/Model/Item.php:3426 #, php-format msgid "%d voter. Poll end: %s" msgid_plural "%d voters. Poll end: %s" msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3423 +#: src/Model/Item.php:3428 #, php-format msgid "%d voter." msgid_plural "%d voters." msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3425 +#: src/Model/Item.php:3430 #, php-format msgid "Poll end: %s" msgstr "" -#: src/Model/Item.php:3459 src/Model/Item.php:3460 +#: src/Model/Item.php:3464 src/Model/Item.php:3465 msgid "View on separate page" msgstr "" @@ -4222,7 +4225,7 @@ msgstr "" #: src/Module/Admin/Blocklist/Contact.php:101 #: src/Module/Admin/Users/Blocked.php:142 src/Module/Admin/Users/Index.php:156 #: src/Module/Contact.php:401 src/Module/Contact/Profile.php:349 -#: src/Module/Contact/Profile.php:468 +#: src/Module/Contact/Profile.php:450 msgid "Unblock" msgstr "" @@ -6657,7 +6660,7 @@ msgid "Update" msgstr "" #: src/Module/Contact.php:402 src/Module/Contact/Profile.php:350 -#: src/Module/Contact/Profile.php:476 +#: src/Module/Contact/Profile.php:458 msgid "Unignore" msgstr "" @@ -6893,7 +6896,7 @@ msgstr "" msgid "(Update was successful)" msgstr "" -#: src/Module/Contact/Profile.php:255 src/Module/Contact/Profile.php:439 +#: src/Module/Contact/Profile.php:255 src/Module/Contact/Profile.php:421 msgid "Suggest friends" msgstr "" @@ -6987,7 +6990,7 @@ msgstr "" msgid "Update public posts" msgstr "" -#: src/Module/Contact/Profile.php:347 src/Module/Contact/Profile.php:449 +#: src/Module/Contact/Profile.php:347 src/Module/Contact/Profile.php:431 msgid "Update now" msgstr "" @@ -7050,23 +7053,23 @@ msgid "" "entries from this contact." msgstr "" -#: src/Module/Contact/Profile.php:459 +#: src/Module/Contact/Profile.php:441 msgid "Refetch contact data" msgstr "" -#: src/Module/Contact/Profile.php:470 +#: src/Module/Contact/Profile.php:452 msgid "Toggle Blocked status" msgstr "" -#: src/Module/Contact/Profile.php:478 +#: src/Module/Contact/Profile.php:460 msgid "Toggle Ignored status" msgstr "" -#: src/Module/Contact/Profile.php:485 src/Module/Contact/Revoke.php:106 +#: src/Module/Contact/Profile.php:467 src/Module/Contact/Revoke.php:106 msgid "Revoke Follow" msgstr "" -#: src/Module/Contact/Profile.php:487 +#: src/Module/Contact/Profile.php:469 msgid "Revoke the follow from this contact" msgstr "" @@ -7206,7 +7209,7 @@ msgid "Sort by post creation date" msgstr "" #: src/Module/Conversation/Network.php:280 -#: src/Module/Settings/Profile/Index.php:227 +#: src/Module/Settings/Profile/Index.php:236 msgid "Personal" msgstr "" @@ -7430,7 +7433,7 @@ msgid "Twitter Source / Tweet URL (requires API key)" msgstr "" #: src/Module/Debug/Feed.php:52 src/Module/Filer/SaveTag.php:47 -#: src/Module/Settings/Profile/Index.php:141 +#: src/Module/Settings/Profile/Index.php:144 msgid "You must be logged in to use this module" msgstr "" @@ -8289,12 +8292,12 @@ msgstr "" msgid "Birthday:" msgstr "" -#: src/Module/Profile/Profile.php:166 src/Module/Settings/Profile/Index.php:245 +#: src/Module/Profile/Profile.php:166 src/Module/Settings/Profile/Index.php:254 #: src/Util/Temporal.php:168 msgid "Age: " msgstr "" -#: src/Module/Profile/Profile.php:166 src/Module/Settings/Profile/Index.php:245 +#: src/Module/Profile/Profile.php:166 src/Module/Settings/Profile/Index.php:254 #: src/Util/Temporal.php:168 #, php-format msgid "%d year old" @@ -9514,133 +9517,146 @@ msgstr "" msgid "Beginning of week:" msgstr "" -#: src/Module/Settings/Profile/Index.php:83 +#: src/Module/Settings/Profile/Index.php:84 msgid "Profile Name is required." msgstr "" -#: src/Module/Settings/Profile/Index.php:131 +#: src/Module/Settings/Profile/Index.php:134 msgid "Profile couldn't be updated." msgstr "" -#: src/Module/Settings/Profile/Index.php:172 -#: src/Module/Settings/Profile/Index.php:192 +#: src/Module/Settings/Profile/Index.php:175 +#: src/Module/Settings/Profile/Index.php:195 msgid "Label:" msgstr "" -#: src/Module/Settings/Profile/Index.php:173 -#: src/Module/Settings/Profile/Index.php:193 +#: src/Module/Settings/Profile/Index.php:176 +#: src/Module/Settings/Profile/Index.php:196 msgid "Value:" msgstr "" -#: src/Module/Settings/Profile/Index.php:183 -#: src/Module/Settings/Profile/Index.php:203 +#: src/Module/Settings/Profile/Index.php:186 +#: src/Module/Settings/Profile/Index.php:206 msgid "Field Permissions" msgstr "" -#: src/Module/Settings/Profile/Index.php:184 -#: src/Module/Settings/Profile/Index.php:204 +#: src/Module/Settings/Profile/Index.php:187 +#: src/Module/Settings/Profile/Index.php:207 msgid "(click to open/close)" msgstr "" -#: src/Module/Settings/Profile/Index.php:190 +#: src/Module/Settings/Profile/Index.php:193 msgid "Add a new profile field" msgstr "" -#: src/Module/Settings/Profile/Index.php:220 -msgid "Profile Actions" +#: src/Module/Settings/Profile/Index.php:217 +msgid "" +"The homepage is verified. A rel=\"me\" link back to your Friendica profile " +"page was found on the homepage." msgstr "" -#: src/Module/Settings/Profile/Index.php:221 -msgid "Edit Profile Details" -msgstr "" - -#: src/Module/Settings/Profile/Index.php:223 -msgid "Change Profile Photo" -msgstr "" - -#: src/Module/Settings/Profile/Index.php:228 -msgid "Profile picture" +#: src/Module/Settings/Profile/Index.php:219 +#, php-format +msgid "" +"To verify your homepage, add a rel=\"me\" link to it, pointing to your " +"profile URL (%s)." msgstr "" #: src/Module/Settings/Profile/Index.php:229 +msgid "Profile Actions" +msgstr "" + +#: src/Module/Settings/Profile/Index.php:230 +msgid "Edit Profile Details" +msgstr "" + +#: src/Module/Settings/Profile/Index.php:232 +msgid "Change Profile Photo" +msgstr "" + +#: src/Module/Settings/Profile/Index.php:237 +msgid "Profile picture" +msgstr "" + +#: src/Module/Settings/Profile/Index.php:238 msgid "Location" msgstr "" -#: src/Module/Settings/Profile/Index.php:230 src/Util/Temporal.php:95 +#: src/Module/Settings/Profile/Index.php:239 src/Util/Temporal.php:95 #: src/Util/Temporal.php:97 msgid "Miscellaneous" msgstr "" -#: src/Module/Settings/Profile/Index.php:231 +#: src/Module/Settings/Profile/Index.php:240 msgid "Custom Profile Fields" msgstr "" -#: src/Module/Settings/Profile/Index.php:233 src/Module/Welcome.php:58 +#: src/Module/Settings/Profile/Index.php:242 src/Module/Welcome.php:58 msgid "Upload Profile Photo" msgstr "" -#: src/Module/Settings/Profile/Index.php:237 +#: src/Module/Settings/Profile/Index.php:246 msgid "Display name:" msgstr "" -#: src/Module/Settings/Profile/Index.php:240 +#: src/Module/Settings/Profile/Index.php:249 msgid "Street Address:" msgstr "" -#: src/Module/Settings/Profile/Index.php:241 +#: src/Module/Settings/Profile/Index.php:250 msgid "Locality/City:" msgstr "" -#: src/Module/Settings/Profile/Index.php:242 +#: src/Module/Settings/Profile/Index.php:251 msgid "Region/State:" msgstr "" -#: src/Module/Settings/Profile/Index.php:243 +#: src/Module/Settings/Profile/Index.php:252 msgid "Postal/Zip Code:" msgstr "" -#: src/Module/Settings/Profile/Index.php:244 +#: src/Module/Settings/Profile/Index.php:253 msgid "Country:" msgstr "" -#: src/Module/Settings/Profile/Index.php:246 +#: src/Module/Settings/Profile/Index.php:255 msgid "XMPP (Jabber) address:" msgstr "" -#: src/Module/Settings/Profile/Index.php:246 +#: src/Module/Settings/Profile/Index.php:255 msgid "The XMPP address will be published so that people can follow you there." msgstr "" -#: src/Module/Settings/Profile/Index.php:247 +#: src/Module/Settings/Profile/Index.php:256 msgid "Matrix (Element) address:" msgstr "" -#: src/Module/Settings/Profile/Index.php:247 +#: src/Module/Settings/Profile/Index.php:256 msgid "" "The Matrix address will be published so that people can follow you there." msgstr "" -#: src/Module/Settings/Profile/Index.php:248 +#: src/Module/Settings/Profile/Index.php:257 msgid "Homepage URL:" msgstr "" -#: src/Module/Settings/Profile/Index.php:249 +#: src/Module/Settings/Profile/Index.php:258 msgid "Public Keywords:" msgstr "" -#: src/Module/Settings/Profile/Index.php:249 +#: src/Module/Settings/Profile/Index.php:258 msgid "(Used for suggesting potential friends, can be seen by others)" msgstr "" -#: src/Module/Settings/Profile/Index.php:250 +#: src/Module/Settings/Profile/Index.php:259 msgid "Private Keywords:" msgstr "" -#: src/Module/Settings/Profile/Index.php:250 +#: src/Module/Settings/Profile/Index.php:259 msgid "(Used for searching profiles, never shown to others)" msgstr "" -#: src/Module/Settings/Profile/Index.php:251 +#: src/Module/Settings/Profile/Index.php:260 #, php-format msgid "" "

Custom fields appear on your profile page.

\n" From 1c650980132716d7a90407b9eb5748b373658d2e Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 5 Nov 2022 16:50:40 +0100 Subject: [PATCH 09/21] clean up the used modules --- src/Worker/CheckRelMeProfileLink.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Worker/CheckRelMeProfileLink.php b/src/Worker/CheckRelMeProfileLink.php index 691931bdc..f1ab25e23 100644 --- a/src/Worker/CheckRelMeProfileLink.php +++ b/src/Worker/CheckRelMeProfileLink.php @@ -23,13 +23,11 @@ namespace Friendica\Worker; use DOMDocument; use Friendica\DI; -use Friendica\Database\DBA; use Friendica\Core\Logger; 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. From 5530b6fc75cb947b13fb54b6c42e9f369e6676b4 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 5 Nov 2022 19:48:51 +0100 Subject: [PATCH 10/21] 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 f1ab25e23..8e6f95a4a 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); } } } From dd0811aec98c78f17235a228c88b39dd95fc0a4f Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 6 Nov 2022 07:51:19 +0100 Subject: [PATCH 11/21] remove debugging tracers --- src/Worker/CheckRelMeProfileLink.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Worker/CheckRelMeProfileLink.php b/src/Worker/CheckRelMeProfileLink.php index 8e6f95a4a..f42c9b84b 100644 --- a/src/Worker/CheckRelMeProfileLink.php +++ b/src/Worker/CheckRelMeProfileLink.php @@ -57,7 +57,6 @@ class CheckRelMeProfileLink Logger::notice('Verifying the homepage', [$uid]); $homepageUrlVerified = false; $owner = User::getOwnerDataById($uid); - Logger::notice(print_r($owner)); if (!empty($owner['homepage'])) { $xrd_timeout = DI::config()->get('system', 'xrd_timeout', 20); $curlResult = DI::httpClient()->get($owner['homepage'], $accept_content = HttpClientAccept::HTML, [HttpClientOptions::TIMEOUT => $xrd_timeout]); From 39908f9083d71377939d9b3cb9bb5b1b50790c99 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 6 Nov 2022 08:37:50 +0100 Subject: [PATCH 12/21] regen messages.po --- view/lang/C/messages.po | 46 +++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 25 deletions(-) diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 341c7d4bf..692a57f3f 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -1,4 +1,3 @@ - # FRIENDICA Distributed Social Network # Copyright (C) 2010-2022, the Friendica project # This file is distributed under the same license as the Friendica package. @@ -9,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2022.12-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-11-05 15:53+0100\n" +"POT-Creation-Date: 2022-11-06 08:27+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2074,7 +2073,7 @@ msgstr "" msgid "show more" msgstr "" -#: src/Content/Item.php:295 src/Model/Item.php:2875 +#: src/Content/Item.php:295 src/Model/Item.php:2870 msgid "event" msgstr "" @@ -2083,7 +2082,7 @@ msgstr "" msgid "status" msgstr "" -#: src/Content/Item.php:304 src/Model/Item.php:2877 +#: src/Content/Item.php:304 src/Model/Item.php:2872 #: src/Module/Post/Tag/Add.php:123 msgid "photo" msgstr "" @@ -2442,8 +2441,8 @@ msgid "" "%2$s %3$s" msgstr "" -#: src/Content/Text/BBCode.php:1243 src/Model/Item.php:3476 -#: src/Model/Item.php:3482 src/Model/Item.php:3483 +#: src/Content/Text/BBCode.php:1243 src/Model/Item.php:3471 +#: src/Model/Item.php:3477 src/Model/Item.php:3478 msgid "Link to source" msgstr "" @@ -2459,11 +2458,11 @@ msgstr "" msgid "Encrypted content" msgstr "" -#: src/Content/Text/BBCode.php:2089 +#: src/Content/Text/BBCode.php:2092 msgid "Invalid source protocol" msgstr "" -#: src/Content/Text/BBCode.php:2104 +#: src/Content/Text/BBCode.php:2107 msgid "Invalid link protocol" msgstr "" @@ -2676,7 +2675,8 @@ msgstr "" msgid "Network:" msgstr "" -#: src/Content/Widget/VCard.php:111 src/Model/Profile.php:461 +#: src/Content/Widget/VCard.php:111 src/Model/Contact.php:1195 +#: src/Model/Contact.php:1206 src/Model/Profile.php:461 msgid "Unfollow" msgstr "" @@ -3364,10 +3364,6 @@ msgstr "" msgid "Legacy module file not found: %s" msgstr "" -#: src/Model/Contact.php:1195 src/Model/Contact.php:1206 -msgid "UnFollow" -msgstr "" - #: src/Model/Contact.php:1212 src/Module/Admin/Users/Pending.php:107 #: src/Module/Notifications/Introductions.php:132 #: src/Module/Notifications/Introductions.php:204 @@ -3558,66 +3554,66 @@ msgstr "" msgid "Edit groups" msgstr "" -#: src/Model/Item.php:1987 +#: src/Model/Item.php:1982 #, php-format msgid "Detected languages in this post:\\n%s" msgstr "" -#: src/Model/Item.php:2879 +#: src/Model/Item.php:2874 msgid "activity" msgstr "" -#: src/Model/Item.php:2881 +#: src/Model/Item.php:2876 msgid "comment" msgstr "" -#: src/Model/Item.php:2884 +#: src/Model/Item.php:2879 msgid "post" msgstr "" -#: src/Model/Item.php:3025 +#: src/Model/Item.php:3020 #, php-format msgid "Content warning: %s" msgstr "" -#: src/Model/Item.php:3388 +#: src/Model/Item.php:3383 msgid "bytes" msgstr "" -#: src/Model/Item.php:3419 +#: src/Model/Item.php:3414 #, php-format msgid "%2$s (%3$d%%, %1$d vote)" msgid_plural "%2$s (%3$d%%, %1$d votes)" msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3421 +#: src/Model/Item.php:3416 #, php-format msgid "%2$s (%1$d vote)" msgid_plural "%2$s (%1$d votes)" msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3426 +#: src/Model/Item.php:3421 #, php-format msgid "%d voter. Poll end: %s" msgid_plural "%d voters. Poll end: %s" msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3428 +#: src/Model/Item.php:3423 #, php-format msgid "%d voter." msgid_plural "%d voters." msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3430 +#: src/Model/Item.php:3425 #, php-format msgid "Poll end: %s" msgstr "" -#: src/Model/Item.php:3464 src/Model/Item.php:3465 +#: src/Model/Item.php:3459 src/Model/Item.php:3460 msgid "View on separate page" msgstr "" From 64f290a0551d9e585dbbeffa0ea333bb90c0c389 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 6 Nov 2022 08:43:30 +0100 Subject: [PATCH 13/21] avoide useless cURL request to the profile page --- src/Worker/CheckRelMeProfileLink.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Worker/CheckRelMeProfileLink.php b/src/Worker/CheckRelMeProfileLink.php index f42c9b84b..da3338e34 100644 --- a/src/Worker/CheckRelMeProfileLink.php +++ b/src/Worker/CheckRelMeProfileLink.php @@ -76,7 +76,7 @@ class CheckRelMeProfileLink $rel = $link->getAttribute('rel'); if ($rel == 'me') { $href = $link->getAttribute('href'); - if (strpos($href, 'http')!==false && !$homepageUrlVerified && Network::isUrlValid($href)) { + if (!$homepageUrlVerified && Network::isValidHttpUrl($href)) { $homepageUrlVerified = Strings::compareLink($owner['url'], $href); } } From fb04eb107bc7d996823919510a0aedeb1d662c8c Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 6 Nov 2022 08:57:14 +0100 Subject: [PATCH 14/21] set the validation to false, and only set it to true if we were able to verify the link --- src/Worker/CheckRelMeProfileLink.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/Worker/CheckRelMeProfileLink.php b/src/Worker/CheckRelMeProfileLink.php index da3338e34..306b3afb3 100644 --- a/src/Worker/CheckRelMeProfileLink.php +++ b/src/Worker/CheckRelMeProfileLink.php @@ -55,6 +55,7 @@ class CheckRelMeProfileLink public static function execute(int $uid) { Logger::notice('Verifying the homepage', [$uid]); + Profile::update(['homepage_verified' => false], $uid); $homepageUrlVerified = false; $owner = User::getOwnerDataById($uid); if (!empty($owner['homepage'])) { @@ -86,14 +87,12 @@ class CheckRelMeProfileLink Profile::update(['homepage_verified' => true], $uid); Logger::notice('Homepage URL verified', [$uid, $owner['homepage']]); } else { - 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); } } } From 33c9d17bdbf38d0e290af8ebac6980c52a630956 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 6 Nov 2022 09:03:11 +0100 Subject: [PATCH 15/21] change the cURL success check and adopt the logger messages --- src/Worker/CheckRelMeProfileLink.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Worker/CheckRelMeProfileLink.php b/src/Worker/CheckRelMeProfileLink.php index 306b3afb3..1bf67367f 100644 --- a/src/Worker/CheckRelMeProfileLink.php +++ b/src/Worker/CheckRelMeProfileLink.php @@ -61,9 +61,7 @@ class CheckRelMeProfileLink if (!empty($owner['homepage'])) { $xrd_timeout = DI::config()->get('system', 'xrd_timeout', 20); $curlResult = DI::httpClient()->get($owner['homepage'], $accept_content = HttpClientAccept::HTML, [HttpClientOptions::TIMEOUT => $xrd_timeout]); - if ($curlResult->isTimeout()) { - Logger::notice('Could not check homepage link of the user because the page loading request timed out.', [$uid, $owner['homepage']]); - } else { + if ($curlResult->isSuccess()) { $content = $curlResult->getBody(); if (!$content) { Logger::notice('Empty body of the fetched homepage link). Cannot verify the relation to profile of UID %s.', [$uid, $owner['homepage']]); @@ -90,6 +88,8 @@ class CheckRelMeProfileLink Logger::notice('Homepage URL could not be verified', [$uid, $owner['homepage']]); } } + } else { + Logger::notice('Could not cURL the homepage URL', [$owner['homepage']]); } } else { Logger::notice('The user has no homepage link.', [$uid]); From a9265220af99ea02cb8b13152e0762ac5a92c798 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 6 Nov 2022 10:11:49 +0100 Subject: [PATCH 16/21] add labels for the logger parameters --- src/Worker/CheckRelMeProfileLink.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Worker/CheckRelMeProfileLink.php b/src/Worker/CheckRelMeProfileLink.php index 1bf67367f..7943709d9 100644 --- a/src/Worker/CheckRelMeProfileLink.php +++ b/src/Worker/CheckRelMeProfileLink.php @@ -54,7 +54,7 @@ class CheckRelMeProfileLink */ public static function execute(int $uid) { - Logger::notice('Verifying the homepage', [$uid]); + Logger::notice('Verifying the homepage', ['uid' => $uid]); Profile::update(['homepage_verified' => false], $uid); $homepageUrlVerified = false; $owner = User::getOwnerDataById($uid); @@ -64,7 +64,7 @@ class CheckRelMeProfileLink if ($curlResult->isSuccess()) { $content = $curlResult->getBody(); if (!$content) { - Logger::notice('Empty body of the fetched homepage link). Cannot verify the relation to profile of UID %s.', [$uid, $owner['homepage']]); + Logger::notice('Empty body of the fetched homepage link). Cannot verify the relation to profile of UID %s.', ['uid' => $uid, 'owner homepage' => $owner['homepage']]); } else { $doc = new DOMDocument(); $doc->loadHTML($content); @@ -83,16 +83,16 @@ class CheckRelMeProfileLink } if ($homepageUrlVerified) { Profile::update(['homepage_verified' => true], $uid); - Logger::notice('Homepage URL verified', [$uid, $owner['homepage']]); + Logger::notice('Homepage URL verified', ['uid' => $uid, 'owner homepage' => $owner['homepage']]); } else { - Logger::notice('Homepage URL could not be verified', [$uid, $owner['homepage']]); + Logger::notice('Homepage URL could not be verified', ['uid' => $uid, 'owner homepage' => $owner['homepage']]); } } } else { - Logger::notice('Could not cURL the homepage URL', [$owner['homepage']]); + Logger::notice('Could not cURL the homepage URL', ['owner homepage' => $owner['homepage']]); } } else { - Logger::notice('The user has no homepage link.', [$uid]); + Logger::notice('The user has no homepage link.', ['uid' => $uid]); } } } From 594c17546bc1c394792cfa19c6186dc3507cf56a Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 6 Nov 2022 13:21:05 +0100 Subject: [PATCH 17/21] the config default parameter was deprecated --- src/Worker/CheckRelMeProfileLink.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Worker/CheckRelMeProfileLink.php b/src/Worker/CheckRelMeProfileLink.php index 7943709d9..99b431750 100644 --- a/src/Worker/CheckRelMeProfileLink.php +++ b/src/Worker/CheckRelMeProfileLink.php @@ -59,7 +59,7 @@ class CheckRelMeProfileLink $homepageUrlVerified = false; $owner = User::getOwnerDataById($uid); if (!empty($owner['homepage'])) { - $xrd_timeout = DI::config()->get('system', 'xrd_timeout', 20); + $xrd_timeout = DI::config()->get('system', 'xrd_timeout' ?? 20); $curlResult = DI::httpClient()->get($owner['homepage'], $accept_content = HttpClientAccept::HTML, [HttpClientOptions::TIMEOUT => $xrd_timeout]); if ($curlResult->isSuccess()) { $content = $curlResult->getBody(); From cdfd51310ea3dcebfd9dcbeac974f5c67832621e Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 6 Nov 2022 13:44:52 +0100 Subject: [PATCH 18/21] we don't need the 20... --- src/Worker/CheckRelMeProfileLink.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Worker/CheckRelMeProfileLink.php b/src/Worker/CheckRelMeProfileLink.php index 99b431750..b047ff3a2 100644 --- a/src/Worker/CheckRelMeProfileLink.php +++ b/src/Worker/CheckRelMeProfileLink.php @@ -59,7 +59,7 @@ class CheckRelMeProfileLink $homepageUrlVerified = false; $owner = User::getOwnerDataById($uid); if (!empty($owner['homepage'])) { - $xrd_timeout = DI::config()->get('system', 'xrd_timeout' ?? 20); + $xrd_timeout = DI::config()->get('system', 'xrd_timeout'); $curlResult = DI::httpClient()->get($owner['homepage'], $accept_content = HttpClientAccept::HTML, [HttpClientOptions::TIMEOUT => $xrd_timeout]); if ($curlResult->isSuccess()) { $content = $curlResult->getBody(); From 379eeb49eb523a52ccffeafc7e721ba635523716 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sun, 6 Nov 2022 20:35:39 +0100 Subject: [PATCH 19/21] make the standards check happy --- src/Worker/CheckRelMeProfileLink.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Worker/CheckRelMeProfileLink.php b/src/Worker/CheckRelMeProfileLink.php index b047ff3a2..e5727cc83 100644 --- a/src/Worker/CheckRelMeProfileLink.php +++ b/src/Worker/CheckRelMeProfileLink.php @@ -57,10 +57,10 @@ class CheckRelMeProfileLink Logger::notice('Verifying the homepage', ['uid' => $uid]); Profile::update(['homepage_verified' => false], $uid); $homepageUrlVerified = false; - $owner = User::getOwnerDataById($uid); + $owner = User::getOwnerDataById($uid); if (!empty($owner['homepage'])) { $xrd_timeout = DI::config()->get('system', 'xrd_timeout'); - $curlResult = DI::httpClient()->get($owner['homepage'], $accept_content = HttpClientAccept::HTML, [HttpClientOptions::TIMEOUT => $xrd_timeout]); + $curlResult = DI::httpClient()->get($owner['homepage'], $accept_content = HttpClientAccept::HTML, [HttpClientOptions::TIMEOUT => $xrd_timeout]); if ($curlResult->isSuccess()) { $content = $curlResult->getBody(); if (!$content) { From 44af6e4bc2f77b1187b72673dda48416844b9b03 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 7 Nov 2022 11:09:34 +0100 Subject: [PATCH 20/21] don't be pythonic --- src/Worker/Cron.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Worker/Cron.php b/src/Worker/Cron.php index cd155dbbb..e0ef134a2 100644 --- a/src/Worker/Cron.php +++ b/src/Worker/Cron.php @@ -134,7 +134,7 @@ class Cron Worker::add(Worker::PRIORITY_LOW, 'OptimizeTables'); } - foreach (User::getList($start=1, $limit=PHP_INT_MAX, $type='active') as $user) { + foreach (User::getList(1, PHP_INT_MAX, 'active') as $user) { Worker::add(Worker::PRIORITY_LOW, 'CheckRelMeProfileLink', $user['uid']); } From d82e8284f0626da31b82487bfbf529314ff619f4 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Mon, 7 Nov 2022 11:25:11 +0100 Subject: [PATCH 21/21] regen messages.po --- view/lang/C/messages.po | 61 +++++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 30 deletions(-) diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 692a57f3f..7fcf6e217 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2022.12-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-11-06 08:27+0100\n" +"POT-Creation-Date: 2022-11-07 11:21+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2127,12 +2127,12 @@ msgstr "" #: src/Content/Item.php:394 src/Module/Admin/Blocklist/Contact.php:100 #: src/Module/Admin/Users/Active.php:140 src/Module/Admin/Users/Index.php:154 #: src/Module/Contact.php:401 src/Module/Contact/Profile.php:349 -#: src/Module/Contact/Profile.php:450 +#: src/Module/Contact/Profile.php:468 msgid "Block" msgstr "" #: src/Content/Item.php:395 src/Module/Contact.php:402 -#: src/Module/Contact/Profile.php:350 src/Module/Contact/Profile.php:458 +#: src/Module/Contact/Profile.php:350 src/Module/Contact/Profile.php:476 #: src/Module/Notifications/Introductions.php:134 #: src/Module/Notifications/Introductions.php:206 #: src/Module/Notifications/Notification.php:89 @@ -2430,39 +2430,39 @@ msgstr "" msgid "last" msgstr "" -#: src/Content/Text/BBCode.php:1002 src/Content/Text/BBCode.php:1863 -#: src/Content/Text/BBCode.php:1864 +#: src/Content/Text/BBCode.php:1003 src/Content/Text/BBCode.php:1865 +#: src/Content/Text/BBCode.php:1866 msgid "Image/photo" msgstr "" -#: src/Content/Text/BBCode.php:1218 +#: src/Content/Text/BBCode.php:1220 #, php-format msgid "" "%2$s %3$s" msgstr "" -#: src/Content/Text/BBCode.php:1243 src/Model/Item.php:3471 -#: src/Model/Item.php:3477 src/Model/Item.php:3478 +#: src/Content/Text/BBCode.php:1245 src/Model/Item.php:3482 +#: src/Model/Item.php:3488 src/Model/Item.php:3489 msgid "Link to source" msgstr "" -#: src/Content/Text/BBCode.php:1781 src/Content/Text/HTML.php:940 +#: src/Content/Text/BBCode.php:1783 src/Content/Text/HTML.php:940 msgid "Click to open/close" msgstr "" -#: src/Content/Text/BBCode.php:1812 +#: src/Content/Text/BBCode.php:1814 msgid "$1 wrote:" msgstr "" -#: src/Content/Text/BBCode.php:1868 src/Content/Text/BBCode.php:1869 +#: src/Content/Text/BBCode.php:1870 src/Content/Text/BBCode.php:1871 msgid "Encrypted content" msgstr "" -#: src/Content/Text/BBCode.php:2092 +#: src/Content/Text/BBCode.php:2098 msgid "Invalid source protocol" msgstr "" -#: src/Content/Text/BBCode.php:2107 +#: src/Content/Text/BBCode.php:2113 msgid "Invalid link protocol" msgstr "" @@ -2475,7 +2475,7 @@ msgid "The end" msgstr "" #: src/Content/Text/HTML.php:882 src/Content/Widget/VCard.php:109 -#: src/Model/Profile.php:459 +#: src/Model/Profile.php:459 src/Module/Contact/Profile.php:428 msgid "Follow" msgstr "" @@ -2677,6 +2677,7 @@ msgstr "" #: src/Content/Widget/VCard.php:111 src/Model/Contact.php:1195 #: src/Model/Contact.php:1206 src/Model/Profile.php:461 +#: src/Module/Contact/Profile.php:420 msgid "Unfollow" msgstr "" @@ -3576,44 +3577,44 @@ msgstr "" msgid "Content warning: %s" msgstr "" -#: src/Model/Item.php:3383 +#: src/Model/Item.php:3394 msgid "bytes" msgstr "" -#: src/Model/Item.php:3414 +#: src/Model/Item.php:3425 #, php-format msgid "%2$s (%3$d%%, %1$d vote)" msgid_plural "%2$s (%3$d%%, %1$d votes)" msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3416 +#: src/Model/Item.php:3427 #, php-format msgid "%2$s (%1$d vote)" msgid_plural "%2$s (%1$d votes)" msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3421 +#: src/Model/Item.php:3432 #, php-format msgid "%d voter. Poll end: %s" msgid_plural "%d voters. Poll end: %s" msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3423 +#: src/Model/Item.php:3434 #, php-format msgid "%d voter." msgid_plural "%d voters." msgstr[0] "" msgstr[1] "" -#: src/Model/Item.php:3425 +#: src/Model/Item.php:3436 #, php-format msgid "Poll end: %s" msgstr "" -#: src/Model/Item.php:3459 src/Model/Item.php:3460 +#: src/Model/Item.php:3470 src/Model/Item.php:3471 msgid "View on separate page" msgstr "" @@ -4221,7 +4222,7 @@ msgstr "" #: src/Module/Admin/Blocklist/Contact.php:101 #: src/Module/Admin/Users/Blocked.php:142 src/Module/Admin/Users/Index.php:156 #: src/Module/Contact.php:401 src/Module/Contact/Profile.php:349 -#: src/Module/Contact/Profile.php:450 +#: src/Module/Contact/Profile.php:468 msgid "Unblock" msgstr "" @@ -6656,7 +6657,7 @@ msgid "Update" msgstr "" #: src/Module/Contact.php:402 src/Module/Contact/Profile.php:350 -#: src/Module/Contact/Profile.php:458 +#: src/Module/Contact/Profile.php:476 msgid "Unignore" msgstr "" @@ -6892,7 +6893,7 @@ msgstr "" msgid "(Update was successful)" msgstr "" -#: src/Module/Contact/Profile.php:255 src/Module/Contact/Profile.php:421 +#: src/Module/Contact/Profile.php:255 src/Module/Contact/Profile.php:439 msgid "Suggest friends" msgstr "" @@ -6986,7 +6987,7 @@ msgstr "" msgid "Update public posts" msgstr "" -#: src/Module/Contact/Profile.php:347 src/Module/Contact/Profile.php:431 +#: src/Module/Contact/Profile.php:347 src/Module/Contact/Profile.php:449 msgid "Update now" msgstr "" @@ -7049,23 +7050,23 @@ msgid "" "entries from this contact." msgstr "" -#: src/Module/Contact/Profile.php:441 +#: src/Module/Contact/Profile.php:459 msgid "Refetch contact data" msgstr "" -#: src/Module/Contact/Profile.php:452 +#: src/Module/Contact/Profile.php:470 msgid "Toggle Blocked status" msgstr "" -#: src/Module/Contact/Profile.php:460 +#: src/Module/Contact/Profile.php:478 msgid "Toggle Ignored status" msgstr "" -#: src/Module/Contact/Profile.php:467 src/Module/Contact/Revoke.php:106 +#: src/Module/Contact/Profile.php:485 src/Module/Contact/Revoke.php:106 msgid "Revoke Follow" msgstr "" -#: src/Module/Contact/Profile.php:469 +#: src/Module/Contact/Profile.php:487 msgid "Revoke the follow from this contact" msgstr ""