From 0259af1118841873e7da339c3a0cd7b1cfa4d4fe Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 25 Jan 2023 22:11:22 -0500 Subject: [PATCH 1/2] Cast key values to int in Mastodon\Stats - Address https://sekretaerbaer.de/display/61b27817-3763-cd4c-5fca-b4d397968464 --- src/Object/Api/Mastodon/Stats.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Object/Api/Mastodon/Stats.php b/src/Object/Api/Mastodon/Stats.php index 335c82d43..c38ba33f6 100644 --- a/src/Object/Api/Mastodon/Stats.php +++ b/src/Object/Api/Mastodon/Stats.php @@ -45,7 +45,7 @@ class Stats extends BaseDataTransferObject { if (!empty($config->get('system', 'nodeinfo'))) { $this->user_count = intval(DI::keyValue()->get('nodeinfo_total_users')); - $this->status_count = DI::keyValue()->get('nodeinfo_local_posts') + DI::keyValue()->get('nodeinfo_local_comments'); + $this->status_count = (int)DI::keyValue()->get('nodeinfo_local_posts') + (int)DI::keyValue()->get('nodeinfo_local_comments'); $this->domain_count = $database->count('gserver', ["`network` in (?, ?) AND NOT `failed` AND NOT `blocked`", Protocol::DFRN, Protocol::ACTIVITYPUB]); } } From be105db759c89c3fa0601f4426ec4b26e644615f Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 25 Jan 2023 22:31:07 -0500 Subject: [PATCH 2/2] Check the image URL has a host before retrieving it in Photo::importProfilePhoto - Address https://github.com/friendica/friendica/issues/12486#issuecomment-1404324012 --- src/Model/Photo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Model/Photo.php b/src/Model/Photo.php index 9623f5622..bf2f7bb8e 100644 --- a/src/Model/Photo.php +++ b/src/Model/Photo.php @@ -583,7 +583,7 @@ class Photo $photo_failure = false; $filename = basename($image_url); - if (!empty($image_url)) { + if (!empty($image_url) && @parse_url($image_url, PHP_URL_HOST)) { $ret = DI::httpClient()->get($image_url, HttpClientAccept::IMAGE); Logger::debug('Got picture', ['Content-Type' => $ret->getHeader('Content-Type'), 'url' => $image_url]); $img_str = $ret->getBody();