diff --git a/.phpstan.neon b/.phpstan.neon new file mode 100644 index 0000000000..ab1b5e1dc2 --- /dev/null +++ b/.phpstan.neon @@ -0,0 +1,14 @@ +# SPDX-FileCopyrightText: 2010 - 2024 the Friendica project +# +# SPDX-License-Identifier: CC0-1.0 + +parameters: + level: 0 + + paths: + - src/ + + scanDirectories: + - mod + - vendor + - view diff --git a/composer.json b/composer.json index 36905f81d1..4acfe7e41a 100644 --- a/composer.json +++ b/composer.json @@ -152,13 +152,16 @@ "mikey179/vfsstream": "^1.6", "mockery/mockery": "^1.3", "php-mock/php-mock-phpunit": "^2.10", + "phpstan/phpstan": "^2.0", "phpunit/phpunit": "^9" }, "scripts": { "test": "phpunit", "test:unit": "phpunit -c tests/phpunit.xml --testsuite unit", + "phpstan": "phpstan analyze --memory-limit 1024M --configuration .phpstan.neon", "lint": "find . -name \\*.php -not -path './vendor/*' -not -path './view/asset/*' -print0 | xargs -0 -n1 php -l", "docker:translate": "docker run --rm -v $PWD:/data -w /data friendicaci/transifex bin/run_xgettext.sh", + "lang:recreate": "bin/run_xgettext.sh", "cs:install": "@composer install --working-dir=bin/dev/php-cs-fixer", "cs:check": [ "@cs:install", diff --git a/composer.lock b/composer.lock index fae42ffe16..8d200a3f67 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d51158b9593011921144e90af146a86a", + "content-hash": "3e31a2243fb69e47e1b7000cca946fa2", "packages": [ { "name": "asika/simple-console", @@ -4832,6 +4832,64 @@ ], "time": "2024-02-11T07:24:16+00:00" }, + { + "name": "phpstan/phpstan", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpstan.git", + "reference": "ab4e9b4415a5fc9e4d27f7fe16c8bc9d067dcd6d" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/ab4e9b4415a5fc9e4d27f7fe16c8bc9d067dcd6d", + "reference": "ab4e9b4415a5fc9e4d27f7fe16c8bc9d067dcd6d", + "shasum": "" + }, + "require": { + "php": "^7.4|^8.0" + }, + "conflict": { + "phpstan/phpstan-shim": "*" + }, + "bin": [ + "phpstan", + "phpstan.phar" + ], + "type": "library", + "autoload": { + "files": [ + "bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPStan - PHP Static Analysis Tool", + "keywords": [ + "dev", + "static analysis" + ], + "support": { + "docs": "https://phpstan.org/user-guide/getting-started", + "forum": "https://github.com/phpstan/phpstan/discussions", + "issues": "https://github.com/phpstan/phpstan/issues", + "security": "https://github.com/phpstan/phpstan/security/policy", + "source": "https://github.com/phpstan/phpstan-src" + }, + "funding": [ + { + "url": "https://github.com/ondrejmirtes", + "type": "github" + }, + { + "url": "https://github.com/phpstan", + "type": "github" + } + ], + "time": "2024-11-11T15:43:04+00:00" + }, { "name": "phpunit/php-code-coverage", "version": "9.2.31", diff --git a/src/App/Mode.php b/src/App/Mode.php index 070d67ee4f..ebf9f46163 100644 --- a/src/App/Mode.php +++ b/src/App/Mode.php @@ -210,7 +210,7 @@ class Mode public function isInstall(): bool { return !$this->has(Mode::LOCALCONFIGPRESENT) || - !$this->has(MODE::DBAVAILABLE); + !$this->has(Mode::DBAVAILABLE); } /** diff --git a/src/BaseCollection.php b/src/BaseCollection.php index 407448fc5a..b30dbfc6b0 100644 --- a/src/BaseCollection.php +++ b/src/BaseCollection.php @@ -89,7 +89,9 @@ class BaseCollection extends \ArrayIterator */ public function map(callable $callback): BaseCollection { - return new static(array_map($callback, $this->getArrayCopy()), $this->getTotalCount()); + $class = get_class($this); + + return new $class(array_map($callback, $this->getArrayCopy()), $this->getTotalCount()); } /** @@ -102,7 +104,9 @@ class BaseCollection extends \ArrayIterator */ public function filter(callable $callback = null, int $flag = 0): BaseCollection { - return new static(array_filter($this->getArrayCopy(), $callback, $flag)); + $class = get_class($this); + + return new $class(array_filter($this->getArrayCopy(), $callback, $flag)); } /** @@ -112,7 +116,9 @@ class BaseCollection extends \ArrayIterator */ public function reverse(): BaseCollection { - return new static(array_reverse($this->getArrayCopy()), $this->getTotalCount()); + $class = get_class($this); + + return new $class(array_reverse($this->getArrayCopy()), $this->getTotalCount()); } /** @@ -128,7 +134,9 @@ class BaseCollection extends \ArrayIterator } return array_map(function ($array) { - return new static($array); + $class = get_class($this); + + return new $class($array); }, array_chunk($this->getArrayCopy(), $length)); } diff --git a/src/Console/Addon.php b/src/Console/Addon.php index fd2093f9f5..43ce7a6be3 100644 --- a/src/Console/Addon.php +++ b/src/Console/Addon.php @@ -144,6 +144,8 @@ HELP; } $this->out($table->getTable()); + + return 0; } /** diff --git a/src/Console/AutomaticInstallation.php b/src/Console/AutomaticInstallation.php index ad0a079d23..cc932f51c4 100644 --- a/src/Console/AutomaticInstallation.php +++ b/src/Console/AutomaticInstallation.php @@ -8,6 +8,7 @@ namespace Friendica\Console; use Asika\SimpleConsole\Console; +use Exception; use Friendica\App; use Friendica\App\BaseURL; use Friendica\Core\Config\Capability\IManageConfigValues; @@ -54,12 +55,12 @@ Options -d|--dbdata The name of the mysql/mariadb database (env MYSQL_DATABASE) -u|--dbuser The username of the mysql/mariadb database login (env MYSQL_USER or MYSQL_USERNAME) -P|--dbpass The password of the mysql/mariadb database login (env MYSQL_PASSWORD) - -U|--url The full base URL of Friendica - f.e. 'https://friendica.local/sub' (env FRIENDICA_URL) + -U|--url The full base URL of Friendica - f.e. 'https://friendica.local/sub' (env FRIENDICA_URL) -B|--phppath The path of the PHP binary (env FRIENDICA_PHP_PATH) -b|--basepath The basepath of Friendica (env FRIENDICA_BASE_PATH) -t|--tz The timezone of Friendica (env FRIENDICA_TZ) -L|--lang The language of Friendica (env FRIENDICA_LANG) - + Environment variables MYSQL_HOST The host of the mysql/mariadb database (mandatory if mysql and environment is used) MYSQL_PORT The port of the mysql/mariadb database @@ -73,7 +74,7 @@ Environment variables FRIENDICA_ADMIN_MAIL The admin email address of Friendica (this email will be used for admin access) FRIENDICA_TZ The timezone of Friendica FRIENDICA_LANG The langauge of Friendica - + Examples bin/console autoinstall -f 'input.config.php Installs Friendica with the prepared 'input.config.php' file diff --git a/src/Console/Contact.php b/src/Console/Contact.php index e02f589714..46a26c4a9d 100644 --- a/src/Console/Contact.php +++ b/src/Console/Contact.php @@ -158,9 +158,10 @@ HELP; if ($result['success']) { $this->out('User ' . $user['nickname'] . ' now connected to ' . $url . ', contact ID ' . $result['cid']); - } else { - throw new RuntimeException($result['message']); + return true; } + + throw new RuntimeException($result['message']); } /** diff --git a/src/Console/FixAPDeliveryWorkerTaskParameters.php b/src/Console/FixAPDeliveryWorkerTaskParameters.php index 9c420a3a68..9cced29dec 100644 --- a/src/Console/FixAPDeliveryWorkerTaskParameters.php +++ b/src/Console/FixAPDeliveryWorkerTaskParameters.php @@ -7,12 +7,11 @@ namespace Friendica\Console; -use Friendica\App; +use Asika\SimpleConsole\CommandArgsException; +use Friendica\App\Mode; +use Friendica\Core\L10n; use Friendica\Database\Database; -use Friendica\Database\DBA; -use Friendica\DI; use Friendica\Model\Contact; -use Friendica\Util\Strings; use RuntimeException; /** @@ -23,13 +22,17 @@ class FixAPDeliveryWorkerTaskParameters extends \Asika\SimpleConsole\Console protected $helpOptions = ['h', 'help', '?']; /** - * @var App\Mode + * @var Mode */ private $appMode; /** * @var Database */ private $dba; + /** + * @var L10n + */ + private $l10n; /** * @var int */ @@ -53,7 +56,7 @@ Usage Description During the 2020.12 RC period some worker task parameters have been corrupted, resulting in the impossibility to execute them. This command restores their expected parameters. - If you didn't run Friendica during the 2020.12 RC period, you do not need to use this command. + If you didn't run Friendica during the 2020.12 RC period, you do not need to use this command. Options -h|--help|-? Show help information @@ -62,7 +65,7 @@ HELP; return $help; } - public function __construct(App\Mode $appMode, Database $dba, \Friendica\Core\L10n $l10n, array $argv = null) + public function __construct(Mode $appMode, Database $dba, L10n $l10n, array $argv = null) { parent::__construct($argv); @@ -80,7 +83,7 @@ HELP; } if (count($this->args) > 0) { - throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments'); + throw new CommandArgsException('Too many arguments'); } if ($this->appMode->isInstall()) { diff --git a/src/Console/User.php b/src/Console/User.php index bdbe7be578..42e85f007d 100644 --- a/src/Console/User.php +++ b/src/Console/User.php @@ -122,7 +122,7 @@ HELP; case 'search': return $this->searchUser(); case 'config': - return $this->configUser(); + return ($this->configUser()) ? 0 : 1; default: throw new \Asika\SimpleConsole\CommandArgsException('Wrong command.'); } @@ -512,5 +512,7 @@ HELP; $this->out($this->getHelp()); return false; } + + return true; } } diff --git a/src/Content/Post/Entity/PostMedia.php b/src/Content/Post/Entity/PostMedia.php index a856118b80..0dd3309176 100644 --- a/src/Content/Post/Entity/PostMedia.php +++ b/src/Content/Post/Entity/PostMedia.php @@ -228,7 +228,7 @@ class PostMedia extends BaseEntity $newHeight = $dimensionts['height']; } - return new static( + return new self( $this->uriId, $this->url, $this->type, @@ -255,7 +255,7 @@ class PostMedia extends BaseEntity public function withUrl(\GuzzleHttp\Psr7\Uri $url): self { - return new static( + return new self( $this->uriId, $url, $this->type, diff --git a/src/Content/Widget/ContactBlock.php b/src/Content/Widget/ContactBlock.php index 917f973322..b1d80653d4 100644 --- a/src/Content/Widget/ContactBlock.php +++ b/src/Content/Widget/ContactBlock.php @@ -26,7 +26,6 @@ class ContactBlock /** * Get HTML for contact block * - * @template widget/contacts.tpl * @hook contact_block_end (contacts=>array, output=>string) * @return string Formatted HTML code or empty string */ diff --git a/src/Content/Widget/VCard.php b/src/Content/Widget/VCard.php index 3f89299466..f8d4453c81 100644 --- a/src/Content/Widget/VCard.php +++ b/src/Content/Widget/VCard.php @@ -26,7 +26,6 @@ class VCard /** * Get HTML for vcard block * - * @template widget/vcard.tpl * @param array $contact * @param bool $hide_mention * @param bool $hide_follow diff --git a/src/Core/Cache/Type/APCuCache.php b/src/Core/Cache/Type/APCuCache.php index d65ead179a..5564a1e793 100644 --- a/src/Core/Cache/Type/APCuCache.php +++ b/src/Core/Cache/Type/APCuCache.php @@ -41,11 +41,8 @@ class APCuCache extends AbstractCache implements ICanCacheInMemory $ns = $this->getCacheKey($prefix ?? ''); $ns = preg_quote($ns, '/'); - if (class_exists('\APCIterator')) { - $iterator = new \APCIterator('user', '/^' . $ns. '/', APC_ITER_KEY); - } else { - $iterator = new \APCUIterator('/^' . $ns . '/', APC_ITER_KEY); - } + /** @phpstan-ignore-next-line see https://github.com/friendica/friendica-addons/pull/1363 */ + $iterator = new \APCUIterator('/^' . $ns . '/', APC_ITER_KEY); $keys = []; foreach ($iterator as $item) { @@ -122,11 +119,8 @@ class APCuCache extends AbstractCache implements ICanCacheInMemory $prefix = $this->getPrefix(); $prefix = preg_quote($prefix, '/'); - if (class_exists('\APCIterator')) { - $iterator = new \APCIterator('user', '/^' . $prefix . '/', APC_ITER_KEY); - } else { - $iterator = new \APCUIterator('/^' . $prefix . '/', APC_ITER_KEY); - } + /** @phpstan-ignore-next-line see https://github.com/friendica/friendica-addons/pull/1363 */ + $iterator = new \APCUIterator('/^' . $prefix . '/', APC_ITER_KEY); return apcu_delete($iterator); } @@ -149,10 +143,7 @@ class APCuCache extends AbstractCache implements ICanCacheInMemory return false; } elseif (!ini_get('apc.enabled') && !ini_get('apc.enable_cli')) { return false; - } elseif ( - version_compare(phpversion('apc') ?: '0.0.0', '4.0.6') === -1 && - version_compare(phpversion('apcu') ?: '0.0.0', '5.1.0') === -1 - ) { + } elseif (version_compare(phpversion('apcu') ?: '0.0.0', '5.1.0', '<')) { return false; } diff --git a/src/Model/Contact.php b/src/Model/Contact.php index c6bdba2dc0..de5c50da8f 100644 --- a/src/Model/Contact.php +++ b/src/Model/Contact.php @@ -2706,8 +2706,6 @@ class Contact * * @param int $id * @param array $contact - * - * @return boolean */ private static function hasLocalData(int $id, array $contact): bool { @@ -2767,6 +2765,8 @@ class Contact 'network', 'alias', 'baseurl', 'gsid', 'forum', 'prv', 'contact-type', 'pubkey', 'last-item', 'xmpp', 'matrix', 'created', 'last-update' ]; + + /** @var array */ $contact = DBA::selectFirst('contact', $fields, ['id' => $id]); if (!DBA::isResult($contact)) { return false; @@ -2792,22 +2792,22 @@ class Contact $has_local_data = self::hasLocalData($id, $contact); - $uid = $contact['uid']; + $uid = $contact['uid'] ?? null; unset($contact['uid']); - $uriid = $contact['uri-id']; + $uriid = $contact['uri-id'] ?? null; unset($contact['uri-id']); - $pubkey = $contact['pubkey']; + $pubkey = $contact['pubkey'] ?? null; unset($contact['pubkey']); - $created = $contact['created']; + $created = $contact['created'] ?? ''; unset($contact['created']); - $last_update = $contact['last-update']; + $last_update = $contact['last-update'] ?? ''; unset($contact['last-update']); - $contact['photo'] = $contact['avatar']; + $contact['photo'] = $contact['avatar'] ?? null; unset($contact['avatar']); $updated = DateTimeFormat::utcNow(); diff --git a/src/Model/Item.php b/src/Model/Item.php index 06f824e6fe..0a000f8c1e 100644 --- a/src/Model/Item.php +++ b/src/Model/Item.php @@ -3198,10 +3198,10 @@ class Item } elseif ($remote_user) { // Authenticated visitor - fetch the matching permissionsets $permissionSets = DI::permissionSet()->selectByContactId($remote_user, $owner_id); - if (!empty($set)) { + if (!empty($permissionSets)) { $condition = [ "(`private` != ? OR (`private` = ? AND `wall` - AND `psid` IN (" . implode(', ', array_fill(0, count($set), '?')) . ")))", + AND `psid` IN (" . implode(', ', array_fill(0, count($permissionSets), '?')) . ")))", self::PRIVATE, self::PRIVATE ]; $condition = array_merge($condition, $permissionSets->column('id')); @@ -3247,7 +3247,7 @@ class Item */ $permissionSets = DI::permissionSet()->selectByContactId($remote_user, $owner_id); - if (!empty($set)) { + if (!empty($permissionSets)) { $sql_set = sprintf(" OR (" . $table . "`private` = %d AND " . $table . "`wall` AND " . $table . "`psid` IN (", self::PRIVATE) . implode(',', $permissionSets->column('id')) . "))"; } else { $sql_set = ''; diff --git a/src/Module/Api/Mastodon/Search.php b/src/Module/Api/Mastodon/Search.php index e87c710b09..45556bc3aa 100644 --- a/src/Module/Api/Mastodon/Search.php +++ b/src/Module/Api/Mastodon/Search.php @@ -157,10 +157,6 @@ class Search extends BaseApi $condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $max_id]); } - if (!empty($since_id)) { - $condition = DBA::mergeConditions($condition, ["`uri-id` > ?", $since_id]); - } - if (!empty($min_id)) { $condition = DBA::mergeConditions($condition, ["`uri-id` > ?", $min_id]); diff --git a/src/Module/Debug/ActivityPubConversion.php b/src/Module/Debug/ActivityPubConversion.php index 251b9ad26e..da165174b8 100644 --- a/src/Module/Debug/ActivityPubConversion.php +++ b/src/Module/Debug/ActivityPubConversion.php @@ -23,12 +23,12 @@ class ActivityPubConversion extends BaseModule protected function content(array $request = []): string { - function visible_whitespace($s) - { - return '
' . htmlspecialchars($s) . '
'; - } - $results = []; + + $visible_whitespace = function (string $s): string { + return '
' . htmlspecialchars($s) . '
'; + }; + if (!empty($_REQUEST['source'])) { try { $source = json_decode($_REQUEST['source'], true); @@ -43,11 +43,11 @@ class ActivityPubConversion extends BaseModule $formatted = json_encode($source, JSON_PRETTY_PRINT); $results[] = [ 'title' => DI::l10n()->t('Formatted'), - 'content' => visible_whitespace(trim(var_export($formatted, true), "'")), + 'content' => $visible_whitespace(trim(var_export($formatted, true), "'")), ]; $results[] = [ 'title' => DI::l10n()->t('Source'), - 'content' => visible_whitespace(var_export($source, true)) + 'content' => $visible_whitespace(var_export($source, true)) ]; $activity = JsonLD::compact($source); if (!$activity) { @@ -55,7 +55,7 @@ class ActivityPubConversion extends BaseModule } $results[] = [ 'title' => DI::l10n()->t('Activity'), - 'content' => visible_whitespace(var_export($activity, true)) + 'content' => $visible_whitespace(var_export($activity, true)) ]; $type = JsonLD::fetchElement($activity, '@type'); @@ -92,10 +92,6 @@ class ActivityPubConversion extends BaseModule throw new \Exception('No trust for activity type "' . $type . '", so we quit now.'); } - if (!empty($body) && empty($object_data['raw'])) { - $object_data['raw'] = $body; - } - // Internal flag for thread completion. See Processor.php if (!empty($activity['thread-completion'])) { $object_data['thread-completion'] = $activity['thread-completion']; @@ -107,14 +103,14 @@ class ActivityPubConversion extends BaseModule $results[] = [ 'title' => DI::l10n()->t('Object data'), - 'content' => visible_whitespace(var_export($object_data, true)) + 'content' => $visible_whitespace(var_export($object_data, true)) ]; $item = ActivityPub\Processor::createItem($object_data, true); $results[] = [ 'title' => DI::l10n()->t('Result Item'), - 'content' => visible_whitespace(var_export($item, true)) + 'content' => $visible_whitespace(var_export($item, true)) ]; } catch (\Throwable $e) { $results[] = [ diff --git a/src/Module/Debug/Babel.php b/src/Module/Debug/Babel.php index 8a7c5230dc..e7852847f6 100644 --- a/src/Module/Debug/Babel.php +++ b/src/Module/Debug/Babel.php @@ -29,12 +29,12 @@ class Babel extends BaseModule protected function content(array $request = []): string { - function visible_whitespace($s) - { - return '
' . htmlspecialchars($s) . '
'; - } - $results = []; + + $visible_whitespace = function (string $s): string { + return '
' . htmlspecialchars($s) . '
'; + }; + if (!empty($request['text'])) { self::checkFormSecurityTokenForbiddenOnError('babel'); switch (($request['type'] ?? '') ?: 'bbcode') { @@ -42,24 +42,24 @@ class Babel extends BaseModule $bbcode = $request['text']; $results[] = [ 'title' => DI::l10n()->t('Source input'), - 'content' => visible_whitespace($bbcode) + 'content' => $visible_whitespace($bbcode) ]; $plain = Text\BBCode::toPlaintext($bbcode, false); $results[] = [ 'title' => DI::l10n()->t('BBCode::toPlaintext'), - 'content' => visible_whitespace($plain) + 'content' => $visible_whitespace($plain) ]; $html = Text\BBCode::convertForUriId(0, $bbcode); $results[] = [ 'title' => DI::l10n()->t('BBCode::convert (raw HTML)'), - 'content' => visible_whitespace($html) + 'content' => $visible_whitespace($html) ]; $results[] = [ 'title' => DI::l10n()->t('BBCode::convert (hex)'), - 'content' => visible_whitespace(bin2hex($html)), + 'content' => $visible_whitespace(bin2hex($html)), ]; $results[] = [ @@ -70,19 +70,19 @@ class Babel extends BaseModule $bbcode2 = Text\HTML::toBBCode($html); $results[] = [ 'title' => DI::l10n()->t('BBCode::convert => HTML::toBBCode'), - 'content' => visible_whitespace($bbcode2) + 'content' => $visible_whitespace($bbcode2) ]; $markdown = Text\BBCode::toMarkdown($bbcode); $results[] = [ 'title' => DI::l10n()->t('BBCode::toMarkdown'), - 'content' => visible_whitespace($markdown) + 'content' => $visible_whitespace($markdown) ]; $html2 = Text\Markdown::convert($markdown); $results[] = [ 'title' => DI::l10n()->t('BBCode::toMarkdown => Markdown::convert (raw HTML)'), - 'content' => visible_whitespace($html2) + 'content' => $visible_whitespace($html2) ]; $results[] = [ 'title' => DI::l10n()->t('BBCode::toMarkdown => Markdown::convert'), @@ -92,13 +92,13 @@ class Babel extends BaseModule $bbcode3 = Text\Markdown::toBBCode($markdown); $results[] = [ 'title' => DI::l10n()->t('BBCode::toMarkdown => Markdown::toBBCode'), - 'content' => visible_whitespace($bbcode3) + 'content' => $visible_whitespace($bbcode3) ]; $bbcode4 = Text\HTML::toBBCode($html2); $results[] = [ 'title' => DI::l10n()->t('BBCode::toMarkdown => Markdown::convert => HTML::toBBCode'), - 'content' => visible_whitespace($bbcode4) + 'content' => $visible_whitespace($bbcode4) ]; $tags = Text\BBCode::getTags($bbcode); @@ -106,22 +106,22 @@ class Babel extends BaseModule $body = Item::setHashtags($bbcode); $results[] = [ 'title' => DI::l10n()->t('Item Body'), - 'content' => visible_whitespace($body) + 'content' => $visible_whitespace($body) ]; $results[] = [ 'title' => DI::l10n()->t('Item Tags'), - 'content' => visible_whitespace(var_export($tags, true)), + 'content' => $visible_whitespace(var_export($tags, true)), ]; $body2 = PageInfo::searchAndAppendToBody($bbcode, true); $results[] = [ 'title' => DI::l10n()->t('PageInfo::appendToBody'), - 'content' => visible_whitespace($body2) + 'content' => $visible_whitespace($body2) ]; $html3 = Text\BBCode::convertForUriId(0, $body2); $results[] = [ 'title' => DI::l10n()->t('PageInfo::appendToBody => BBCode::convert (raw HTML)'), - 'content' => visible_whitespace($html3) + 'content' => $visible_whitespace($html3) ]; $results[] = [ 'title' => DI::l10n()->t('PageInfo::appendToBody => BBCode::convert'), @@ -132,7 +132,7 @@ class Babel extends BaseModule $diaspora = trim($request['text']); $results[] = [ 'title' => DI::l10n()->t('Source input (Diaspora format)'), - 'content' => visible_whitespace($diaspora), + 'content' => $visible_whitespace($diaspora), ]; $markdown = XML::unescape($diaspora); @@ -141,13 +141,13 @@ class Babel extends BaseModule $results[] = [ 'title' => DI::l10n()->t('Source input (Markdown)'), - 'content' => visible_whitespace($markdown), + 'content' => $visible_whitespace($markdown), ]; $html = Text\Markdown::convert($markdown); $results[] = [ 'title' => DI::l10n()->t('Markdown::convert (raw HTML)'), - 'content' => visible_whitespace($html), + 'content' => $visible_whitespace($html), ]; $results[] = [ @@ -158,14 +158,14 @@ class Babel extends BaseModule $bbcode = Text\Markdown::toBBCode($markdown); $results[] = [ 'title' => DI::l10n()->t('Markdown::toBBCode'), - 'content' => visible_whitespace($bbcode), + 'content' => $visible_whitespace($bbcode), ]; break; case 'html' : $html = trim($request['text']); $results[] = [ 'title' => DI::l10n()->t('Raw HTML input'), - 'content' => visible_whitespace($html), + 'content' => $visible_whitespace($html), ]; $results[] = [ @@ -177,12 +177,12 @@ class Babel extends BaseModule $results[] = [ 'title' => DI::l10n()->t('HTML Purified (raw)'), - 'content' => visible_whitespace($purified), + 'content' => $visible_whitespace($purified), ]; $results[] = [ 'title' => DI::l10n()->t('HTML Purified (hex)'), - 'content' => visible_whitespace(bin2hex($purified)), + 'content' => $visible_whitespace(bin2hex($purified)), ]; $results[] = [ @@ -193,7 +193,7 @@ class Babel extends BaseModule $bbcode = Text\HTML::toBBCode($html); $results[] = [ 'title' => DI::l10n()->t('HTML::toBBCode'), - 'content' => visible_whitespace($bbcode) + 'content' => $visible_whitespace($bbcode) ]; $html2 = Text\BBCode::convertForUriId(0, $bbcode); @@ -210,25 +210,25 @@ class Babel extends BaseModule $bbcode2plain = Text\BBCode::toPlaintext($bbcode); $results[] = [ 'title' => DI::l10n()->t('HTML::toBBCode => BBCode::toPlaintext'), - 'content' => visible_whitespace($bbcode2plain), + 'content' => $visible_whitespace($bbcode2plain), ]; $markdown = Text\HTML::toMarkdown($html); $results[] = [ 'title' => DI::l10n()->t('HTML::toMarkdown'), - 'content' => visible_whitespace($markdown) + 'content' => $visible_whitespace($markdown) ]; $text = Text\HTML::toPlaintext($html, 0); $results[] = [ 'title' => DI::l10n()->t('HTML::toPlaintext'), - 'content' => visible_whitespace($text), + 'content' => $visible_whitespace($text), ]; $text = Text\HTML::toPlaintext($html, 0, true); $results[] = [ 'title' => DI::l10n()->t('HTML::toPlaintext (compact)'), - 'content' => visible_whitespace($text), + 'content' => $visible_whitespace($text), ]; break; case 'twitter': @@ -237,16 +237,11 @@ class Babel extends BaseModule if (file_exists('addon/twitter/twitter.php')) { require_once 'addon/twitter/twitter.php'; - if (parse_url($json) !== false) { - preg_match('#^https?://(?:mobile\.|www\.)?twitter.com/[^/]+/status/(\d+).*#', $json, $matches); - $status = twitter_statuses_show($matches[1]); - } else { - $status = json_decode($json); - } + $status = json_decode($json); $results[] = [ 'title' => DI::l10n()->t('Decoded post'), - 'content' => visible_whitespace(var_export($status, true)), + 'content' => $visible_whitespace(var_export($status, true)), ]; $postarray = []; @@ -263,23 +258,9 @@ class Babel extends BaseModule $postarray['object-type'] = Activity\ObjectType::BOOKMARK; } - $picture = \twitter_media_entities($status, $postarray); - $results[] = [ 'title' => DI::l10n()->t('Post array before expand entities'), - 'content' => visible_whitespace(var_export($postarray, true)), - ]; - - $converted = \twitter_expand_entities($postarray['body'], $status, $picture); - - $results[] = [ - 'title' => DI::l10n()->t('Post converted'), - 'content' => visible_whitespace(var_export($converted, true)), - ]; - - $results[] = [ - 'title' => DI::l10n()->t('Converted body'), - 'content' => visible_whitespace($converted['body']), + 'content' => $visible_whitespace(var_export($postarray, true)), ]; } else { $results[] = [ diff --git a/src/Module/Debug/ItemBody.php b/src/Module/Debug/ItemBody.php index fe07f51b8f..204a0dd5a8 100644 --- a/src/Module/Debug/ItemBody.php +++ b/src/Module/Debug/ItemBody.php @@ -11,36 +11,43 @@ use Friendica\BaseModule; use Friendica\Core\System; use Friendica\DI; use Friendica\Model\Post; -use Friendica\Network\HTTPException; +use Friendica\Network\HTTPException\NotFoundException; +use Friendica\Network\HTTPException\UnauthorizedException; /** * Print the body of an Item */ class ItemBody extends BaseModule { + /** + * @throws NotFoundException|UnauthorizedException + * + * @return string|never + */ protected function content(array $request = []): string { if (!DI::userSession()->getLocalUserId()) { - throw new HTTPException\UnauthorizedException(DI::l10n()->t('Access denied.')); + throw new UnauthorizedException(DI::l10n()->t('Access denied.')); } if (empty($this->parameters['item'])) { - throw new HTTPException\NotFoundException(DI::l10n()->t('Item not found.')); + throw new NotFoundException(DI::l10n()->t('Item not found.')); } $itemId = intval($this->parameters['item']); $item = Post::selectFirst(['body'], ['uid' => [0, DI::userSession()->getLocalUserId()], 'uri-id' => $itemId]); - if (!empty($item)) { - if (DI::mode()->isAjax()) { - echo str_replace("\n", '
', $item['body']); - System::exit(); - } else { - return str_replace("\n", '
', $item['body']); - } - } else { - throw new HTTPException\NotFoundException(DI::l10n()->t('Item not found.')); + if (empty($item)) { + throw new NotFoundException(DI::l10n()->t('Item not found.')); } + + // TODO: Extract this code into controller + if (DI::mode()->isAjax()) { + echo str_replace("\n", '
', $item['body']); + System::exit(); + } + + return str_replace("\n", '
', $item['body']); } } diff --git a/src/Object/Api/Mastodon/Preferences.php b/src/Object/Api/Mastodon/Preferences.php index 7447f5fa74..68f3c922a8 100644 --- a/src/Object/Api/Mastodon/Preferences.php +++ b/src/Object/Api/Mastodon/Preferences.php @@ -17,16 +17,30 @@ use Friendica\BaseDataTransferObject; */ class Preferences extends BaseDataTransferObject { -// /** @var string (Enumerable, oneOf) */ -// protected $posting_default_visibility; -// /** @var bool */ -// protected $posting_default_sensitive; -// /** @var string (ISO 639-1 language two-letter code), or null*/ -// protected $posting_default_language; -// /** @var string (Enumerable, oneOf) */ -// protected $reading_expand_media; -// /** @var bool */ -// protected $reading_expand_spoilers; + /** + * @var string (Enumerable, oneOf) + */ + private $visibility; + + /** + * @var bool + */ + private $sensitive; + + /** + * @var string (ISO 639-1 language two-letter code), or null + */ + private $language; + + /** + * @var string (Enumerable, oneOf) + */ + private $media; + + /** + * @var bool + */ + private $spoilers; /** * Creates a preferences record. @@ -39,10 +53,26 @@ class Preferences extends BaseDataTransferObject */ public function __construct(string $visibility, bool $sensitive, string $language, string $media, bool $spoilers) { - $this->{'posting:default:visibility'} = $visibility; - $this->{'posting:default:sensitive'} = $sensitive; - $this->{'posting:default:language'} = $language; - $this->{'reading:expand:media'} = $media; - $this->{'reading:expand:spoilers'} = $spoilers; + $this->visibility = $visibility; + $this->sensitive = $sensitive; + $this->language = $language; + $this->media = $media; + $this->spoilers = $spoilers; + } + + /** + * Returns the current entity as an array + * + * @return array + */ + public function toArray(): array + { + return [ + 'posting:default:visibility' => $this->visibility, + 'posting:default:sensitive' => $this->sensitive, + 'posting:default:language' => $this->language, + 'reading:expand:media' => $this->media, + 'reading:expand:spoilers' => $this->spoilers, + ]; } } diff --git a/src/Protocol/ActivityPub/Receiver.php b/src/Protocol/ActivityPub/Receiver.php index 12fd91b7cf..7512e6179c 100644 --- a/src/Protocol/ActivityPub/Receiver.php +++ b/src/Protocol/ActivityPub/Receiver.php @@ -1880,25 +1880,29 @@ class Receiver $object_data = self::getObjectDataFromActivity($object); - $receiverdata = self::getReceivers($object, $actor ?: $object_data['actor'] ?? '', $object_data['tags'], true, false); - $receivers = $reception_types = []; - foreach ($receiverdata as $key => $data) { - $receivers[$key] = $data['uid']; - $reception_types[$data['uid']] = $data['type'] ?? 0; - } - $object_data['receiver_urls'] = self::getReceiverURL($object); - $object_data['receiver'] = $receivers; - $object_data['reception_type'] = $reception_types; + $object_data['receiver'] = []; + $object_data['reception_type'] = []; + $object_data['unlisted'] = false; + + $receiverdata = self::getReceivers($object, $actor ?: $object_data['actor'] ?? '', $object_data['tags'], true, false); + + foreach ($receiverdata as $key => $data) { + if ($data['uid'] !== -1) { + $object_data['reception_type'][$data['uid']] = $data['type'] ?? 0; + } + + if ($key !== -1) { + $object_data['receiver'][$key] = $data['uid']; + } else { + $object_data['unlisted'] = true; + } + } if (!empty($object['pixelfed:capabilities'])) { $object_data['capabilities'] = self::getCapabilities($object); } - $object_data['unlisted'] = in_array(-1, $object_data['receiver']); - unset($object_data['receiver'][-1]); - unset($object_data['reception_type'][-1]); - return $object_data; } diff --git a/src/Util/Temporal.php b/src/Util/Temporal.php index 0ce59bfaf0..d3ed346908 100644 --- a/src/Util/Temporal.php +++ b/src/Util/Temporal.php @@ -359,6 +359,8 @@ class Temporal return sprintf($format, $r, (($r == 1) ? $str[0] : $str[1])); } } + + return ''; } /** diff --git a/tests/Unit/Object/Api/Mastodon/PreferencesTest.php b/tests/Unit/Object/Api/Mastodon/PreferencesTest.php new file mode 100644 index 0000000000..e77a4272e0 --- /dev/null +++ b/tests/Unit/Object/Api/Mastodon/PreferencesTest.php @@ -0,0 +1,46 @@ + 'visibility', + 'posting:default:sensitive' => true, + 'posting:default:language' => 'language', + 'reading:expand:media' => 'media', + 'reading:expand:spoilers' => false, + ], + $preferences->toArray(), + ); + } + + public function testJsonSerializeReturnsArray(): void + { + $preferences = new Preferences('visibility', true, 'language', 'media', false); + + self::assertSame( + [ + 'posting:default:visibility' => 'visibility', + 'posting:default:sensitive' => true, + 'posting:default:language' => 'language', + 'reading:expand:media' => 'media', + 'reading:expand:spoilers' => false, + ], + $preferences->jsonSerialize(), + ); + } +} diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index 566b5df411..7c69b8d946 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2024.09-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2024-10-07 20:46+0000\n" +"POT-Creation-Date: 2024-11-10 07:44+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -39,8 +39,8 @@ msgid "Empty post discarded." msgstr "" #: mod/item.php:425 src/Module/Admin/Themes/Details.php:31 -#: src/Module/Admin/Themes/Index.php:51 src/Module/Debug/ItemBody.php:28 -#: src/Module/Debug/ItemBody.php:43 src/Module/Item/Feed.php:66 +#: src/Module/Admin/Themes/Index.php:51 src/Module/Debug/ItemBody.php:34 +#: src/Module/Debug/ItemBody.php:42 src/Module/Item/Feed.php:66 msgid "Item not found." msgstr "" @@ -291,9 +291,9 @@ msgstr "" #: mod/photos.php:778 mod/photos.php:1055 mod/photos.php:1096 #: mod/photos.php:1152 mod/photos.php:1232 #: src/Module/Calendar/Event/Form.php:236 src/Module/Contact/Advanced.php:118 -#: src/Module/Contact/Profile.php:370 -#: src/Module/Debug/ActivityPubConversion.php:132 -#: src/Module/Debug/Babel.php:307 src/Module/Debug/Localtime.php:50 +#: src/Module/Contact/Profile.php:371 +#: src/Module/Debug/ActivityPubConversion.php:124 +#: src/Module/Debug/Babel.php:283 src/Module/Debug/Localtime.php:50 #: src/Module/Debug/Probe.php:40 src/Module/Debug/WebFinger.php:37 #: src/Module/FriendSuggest.php:131 src/Module/Install.php:220 #: src/Module/Install.php:260 src/Module/Install.php:295 @@ -792,15 +792,15 @@ msgstr "" msgid "Common" msgstr "" -#: src/Console/Addon.php:161 src/Console/Addon.php:185 +#: src/Console/Addon.php:163 src/Console/Addon.php:187 msgid "Addon not found" msgstr "" -#: src/Console/Addon.php:165 +#: src/Console/Addon.php:167 msgid "Addon already enabled" msgstr "" -#: src/Console/Addon.php:189 +#: src/Console/Addon.php:191 msgid "Addon already disabled" msgstr "" @@ -1065,7 +1065,7 @@ msgstr "" msgid "Email" msgstr "" -#: src/Content/ContactSelector.php:116 src/Module/Debug/Babel.php:301 +#: src/Content/ContactSelector.php:116 src/Module/Debug/Babel.php:277 msgid "Diaspora" msgstr "" @@ -1365,7 +1365,7 @@ msgstr "" msgid "Public post" msgstr "" -#: src/Content/Conversation.php:410 src/Content/Widget/VCard.php:117 +#: src/Content/Conversation.php:410 src/Content/Widget/VCard.php:116 #: src/Model/Profile.php:462 src/Module/Admin/Logs/View.php:80 #: src/Module/Post/Edit.php:167 msgid "Message" @@ -1881,7 +1881,7 @@ msgid "Send PM" msgstr "" #: src/Content/Item.php:421 src/Module/Contact.php:449 -#: src/Module/Contact/Profile.php:518 +#: src/Module/Contact/Profile.php:519 #: src/Module/Moderation/Blocklist/Contact.php:102 #: src/Module/Moderation/Users/Active.php:123 #: src/Module/Moderation/Users/Index.php:138 @@ -1889,7 +1889,7 @@ msgid "Block" msgstr "" #: src/Content/Item.php:422 src/Module/Contact.php:450 -#: src/Module/Contact/Profile.php:526 +#: src/Module/Contact/Profile.php:527 #: src/Module/Notifications/Introductions.php:126 #: src/Module/Notifications/Introductions.php:198 #: src/Module/Notifications/Notification.php:75 @@ -1897,7 +1897,7 @@ msgid "Ignore" msgstr "" #: src/Content/Item.php:423 src/Module/Contact.php:451 -#: src/Module/Contact/Profile.php:534 +#: src/Module/Contact/Profile.php:535 msgid "Collapse" msgstr "" @@ -1969,7 +1969,7 @@ msgstr "" #: src/Content/Nav.php:216 src/Module/BaseProfile.php:35 #: src/Module/BaseSettings.php:84 src/Module/Contact.php:485 -#: src/Module/Contact/Profile.php:425 src/Module/Profile/Profile.php:256 +#: src/Module/Contact/Profile.php:426 src/Module/Profile/Profile.php:256 #: src/Module/Welcome.php:43 view/theme/frio/theme.php:221 msgid "Profile" msgstr "" @@ -2278,8 +2278,8 @@ msgstr "" msgid "The end" msgstr "" -#: src/Content/Text/HTML.php:847 src/Content/Widget/VCard.php:113 -#: src/Model/Profile.php:456 src/Module/Contact/Profile.php:478 +#: src/Content/Text/HTML.php:847 src/Content/Widget/VCard.php:112 +#: src/Model/Profile.php:456 src/Module/Contact/Profile.php:479 msgid "Follow" msgstr "" @@ -2421,18 +2421,18 @@ msgstr "" msgid "Export calendar as csv" msgstr "" -#: src/Content/Widget/ContactBlock.php:65 +#: src/Content/Widget/ContactBlock.php:64 msgid "No contacts" msgstr "" -#: src/Content/Widget/ContactBlock.php:96 +#: src/Content/Widget/ContactBlock.php:95 #, php-format msgid "%d Contact" msgid_plural "%d Contacts" msgstr[0] "" msgstr[1] "" -#: src/Content/Widget/ContactBlock.php:113 +#: src/Content/Widget/ContactBlock.php:112 msgid "View Contacts" msgstr "" @@ -2451,46 +2451,46 @@ msgstr[1] "" msgid "More Trending Tags" msgstr "" -#: src/Content/Widget/VCard.php:91 src/Model/Contact.php:1212 +#: src/Content/Widget/VCard.php:90 src/Model/Contact.php:1212 #: src/Model/Profile.php:441 msgid "Post to group" msgstr "" -#: src/Content/Widget/VCard.php:96 src/Model/Contact.php:1216 +#: src/Content/Widget/VCard.php:95 src/Model/Contact.php:1216 #: src/Model/Profile.php:445 src/Module/Moderation/Item/Source.php:77 msgid "Mention" msgstr "" -#: src/Content/Widget/VCard.php:106 src/Model/Profile.php:360 -#: src/Module/Contact/Profile.php:414 src/Module/Profile/Profile.php:187 +#: src/Content/Widget/VCard.php:105 src/Model/Profile.php:360 +#: src/Module/Contact/Profile.php:415 src/Module/Profile/Profile.php:187 msgid "XMPP:" msgstr "" -#: src/Content/Widget/VCard.php:107 src/Model/Profile.php:361 -#: src/Module/Contact/Profile.php:416 src/Module/Profile/Profile.php:191 +#: src/Content/Widget/VCard.php:106 src/Model/Profile.php:361 +#: src/Module/Contact/Profile.php:417 src/Module/Profile/Profile.php:191 msgid "Matrix:" msgstr "" -#: src/Content/Widget/VCard.php:108 src/Model/Event.php:68 +#: src/Content/Widget/VCard.php:107 src/Model/Event.php:68 #: src/Model/Event.php:95 src/Model/Event.php:457 src/Model/Event.php:946 -#: src/Model/Profile.php:355 src/Module/Contact/Profile.php:412 +#: src/Model/Profile.php:355 src/Module/Contact/Profile.php:413 #: src/Module/Directory.php:134 src/Module/Notifications/Introductions.php:179 #: src/Module/Profile/Profile.php:209 msgid "Location:" msgstr "" -#: src/Content/Widget/VCard.php:111 src/Model/Profile.php:469 +#: src/Content/Widget/VCard.php:110 src/Model/Profile.php:469 #: src/Module/Notifications/Introductions.php:193 msgid "Network:" msgstr "" -#: src/Content/Widget/VCard.php:115 src/Model/Contact.php:1244 +#: src/Content/Widget/VCard.php:114 src/Model/Contact.php:1244 #: src/Model/Contact.php:1256 src/Model/Profile.php:458 -#: src/Module/Contact/Profile.php:470 +#: src/Module/Contact/Profile.php:471 msgid "Unfollow" msgstr "" -#: src/Content/Widget/VCard.php:121 src/Model/Contact.php:1214 +#: src/Content/Widget/VCard.php:120 src/Model/Contact.php:1214 #: src/Model/Profile.php:443 msgid "View group" msgstr "" @@ -3481,7 +3481,7 @@ msgstr "" msgid "Homepage:" msgstr "" -#: src/Model/Profile.php:359 src/Module/Contact/Profile.php:418 +#: src/Model/Profile.php:359 src/Module/Contact/Profile.php:419 #: src/Module/Notifications/Introductions.php:181 msgid "About:" msgstr "" @@ -4198,7 +4198,7 @@ msgid "Data" msgstr "" #: src/Module/Admin/Logs/View.php:86 -#: src/Module/Debug/ActivityPubConversion.php:49 +#: src/Module/Debug/ActivityPubConversion.php:45 msgid "Source" msgstr "" @@ -5175,7 +5175,7 @@ msgstr "" msgid "Can be \"all\" or \"tags\". \"all\" means that every public post should be received. \"tags\" means that only posts with selected tags should be received." msgstr "" -#: src/Module/Admin/Site.php:584 src/Module/Contact/Profile.php:314 +#: src/Module/Admin/Site.php:584 src/Module/Contact/Profile.php:315 #: src/Module/Settings/TwoFactor/Index.php:132 msgid "Disabled" msgstr "" @@ -5628,7 +5628,7 @@ msgstr "" msgid "Babel" msgstr "" -#: src/Module/BaseAdmin.php:97 src/Module/Debug/ActivityPubConversion.php:129 +#: src/Module/BaseAdmin.php:97 src/Module/Debug/ActivityPubConversion.php:121 msgid "ActivityPub Conversion" msgstr "" @@ -5928,8 +5928,8 @@ msgstr "" #: src/Module/Contact/Conversations.php:77 #: src/Module/Contact/Conversations.php:82 src/Module/Contact/Media.php:47 #: src/Module/Contact/Posts.php:64 src/Module/Contact/Posts.php:69 -#: src/Module/Contact/Posts.php:74 src/Module/Contact/Profile.php:145 -#: src/Module/Contact/Profile.php:150 src/Module/Contact/Profile.php:169 +#: src/Module/Contact/Posts.php:74 src/Module/Contact/Profile.php:146 +#: src/Module/Contact/Profile.php:151 src/Module/Contact/Profile.php:170 #: src/Module/Contact/Redir.php:77 src/Module/Contact/Redir.php:131 #: src/Module/FriendSuggest.php:57 src/Module/FriendSuggest.php:95 msgid "Contact not found." @@ -6086,18 +6086,18 @@ msgstr "" msgid "Update" msgstr "" -#: src/Module/Contact.php:449 src/Module/Contact/Profile.php:518 +#: src/Module/Contact.php:449 src/Module/Contact/Profile.php:519 #: src/Module/Moderation/Blocklist/Contact.php:103 #: src/Module/Moderation/Users/Blocked.php:124 #: src/Module/Moderation/Users/Index.php:140 msgid "Unblock" msgstr "" -#: src/Module/Contact.php:450 src/Module/Contact/Profile.php:526 +#: src/Module/Contact.php:450 src/Module/Contact/Profile.php:527 msgid "Unignore" msgstr "" -#: src/Module/Contact.php:451 src/Module/Contact/Profile.php:534 +#: src/Module/Contact.php:451 src/Module/Contact/Profile.php:535 msgid "Uncollapse" msgstr "" @@ -6149,7 +6149,7 @@ msgstr "" msgid "Pending incoming contact request" msgstr "" -#: src/Module/Contact.php:608 src/Module/Contact/Profile.php:377 +#: src/Module/Contact.php:608 src/Module/Contact/Profile.php:378 #, php-format msgid "Visit %s's profile [%s]" msgstr "" @@ -6246,7 +6246,7 @@ msgstr[1] "" #: src/Module/Contact/Follow.php:56 src/Module/Contact/Redir.php:45 #: src/Module/Contact/Redir.php:206 src/Module/Conversation/Community.php:154 -#: src/Module/Debug/ItemBody.php:24 src/Module/Diaspora/Receive.php:45 +#: src/Module/Debug/ItemBody.php:30 src/Module/Diaspora/Receive.php:45 #: src/Module/Item/Display.php:82 src/Module/Item/Feed.php:45 #: src/Module/Item/Follow.php:27 src/Module/Item/Ignore.php:27 #: src/Module/Item/Language.php:39 src/Module/Item/Pin.php:27 @@ -6280,7 +6280,7 @@ msgstr "" msgid "Your Identity Address:" msgstr "" -#: src/Module/Contact/Follow.php:151 src/Module/Contact/Profile.php:408 +#: src/Module/Contact/Follow.php:151 src/Module/Contact/Profile.php:409 #: src/Module/Contact/Unfollow.php:115 #: src/Module/Moderation/Blocklist/Contact.php:117 #: src/Module/Moderation/Reports.php:109 @@ -6289,7 +6289,7 @@ msgstr "" msgid "Profile URL" msgstr "" -#: src/Module/Contact/Follow.php:152 src/Module/Contact/Profile.php:420 +#: src/Module/Contact/Follow.php:152 src/Module/Contact/Profile.php:421 #: src/Module/Notifications/Introductions.php:183 #: src/Module/Profile/Profile.php:222 msgid "Tags:" @@ -6332,297 +6332,297 @@ msgstr "" msgid "Failed to update contact record." msgstr "" -#: src/Module/Contact/Profile.php:195 +#: src/Module/Contact/Profile.php:196 msgid "Contact has been unblocked" msgstr "" -#: src/Module/Contact/Profile.php:199 +#: src/Module/Contact/Profile.php:200 msgid "Contact has been blocked" msgstr "" -#: src/Module/Contact/Profile.php:211 +#: src/Module/Contact/Profile.php:212 msgid "Contact has been unignored" msgstr "" -#: src/Module/Contact/Profile.php:215 +#: src/Module/Contact/Profile.php:216 msgid "Contact has been ignored" msgstr "" -#: src/Module/Contact/Profile.php:227 +#: src/Module/Contact/Profile.php:228 msgid "Contact has been uncollapsed" msgstr "" -#: src/Module/Contact/Profile.php:231 +#: src/Module/Contact/Profile.php:232 msgid "Contact has been collapsed" msgstr "" -#: src/Module/Contact/Profile.php:259 -#, php-format -msgid "You are mutual friends with %s" -msgstr "" - #: src/Module/Contact/Profile.php:260 #, php-format -msgid "You are sharing with %s" +msgid "You are mutual friends with %s" msgstr "" #: src/Module/Contact/Profile.php:261 #, php-format +msgid "You are sharing with %s" +msgstr "" + +#: src/Module/Contact/Profile.php:262 +#, php-format msgid "%s is sharing with you" msgstr "" -#: src/Module/Contact/Profile.php:277 +#: src/Module/Contact/Profile.php:278 msgid "Private communications are not available for this contact." msgstr "" -#: src/Module/Contact/Profile.php:287 +#: src/Module/Contact/Profile.php:288 msgid "This contact is on a server you ignored." msgstr "" -#: src/Module/Contact/Profile.php:290 +#: src/Module/Contact/Profile.php:291 msgid "Never" msgstr "" -#: src/Module/Contact/Profile.php:293 +#: src/Module/Contact/Profile.php:294 msgid "(Update was not successful)" msgstr "" -#: src/Module/Contact/Profile.php:293 +#: src/Module/Contact/Profile.php:294 msgid "(Update was successful)" msgstr "" -#: src/Module/Contact/Profile.php:295 src/Module/Contact/Profile.php:489 +#: src/Module/Contact/Profile.php:296 src/Module/Contact/Profile.php:490 msgid "Suggest friends" msgstr "" -#: src/Module/Contact/Profile.php:299 +#: src/Module/Contact/Profile.php:300 #, php-format msgid "Network type: %s" msgstr "" -#: src/Module/Contact/Profile.php:304 +#: src/Module/Contact/Profile.php:305 msgid "Communications lost with this contact!" msgstr "" -#: src/Module/Contact/Profile.php:310 +#: src/Module/Contact/Profile.php:311 msgid "Fetch further information for feeds" msgstr "" -#: src/Module/Contact/Profile.php:312 +#: src/Module/Contact/Profile.php:313 msgid "Fetch information like preview pictures, title and teaser from the feed item. You can activate this if the feed doesn't contain much text. Keywords are taken from the meta header in the feed item and are posted as hash tags." msgstr "" -#: src/Module/Contact/Profile.php:315 +#: src/Module/Contact/Profile.php:316 msgid "Fetch information" msgstr "" -#: src/Module/Contact/Profile.php:316 +#: src/Module/Contact/Profile.php:317 msgid "Fetch keywords" msgstr "" -#: src/Module/Contact/Profile.php:317 +#: src/Module/Contact/Profile.php:318 msgid "Fetch information and keywords" msgstr "" -#: src/Module/Contact/Profile.php:327 src/Module/Contact/Profile.php:332 -#: src/Module/Contact/Profile.php:337 src/Module/Contact/Profile.php:343 +#: src/Module/Contact/Profile.php:328 src/Module/Contact/Profile.php:333 +#: src/Module/Contact/Profile.php:338 src/Module/Contact/Profile.php:344 msgid "No mirroring" msgstr "" -#: src/Module/Contact/Profile.php:328 src/Module/Contact/Profile.php:338 -#: src/Module/Contact/Profile.php:344 +#: src/Module/Contact/Profile.php:329 src/Module/Contact/Profile.php:339 +#: src/Module/Contact/Profile.php:345 msgid "Mirror as my own posting" msgstr "" -#: src/Module/Contact/Profile.php:333 src/Module/Contact/Profile.php:339 +#: src/Module/Contact/Profile.php:334 src/Module/Contact/Profile.php:340 msgid "Native reshare" msgstr "" -#: src/Module/Contact/Profile.php:359 +#: src/Module/Contact/Profile.php:360 msgid "Contact Information / Notes" msgstr "" -#: src/Module/Contact/Profile.php:360 +#: src/Module/Contact/Profile.php:361 msgid "Contact Settings" msgstr "" -#: src/Module/Contact/Profile.php:368 +#: src/Module/Contact/Profile.php:369 msgid "Contact" msgstr "" -#: src/Module/Contact/Profile.php:372 +#: src/Module/Contact/Profile.php:373 msgid "Their personal note" msgstr "" -#: src/Module/Contact/Profile.php:374 +#: src/Module/Contact/Profile.php:375 msgid "Edit contact notes" msgstr "" -#: src/Module/Contact/Profile.php:378 +#: src/Module/Contact/Profile.php:379 msgid "Block/Unblock contact" msgstr "" -#: src/Module/Contact/Profile.php:379 +#: src/Module/Contact/Profile.php:380 #: src/Module/Moderation/Report/Create.php:279 msgid "Ignore contact" msgstr "" -#: src/Module/Contact/Profile.php:380 +#: src/Module/Contact/Profile.php:381 msgid "View conversations" msgstr "" -#: src/Module/Contact/Profile.php:385 +#: src/Module/Contact/Profile.php:386 msgid "Last update:" msgstr "" -#: src/Module/Contact/Profile.php:387 +#: src/Module/Contact/Profile.php:388 msgid "Update public posts" msgstr "" -#: src/Module/Contact/Profile.php:389 src/Module/Contact/Profile.php:499 +#: src/Module/Contact/Profile.php:390 src/Module/Contact/Profile.php:500 msgid "Update now" msgstr "" -#: src/Module/Contact/Profile.php:391 +#: src/Module/Contact/Profile.php:392 msgid "Awaiting connection acknowledge" msgstr "" -#: src/Module/Contact/Profile.php:392 +#: src/Module/Contact/Profile.php:393 msgid "Currently blocked" msgstr "" -#: src/Module/Contact/Profile.php:393 +#: src/Module/Contact/Profile.php:394 msgid "Currently ignored" msgstr "" -#: src/Module/Contact/Profile.php:394 +#: src/Module/Contact/Profile.php:395 msgid "Currently collapsed" msgstr "" -#: src/Module/Contact/Profile.php:395 +#: src/Module/Contact/Profile.php:396 msgid "Currently archived" msgstr "" -#: src/Module/Contact/Profile.php:398 +#: src/Module/Contact/Profile.php:399 msgid "Manage remote servers" msgstr "" -#: src/Module/Contact/Profile.php:400 +#: src/Module/Contact/Profile.php:401 #: src/Module/Notifications/Introductions.php:184 msgid "Hide this contact from others" msgstr "" -#: src/Module/Contact/Profile.php:400 +#: src/Module/Contact/Profile.php:401 msgid "Replies/likes to your public posts may still be visible" msgstr "" -#: src/Module/Contact/Profile.php:401 +#: src/Module/Contact/Profile.php:402 msgid "Notification for new posts" msgstr "" -#: src/Module/Contact/Profile.php:401 +#: src/Module/Contact/Profile.php:402 msgid "Send a notification of every new post of this contact" msgstr "" -#: src/Module/Contact/Profile.php:403 +#: src/Module/Contact/Profile.php:404 msgid "Keyword Deny List" msgstr "" -#: src/Module/Contact/Profile.php:403 +#: src/Module/Contact/Profile.php:404 msgid "Comma separated list of keywords that should not be converted to hashtags, when \"Fetch information and keywords\" is selected" msgstr "" -#: src/Module/Contact/Profile.php:421 +#: src/Module/Contact/Profile.php:422 #: src/Module/Settings/TwoFactor/Index.php:146 msgid "Actions" msgstr "" -#: src/Module/Contact/Profile.php:423 +#: src/Module/Contact/Profile.php:424 #: src/Module/Settings/TwoFactor/Index.php:126 view/theme/frio/theme.php:220 msgid "Status" msgstr "" -#: src/Module/Contact/Profile.php:429 +#: src/Module/Contact/Profile.php:430 msgid "Mirror postings from this contact" msgstr "" -#: src/Module/Contact/Profile.php:431 +#: src/Module/Contact/Profile.php:432 msgid "Mark this contact as remote_self, this will cause friendica to repost new entries from this contact." msgstr "" -#: src/Module/Contact/Profile.php:434 +#: src/Module/Contact/Profile.php:435 msgid "Channel Settings" msgstr "" -#: src/Module/Contact/Profile.php:435 +#: src/Module/Contact/Profile.php:436 msgid "Frequency of this contact in relevant channels" msgstr "" -#: src/Module/Contact/Profile.php:436 +#: src/Module/Contact/Profile.php:437 msgid "Depending on the type of the channel not all posts from this contact are displayed. By default, posts need to have a minimum amount of interactions (comments, likes) to show in your channels. On the other hand there can be contacts who flood the channel, so you might want to see only some of their posts. Or you don't want to see their content at all, but you don't want to block or hide the contact completely." msgstr "" -#: src/Module/Contact/Profile.php:437 +#: src/Module/Contact/Profile.php:438 msgid "Default frequency" msgstr "" -#: src/Module/Contact/Profile.php:437 +#: src/Module/Contact/Profile.php:438 msgid "Posts by this contact are displayed in the \"for you\" channel if you interact often with this contact or if a post reached some level of interaction." msgstr "" -#: src/Module/Contact/Profile.php:438 +#: src/Module/Contact/Profile.php:439 msgid "Display all posts of this contact" msgstr "" -#: src/Module/Contact/Profile.php:438 +#: src/Module/Contact/Profile.php:439 msgid "All posts from this contact will appear on the \"for you\" channel" msgstr "" -#: src/Module/Contact/Profile.php:439 +#: src/Module/Contact/Profile.php:440 msgid "Display only few posts" msgstr "" -#: src/Module/Contact/Profile.php:439 +#: src/Module/Contact/Profile.php:440 msgid "When a contact creates a lot of posts in a short period, this setting reduces the number of displayed posts in every channel." msgstr "" -#: src/Module/Contact/Profile.php:440 +#: src/Module/Contact/Profile.php:441 msgid "Never display posts" msgstr "" -#: src/Module/Contact/Profile.php:440 +#: src/Module/Contact/Profile.php:441 msgid "Posts from this contact will never be displayed in any channel" msgstr "" -#: src/Module/Contact/Profile.php:441 +#: src/Module/Contact/Profile.php:442 msgid "Channel Only" msgstr "" -#: src/Module/Contact/Profile.php:441 +#: src/Module/Contact/Profile.php:442 msgid "If enabled, posts from this contact will only appear in channels and network streams in circles, but not in the general network stream." msgstr "" -#: src/Module/Contact/Profile.php:509 +#: src/Module/Contact/Profile.php:510 msgid "Refetch contact data" msgstr "" -#: src/Module/Contact/Profile.php:520 +#: src/Module/Contact/Profile.php:521 msgid "Toggle Blocked status" msgstr "" -#: src/Module/Contact/Profile.php:528 +#: src/Module/Contact/Profile.php:529 msgid "Toggle Ignored status" msgstr "" -#: src/Module/Contact/Profile.php:536 +#: src/Module/Contact/Profile.php:537 msgid "Toggle Collapsed status" msgstr "" -#: src/Module/Contact/Profile.php:543 src/Module/Contact/Revoke.php:89 +#: src/Module/Contact/Profile.php:544 src/Module/Contact/Revoke.php:89 msgid "Revoke Follow" msgstr "" -#: src/Module/Contact/Profile.php:545 +#: src/Module/Contact/Profile.php:546 msgid "Revoke the follow from this contact" msgstr "" @@ -6722,207 +6722,199 @@ msgstr "" msgid "Friendica is a community project, that would not be possible without the help of many people. Here is a list of those who have contributed to the code or the translation of Friendica. Thank you all!" msgstr "" -#: src/Module/Debug/ActivityPubConversion.php:45 +#: src/Module/Debug/ActivityPubConversion.php:41 msgid "Formatted" msgstr "" -#: src/Module/Debug/ActivityPubConversion.php:57 +#: src/Module/Debug/ActivityPubConversion.php:53 msgid "Activity" msgstr "" -#: src/Module/Debug/ActivityPubConversion.php:109 +#: src/Module/Debug/ActivityPubConversion.php:101 msgid "Object data" msgstr "" -#: src/Module/Debug/ActivityPubConversion.php:116 +#: src/Module/Debug/ActivityPubConversion.php:108 msgid "Result Item" msgstr "" -#: src/Module/Debug/ActivityPubConversion.php:121 -#: src/Module/Debug/Babel.php:286 src/Module/Moderation/Item/Source.php:79 +#: src/Module/Debug/ActivityPubConversion.php:113 +#: src/Module/Debug/Babel.php:262 src/Module/Moderation/Item/Source.php:79 #: src/Module/Security/TwoFactor/Verify.php:84 msgid "Error" msgid_plural "Errors" msgstr[0] "" msgstr[1] "" -#: src/Module/Debug/ActivityPubConversion.php:130 +#: src/Module/Debug/ActivityPubConversion.php:122 msgid "Source activity" msgstr "" -#: src/Module/Debug/Babel.php:44 +#: src/Module/Debug/Babel.php:39 msgid "Source input" msgstr "" -#: src/Module/Debug/Babel.php:50 +#: src/Module/Debug/Babel.php:45 msgid "BBCode::toPlaintext" msgstr "" -#: src/Module/Debug/Babel.php:56 +#: src/Module/Debug/Babel.php:51 msgid "BBCode::convert (raw HTML)" msgstr "" -#: src/Module/Debug/Babel.php:61 +#: src/Module/Debug/Babel.php:56 msgid "BBCode::convert (hex)" msgstr "" -#: src/Module/Debug/Babel.php:66 +#: src/Module/Debug/Babel.php:61 msgid "BBCode::convert" msgstr "" -#: src/Module/Debug/Babel.php:72 +#: src/Module/Debug/Babel.php:67 msgid "BBCode::convert => HTML::toBBCode" msgstr "" -#: src/Module/Debug/Babel.php:78 +#: src/Module/Debug/Babel.php:73 msgid "BBCode::toMarkdown" msgstr "" -#: src/Module/Debug/Babel.php:84 +#: src/Module/Debug/Babel.php:79 msgid "BBCode::toMarkdown => Markdown::convert (raw HTML)" msgstr "" -#: src/Module/Debug/Babel.php:88 +#: src/Module/Debug/Babel.php:83 msgid "BBCode::toMarkdown => Markdown::convert" msgstr "" -#: src/Module/Debug/Babel.php:94 +#: src/Module/Debug/Babel.php:89 msgid "BBCode::toMarkdown => Markdown::toBBCode" msgstr "" -#: src/Module/Debug/Babel.php:100 +#: src/Module/Debug/Babel.php:95 msgid "BBCode::toMarkdown => Markdown::convert => HTML::toBBCode" msgstr "" -#: src/Module/Debug/Babel.php:108 +#: src/Module/Debug/Babel.php:103 msgid "Item Body" msgstr "" -#: src/Module/Debug/Babel.php:112 +#: src/Module/Debug/Babel.php:107 msgid "Item Tags" msgstr "" -#: src/Module/Debug/Babel.php:118 +#: src/Module/Debug/Babel.php:113 msgid "PageInfo::appendToBody" msgstr "" -#: src/Module/Debug/Babel.php:123 +#: src/Module/Debug/Babel.php:118 msgid "PageInfo::appendToBody => BBCode::convert (raw HTML)" msgstr "" -#: src/Module/Debug/Babel.php:127 +#: src/Module/Debug/Babel.php:122 msgid "PageInfo::appendToBody => BBCode::convert" msgstr "" -#: src/Module/Debug/Babel.php:134 +#: src/Module/Debug/Babel.php:129 msgid "Source input (Diaspora format)" msgstr "" -#: src/Module/Debug/Babel.php:143 +#: src/Module/Debug/Babel.php:138 msgid "Source input (Markdown)" msgstr "" -#: src/Module/Debug/Babel.php:149 +#: src/Module/Debug/Babel.php:144 msgid "Markdown::convert (raw HTML)" msgstr "" -#: src/Module/Debug/Babel.php:154 +#: src/Module/Debug/Babel.php:149 msgid "Markdown::convert" msgstr "" -#: src/Module/Debug/Babel.php:160 +#: src/Module/Debug/Babel.php:155 msgid "Markdown::toBBCode" msgstr "" -#: src/Module/Debug/Babel.php:167 +#: src/Module/Debug/Babel.php:162 msgid "Raw HTML input" msgstr "" -#: src/Module/Debug/Babel.php:172 +#: src/Module/Debug/Babel.php:167 msgid "HTML Input" msgstr "" -#: src/Module/Debug/Babel.php:179 +#: src/Module/Debug/Babel.php:174 msgid "HTML Purified (raw)" msgstr "" -#: src/Module/Debug/Babel.php:184 +#: src/Module/Debug/Babel.php:179 msgid "HTML Purified (hex)" msgstr "" -#: src/Module/Debug/Babel.php:189 +#: src/Module/Debug/Babel.php:184 msgid "HTML Purified" msgstr "" -#: src/Module/Debug/Babel.php:195 +#: src/Module/Debug/Babel.php:190 msgid "HTML::toBBCode" msgstr "" -#: src/Module/Debug/Babel.php:201 +#: src/Module/Debug/Babel.php:196 msgid "HTML::toBBCode => BBCode::convert" msgstr "" -#: src/Module/Debug/Babel.php:206 +#: src/Module/Debug/Babel.php:201 msgid "HTML::toBBCode => BBCode::convert (raw HTML)" msgstr "" -#: src/Module/Debug/Babel.php:212 +#: src/Module/Debug/Babel.php:207 msgid "HTML::toBBCode => BBCode::toPlaintext" msgstr "" -#: src/Module/Debug/Babel.php:218 +#: src/Module/Debug/Babel.php:213 msgid "HTML::toMarkdown" msgstr "" -#: src/Module/Debug/Babel.php:224 +#: src/Module/Debug/Babel.php:219 msgid "HTML::toPlaintext" msgstr "" -#: src/Module/Debug/Babel.php:230 +#: src/Module/Debug/Babel.php:225 msgid "HTML::toPlaintext (compact)" msgstr "" -#: src/Module/Debug/Babel.php:248 +#: src/Module/Debug/Babel.php:238 msgid "Decoded post" msgstr "" -#: src/Module/Debug/Babel.php:269 +#: src/Module/Debug/Babel.php:257 msgid "Post array before expand entities" msgstr "" -#: src/Module/Debug/Babel.php:276 -msgid "Post converted" -msgstr "" - -#: src/Module/Debug/Babel.php:281 -msgid "Converted body" -msgstr "" - -#: src/Module/Debug/Babel.php:287 +#: src/Module/Debug/Babel.php:263 msgid "Twitter addon is absent from the addon/ folder." msgstr "" -#: src/Module/Debug/Babel.php:297 +#: src/Module/Debug/Babel.php:273 msgid "Babel Diagnostic" msgstr "" -#: src/Module/Debug/Babel.php:299 +#: src/Module/Debug/Babel.php:275 msgid "Source text" msgstr "" -#: src/Module/Debug/Babel.php:300 +#: src/Module/Debug/Babel.php:276 msgid "BBCode" msgstr "" -#: src/Module/Debug/Babel.php:302 +#: src/Module/Debug/Babel.php:278 msgid "Markdown" msgstr "" -#: src/Module/Debug/Babel.php:303 +#: src/Module/Debug/Babel.php:279 msgid "HTML" msgstr "" -#: src/Module/Debug/Babel.php:305 +#: src/Module/Debug/Babel.php:281 msgid "Twitter Source / Tweet URL (requires API key)" msgstr ""