diff --git a/.editorconfig b/.editorconfig index 8565b274..ef6e90b2 100644 --- a/.editorconfig +++ b/.editorconfig @@ -27,3 +27,6 @@ indent_size = 2 [*.json] indent_style = space indent_size = 2 + +[composer.json] +indent_size = 4 diff --git a/.woodpecker/.code_standards_check.yml b/.woodpecker/.code_standards_check.yml index 9d59dc08..60a1bd2a 100644 --- a/.woodpecker/.code_standards_check.yml +++ b/.woodpecker/.code_standards_check.yml @@ -1,9 +1,12 @@ skip_clone: true -pipeline: +steps: clone_friendica_base: image: alpine/git commands: + - git config --global user.email "no-reply@friendi.ca" + - git config --global user.name "Friendica" + - git config --global --add safe.directory $CI_WORKSPACE - git clone https://github.com/friendica/friendica.git . - git checkout $CI_COMMIT_BRANCH when: @@ -13,7 +16,7 @@ pipeline: commands: - git config --global user.email "no-reply@friendi.ca" - git config --global user.name "Friendica" - - git clone $CI_REPO_LINK addon + - git clone $CI_REPO_CLONE_URL addon - cd addon/ - git checkout $CI_COMMIT_BRANCH - git fetch origin $CI_COMMIT_REF @@ -53,6 +56,10 @@ pipeline: - /tmp/drone-cache:/tmp/cache when: event: pull_request + phpstan: + image: friendicaci/php8.3:php8.3.3 + commands: + - ./bin/composer.phar run phpstan; check: image: friendicaci/php-cs commands: diff --git a/.woodpecker/.continuous-deployment-allinone.yml b/.woodpecker/.continuous-deployment-allinone.yml new file mode 100644 index 00000000..8d608db8 --- /dev/null +++ b/.woodpecker/.continuous-deployment-allinone.yml @@ -0,0 +1,115 @@ +# This prevents executing this pipeline at other servers than ci.friendi.ca +labels: + location: friendica + type: releaser + +skip_clone: true + +steps: + clone_friendica_base: + image: alpine/git + commands: + - git config --global user.email "no-reply@friendi.ca" + - git config --global user.name "Friendica" + - git config --global --add safe.directory $CI_WORKSPACE + - git clone https://github.com/friendica/friendica.git . + - git checkout $CI_COMMIT_BRANCH + when: + repo: friendica/friendica-addons + branch: [ develop, '*-rc' ] + event: push + clone_friendica_addon: + image: alpine/git + commands: + - git config --global user.email "no-reply@friendi.ca" + - git config --global user.name "Friendica" + - git clone $CI_REPO_CLONE_URL addon + - cd addon/ + - git checkout $CI_COMMIT_BRANCH + - git fetch origin $CI_COMMIT_REF + - git merge $CI_COMMIT_SHA + when: + repo: friendica/friendica-addons + branch: [ develop, '*-rc' ] + event: push + restore_cache: + image: meltwater/drone-cache:dev + settings: + backend: "filesystem" + restore: true + cache_key: "{{ .Repo.Name }}_php7.4_{{ arch }}_{{ os }}" + archive_format: "gzip" + mount: + - '.composer' + volumes: + - /tmp/drone-cache:/tmp/cache + when: + repo: friendica/friendica-addons + branch: [ develop, '*-rc' ] + event: push + composer_install: + image: friendicaci/php8.2:php8.2.28 + commands: + - export COMPOSER_HOME=.composer + - composer validate + - composer install --no-dev --optimize-autoloader + volumes: + - /etc/hosts:/etc/hosts + when: + repo: friendica/friendica-addons + branch: [ develop, '*-rc' ] + event: push + create_artifacts: + image: debian + commands: + - apt-get update + - apt-get install bzip2 + - mkdir ./build + - export VERSION="$(cat VERSION)" + - export RELEASE="friendica-all-in-one-$VERSION" + - export ARTIFACT="$RELEASE.tar.gz" + - tar + --exclude='.tx' + --exclude='.git' + --exclude='.editorconfig' + --exclude='.gitattributes' + --exclude='.gitignore' + --exclude='.woodpecker' + --exclude='**/*/messages.po' + -cvzf ./build/$ARTIFACT / + - cd ./build + - sha256sum "$ARTIFACT" > "$ARTIFACT.sum256" + - chmod 664 ./* + - ls -lh + - cat "$ARTIFACT.sum256" + - sha256sum "$ARTIFACT" + when: + repo: friendica/friendica-addons + branch: [ develop, '*-rc' ] + event: push + sign_artifacts: + image: plugins/gpgsign + settings: + key: + from_secret: gpg_key + passphrase: + from_secret: gpg_password + files: + - build/* + exclude: + - build/*.sum256 + detach_sign: true + when: + repo: friendica/friendica-addons + branch: [ develop, '*-rc' ] + event: push + publish_artifacts: + image: alpine + commands: + - cp -fr build/* /tmp/friendica_files/ + volumes: + - files:/tmp/friendica_files + when: + repo: friendica/friendica-addons + branch: [ develop, '*-rc' ] + event: push diff --git a/.woodpecker/.continuous-deployment.yml b/.woodpecker/.continuous-deployment.yml index ab6e07e9..d6d8a22a 100644 --- a/.woodpecker/.continuous-deployment.yml +++ b/.woodpecker/.continuous-deployment.yml @@ -5,10 +5,13 @@ labels: skip_clone: true -pipeline: +steps: clone_friendica_base: image: alpine/git commands: + - git config --global user.email "no-reply@friendi.ca" + - git config --global user.name "Friendica" + - git config --global --add safe.directory $CI_WORKSPACE - git clone https://github.com/friendica/friendica.git . - git checkout $CI_COMMIT_BRANCH when: @@ -20,7 +23,7 @@ pipeline: commands: - git config --global user.email "no-reply@friendi.ca" - git config --global user.name "Friendica" - - git clone $CI_REPO_LINK addon + - git clone $CI_REPO_CLONE_URL addon - cd addon/ - git checkout $CI_COMMIT_BRANCH - git fetch origin $CI_COMMIT_REF @@ -45,7 +48,7 @@ pipeline: branch: [ develop, '*-rc' ] event: push composer_install: - image: friendicaci/php7.4:php7.4.33 + image: friendicaci/php8.2:php8.2.28 commands: - export COMPOSER_HOME=.composer - composer validate diff --git a/.woodpecker/.messages.po_check.yml b/.woodpecker/.messages.po_check.yml index f5691e00..e0239dcd 100644 --- a/.woodpecker/.messages.po_check.yml +++ b/.woodpecker/.messages.po_check.yml @@ -1,9 +1,12 @@ skip_clone: true -pipeline: +steps: clone_friendica_base: image: alpine/git commands: + - git config --global user.email "no-reply@friendi.ca" + - git config --global user.name "Friendica" + - git config --global --add safe.directory $CI_WORKSPACE - git clone https://github.com/friendica/friendica.git . - git checkout $CI_COMMIT_BRANCH when: @@ -13,7 +16,7 @@ pipeline: commands: - git config --global user.email "no-reply@friendi.ca" - git config --global user.name "Friendica" - - git clone $CI_REPO_LINK addon + - git clone $CI_REPO_CLONE_URL addon - cd addon/ - git checkout $CI_COMMIT_BRANCH - git fetch origin $CI_COMMIT_REF diff --git a/.woodpecker/.phpunit.yml b/.woodpecker/.phpunit.yml new file mode 100644 index 00000000..b0745ad0 --- /dev/null +++ b/.woodpecker/.phpunit.yml @@ -0,0 +1,120 @@ +matrix: + include: + - PHP_MAJOR_VERSION: 7.4 + PHP_VERSION: 7.4.33 + - PHP_MAJOR_VERSION: 8.0 + PHP_VERSION: 8.0.30 + - PHP_MAJOR_VERSION: 8.1 + PHP_VERSION: 8.1.31 + - PHP_MAJOR_VERSION: 8.2 + PHP_VERSION: 8.2.28 + - PHP_MAJOR_VERSION: 8.3 + PHP_VERSION: 8.3.17 + - PHP_MAJOR_VERSION: 8.4 + PHP_VERSION: 8.4.5 + +# This forces PHP Unit executions at the "opensocial" labeled location (because of much more power...) +labels: + location: opensocial + +skip_clone: true + +steps: + clone_friendica_base: + image: alpine/git + commands: + - git config --global user.email "no-reply@friendi.ca" + - git config --global user.name "Friendica" + - git config --global --add safe.directory $CI_WORKSPACE + - git clone https://github.com/friendica/friendica.git . + - git checkout $CI_COMMIT_BRANCH + clone_friendica_addon: + image: alpine/git + commands: + - git config --global user.email "no-reply@friendi.ca" + - git config --global user.name "Friendica" + - git clone $CI_REPO_CLONE_URL addon + - cd addon/ + - git checkout $CI_COMMIT_BRANCH + - git fetch origin $CI_COMMIT_REF + - git merge $CI_COMMIT_SHA + restore_cache: + image: meltwater/drone-cache:dev + settings: + backend: "filesystem" + restore: true + cache_key: "{{ .Repo.Name }}_php${PHP_MAJOR_VERSION}_{{ arch }}_{{ os }}" + archive_format: "gzip" + mount: + - '.composer' + volumes: + - /tmp/drone-cache:/tmp/cache + composer_install: + image: friendicaci/php${PHP_MAJOR_VERSION}:php${PHP_VERSION} + commands: + - export COMPOSER_HOME=.composer + - ./bin/composer.phar validate + - ./bin/composer.phar install --prefer-dist + volumes: + - /etc/hosts:/etc/hosts + rebuild_cache: + image: meltwater/drone-cache:dev + settings: + backend: "filesystem" + rebuild: true + cache_key: "{{ .Repo.Name }}_php${PHP_MAJOR_VERSION}_{{ arch }}_{{ os }}" + archive_format: "gzip" + mount: + - '.composer' + volumes: + - /tmp/drone-cache:/tmp/cache + test: + image: friendicaci/php${PHP_MAJOR_VERSION}:php${PHP_VERSION} + environment: + MYSQL_HOST: "mariadb" + MYSQL_PORT: "3306" + MYSQL_DATABASE: "test" + MYSQL_PASSWORD: "test" + MYSQL_USER: "test" + REDIS_HOST: "redis" + MEMCACHED_HOST: "memcached" + MEMCACHE_HOST: "memcached" + commands: + - cp config/local-sample.config.php config/local.config.php + - if ! bin/wait-for-connection $MYSQL_HOST $MYSQL_PORT 300; then echo "[ERROR] Waited 300 seconds, no response" >&2; exit 1; fi + - mysql -h$MYSQL_HOST -P$MYSQL_PORT -p$MYSQL_PASSWORD -u$MYSQL_USER $MYSQL_DATABASE < database.sql + - if [ "${PHP_MAJOR_VERSION}" = "8.2" -a "${CI_REPO}" = "friendica/friendica-addons" ]; then + phpenmod xdebug; + export XDEBUG_MODE=coverage; + phpunit --configuration tests/phpunit-addons.xml --coverage-clover clover.xml; + else + phpunit --configuration tests/phpunit-addons.xml; + fi + codecov: + image: friendicaci/codecov + when: + matrix: + PHP_MAJOR_VERSION: 8.2 + PHP_VERSION: 8.2.16 + repo: + - friendica/friendica-addons + commands: + - codecov -R '.' -Z -f 'clover.xml' + environment: + CODECOV_TOKEN: + from_secret: codecov-token + +services: + mariadb: + image: mariadb:latest + environment: + MYSQL_ALLOW_EMPTY_PASSWORD: "true" + MYSQL_DATABASE: "test" + MYSQL_PASSWORD: "test" + MYSQL_USER: "test" + + memcached: + image: memcached + + redis: + image: redis diff --git a/.woodpecker/.releaser.yml b/.woodpecker/.releaser.yml index 4a661937..7407f2bc 100644 --- a/.woodpecker/.releaser.yml +++ b/.woodpecker/.releaser.yml @@ -5,10 +5,13 @@ labels: skip_clone: true -pipeline: +steps: clone_friendica_base: image: alpine/git commands: + - git config --global user.email "no-reply@friendi.ca" + - git config --global user.name "Friendica" + - git config --global --add safe.directory $CI_WORKSPACE - git clone https://github.com/friendica/friendica.git . - git checkout $CI_COMMIT_BRANCH when: @@ -19,7 +22,7 @@ pipeline: commands: - git config --global user.email "no-reply@friendi.ca" - git config --global user.name "Friendica" - - git clone $CI_REPO_LINK addon + - git clone $CI_REPO_CLONE_URL addon - cd addon/ - git checkout $CI_COMMIT_BRANCH - git fetch origin $CI_COMMIT_REF @@ -42,7 +45,7 @@ pipeline: repo: friendica/friendica-addons event: tag composer_install: - image: friendicaci/php7.4:php7.4.33 + image: friendicaci/php8.2:php8.2.28 commands: - export COMPOSER_HOME=.composer - composer validate diff --git a/README.md b/README.md index 6a3202bb..82029288 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,6 @@ See the [documentation](https://github.com/friendica/friendica/blob/stable/doc/A ## Translation Addons can be translated like any other part of Friendica. -Translation for addons is done at [the Transifex Friendica page](https://www.transifex.com/Friendica/friendica/dashboard/). +Translation for addons is done at [the Transifex Friendica page](https://app.transifex.com/Friendica/friendica/dashboard/). Read more about the workflow in the [Friendica translation documentation](https://github.com/friendica/friendica/blob/stable/doc/translations.md#addon). diff --git a/advancedcontentfilter/advancedcontentfilter.js b/advancedcontentfilter/advancedcontentfilter.js index fcf7b096..a8fc1c65 100644 --- a/advancedcontentfilter/advancedcontentfilter.js +++ b/advancedcontentfilter/advancedcontentfilter.js @@ -54,7 +54,7 @@ new Vue({ self.rules.push(responseJSON.rule); self.resetForm(); }, function (response) { - self.errorMessage = response.responseJSON.message; + self.errorMessage = response.responseJSON.exception[0].message; }); } }, @@ -74,7 +74,7 @@ new Vue({ self.rules[self.editedIndex] = rule; self.resetForm(); }, function (response) { - self.errorMessage = response.responseJSON.message; + self.errorMessage = response.responseJSON.exception[0].message; }); }, diff --git a/advancedcontentfilter/advancedcontentfilter.php b/advancedcontentfilter/advancedcontentfilter.php index 2254e587..53cb9ebe 100644 --- a/advancedcontentfilter/advancedcontentfilter.php +++ b/advancedcontentfilter/advancedcontentfilter.php @@ -33,16 +33,13 @@ * */ -use Friendica\App; use Friendica\BaseModule; use Friendica\Content\Text\Markdown; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\Database\DBStructure; use Friendica\DI; -use Friendica\Model\Item; use Friendica\Model\Post; use Friendica\Model\Tag; use Friendica\Model\User; @@ -64,7 +61,7 @@ function advancedcontentfilter_install() Hook::add('dbstructure_definition' , __FILE__, 'advancedcontentfilter_dbstructure_definition'); DBStructure::performUpdate(); - Logger::notice('installed advancedcontentfilter'); + DI::logger()->notice('installed advancedcontentfilter'); } /* @@ -123,21 +120,22 @@ function advancedcontentfilter_prepare_body_content_filter(&$hook_data) $expressionLanguage = new ExpressionLanguage\ExpressionLanguage(); } - if (!DI::userSession()->getLocalUserId()) { + $uid = $hook_data['uid'] ?? DI::userSession()->getLocalUserId(); + if (!$uid) { return; } $vars = advancedcontentfilter_get_filter_fields($hook_data['item']); - $rules = DI::cache()->get('rules_' . DI::userSession()->getLocalUserId()); + $rules = DI::cache()->get('rules_' . $uid); if (!isset($rules)) { $rules = DBA::toArray(DBA::select( 'advancedcontentfilter_rules', ['name', 'expression', 'serialized'], - ['uid' => DI::userSession()->getLocalUserId(), 'active' => true] + ['uid' => $uid, 'active' => true] )); - DI::cache()->set('rules_' . DI::userSession()->getLocalUserId(), $rules); + DI::cache()->set('rules_' . $uid, $rules); } if ($rules) { @@ -190,11 +188,32 @@ function advancedcontentfilter_module() {} function advancedcontentfilter_init() { if (DI::args()->getArgc() > 1 && DI::args()->getArgv()[1] == 'api') { - $slim = new \Slim\App(); + $slim = \Slim\Factory\AppFactory::create(); - require __DIR__ . '/src/middlewares.php'; + /** + * The routing middleware should be added before the ErrorMiddleware + * Otherwise exceptions thrown from it will not be handled + */ + $slim->addRoutingMiddleware(); + + $slim->addErrorMiddleware(true, true, true, DI::logger()); + + // register routes + $slim->group('/advancedcontentfilter/api', function (\Slim\Routing\RouteCollectorProxy $app) { + $app->group('/rules', function (\Slim\Routing\RouteCollectorProxy $app) { + $app->get('', 'advancedcontentfilter_get_rules'); + $app->post('', 'advancedcontentfilter_post_rules'); + + $app->get('/{id}', 'advancedcontentfilter_get_rules_id'); + $app->put('/{id}', 'advancedcontentfilter_put_rules_id'); + $app->delete('/{id}', 'advancedcontentfilter_delete_rules_id'); + }); + + $app->group('/variables', function (\Slim\Routing\RouteCollectorProxy $app) { + $app->get('/{guid}', 'advancedcontentfilter_get_variables_guid'); + }); + }); - require __DIR__ . '/src/routes.php'; $slim->run(); exit; @@ -252,8 +271,8 @@ function advancedcontentfilter_content() 'rule_expression' => DI::l10n()->t('Rule Expression'), 'cancel' => DI::l10n()->t('Cancel'), ], - '$current_theme' => DI::app()->getCurrentTheme(), - '$rules' => advancedcontentfilter_get_rules(), + '$current_theme' => DI::appHelper()->getCurrentTheme(), + '$rules' => DBA::toArray(DBA::select('advancedcontentfilter_rules', [], ['uid' => DI::userSession()->getLocalUserId()])), '$form_security_token' => BaseModule::getFormSecurityToken() ]); } @@ -305,7 +324,7 @@ function advancedcontentfilter_build_fields($data) * API */ -function advancedcontentfilter_get_rules() +function advancedcontentfilter_get_rules(ServerRequestInterface $request, ResponseInterface $response): ResponseInterface { if (!DI::userSession()->getLocalUserId()) { throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this method')); @@ -313,7 +332,8 @@ function advancedcontentfilter_get_rules() $rules = DBA::toArray(DBA::select('advancedcontentfilter_rules', [], ['uid' => DI::userSession()->getLocalUserId()])); - return json_encode($rules); + $response->getBody()->write(json_encode($rules)); + return $response->withHeader('Content-Type', 'application/json'); } function advancedcontentfilter_get_rules_id(ServerRequestInterface $request, ResponseInterface $response, $args) @@ -324,10 +344,11 @@ function advancedcontentfilter_get_rules_id(ServerRequestInterface $request, Res $rule = DBA::selectFirst('advancedcontentfilter_rules', [], ['id' => $args['id'], 'uid' => DI::userSession()->getLocalUserId()]); - return json_encode($rule); + $response->getBody()->write(json_encode($rule)); + return $response->withHeader('Content-Type', 'application/json'); } -function advancedcontentfilter_post_rules(ServerRequestInterface $request) +function advancedcontentfilter_post_rules(ServerRequestInterface $request, ResponseInterface $response) { if (!DI::userSession()->getLocalUserId()) { throw new HTTPException\UnauthorizedException(DI::l10n()->t('You must be logged in to use this method')); @@ -360,7 +381,8 @@ function advancedcontentfilter_post_rules(ServerRequestInterface $request) DI::cache()->delete('rules_' . DI::userSession()->getLocalUserId()); - return json_encode(['message' => DI::l10n()->t('Rule successfully added'), 'rule' => $rule]); + $response->getBody()->write(json_encode(['message' => DI::l10n()->t('Rule successfully added'), 'rule' => $rule])); + return $response->withHeader('Content-Type', 'application/json'); } function advancedcontentfilter_put_rules_id(ServerRequestInterface $request, ResponseInterface $response, $args) @@ -391,7 +413,8 @@ function advancedcontentfilter_put_rules_id(ServerRequestInterface $request, Res DI::cache()->delete('rules_' . DI::userSession()->getLocalUserId()); - return json_encode(['message' => DI::l10n()->t('Rule successfully updated')]); + $response->getBody()->write(json_encode(['message' => DI::l10n()->t('Rule successfully updated')])); + return $response->withHeader('Content-Type', 'application/json'); } function advancedcontentfilter_delete_rules_id(ServerRequestInterface $request, ResponseInterface $response, $args) @@ -414,7 +437,8 @@ function advancedcontentfilter_delete_rules_id(ServerRequestInterface $request, DI::cache()->delete('rules_' . DI::userSession()->getLocalUserId()); - return json_encode(['message' => DI::l10n()->t('Rule successfully deleted')]); + $response->getBody()->write(json_encode(['message' => DI::l10n()->t('Rule successfully deleted')])); + return $response->withHeader('Content-Type', 'application/json'); } function advancedcontentfilter_get_variables_guid(ServerRequestInterface $request, ResponseInterface $response, $args) @@ -437,7 +461,8 @@ function advancedcontentfilter_get_variables_guid(ServerRequestInterface $reques $return = advancedcontentfilter_get_filter_fields(advancedcontentfilter_prepare_item_row($item_row)); - return json_encode(['variables' => str_replace('\\\'', '\'', var_export($return, true))]); + $response->getBody()->write(json_encode(['variables' => str_replace('\\\'', '\'', var_export($return, true))])); + return $response->withHeader('Content-Type', 'application/json'); } /** @@ -455,7 +480,7 @@ function advancedcontentfilter_prepare_item_row(array $item_row): array $item_row['tags'] = $tags['tags']; $item_row['hashtags'] = $tags['hashtags']; $item_row['mentions'] = $tags['mentions']; - $item_row['attachments'] = Post\Media::splitAttachments($item_row['uri-id']); + $item_row['attachments'] = DI::postMediaRepository()->splitAttachments($item_row['uri-id']); return $item_row; } diff --git a/advancedcontentfilter/composer.json b/advancedcontentfilter/composer.json index 93b19cd5..b9ab1900 100644 --- a/advancedcontentfilter/composer.json +++ b/advancedcontentfilter/composer.json @@ -1,25 +1,27 @@ { - "name": "friendica-addons/advancedcontentfilter", - "description": "Advanced Content Filter addon for Friendica", - "type": "friendica-addon", - "authors": [ - { - "name": "Hypolite Petovan", - "email": "hypolite@mrpetovan.com", - "homepage": "https://friendica.mrpetovan.com/profile/hypolite", - "role": "Developer" - } - ], - "require": { - "php": ">=5.6.0", - "slim/slim": "^3.1", - "symfony/expression-language": "^3.4" - }, - "license": "3-clause BSD license", - "minimum-stability": "stable", - "config": { - "optimize-autoloader": true, - "autoloader-suffix": "AdvancedContentFilterAddon", - "preferred-install": "dist" - } + "name": "friendica-addons/advancedcontentfilter", + "description": "Advanced Content Filter addon for Friendica", + "type": "friendica-addon", + "authors": [ + { + "name": "Hypolite Petovan", + "email": "hypolite@mrpetovan.com", + "homepage": "https://friendica.mrpetovan.com/profile/hypolite", + "role": "Developer" + } + ], + "require": { + "slim/slim": "^4", + "symfony/expression-language": "^3.4" + }, + "license": "3-clause BSD license", + "minimum-stability": "stable", + "config": { + "platform": { + "php": "7.4" + }, + "optimize-autoloader": true, + "autoloader-suffix": "AdvancedContentFilterAddon", + "preferred-install": "dist" + } } diff --git a/advancedcontentfilter/composer.lock b/advancedcontentfilter/composer.lock index 774b5ec8..6dbd17ba 100644 --- a/advancedcontentfilter/composer.lock +++ b/advancedcontentfilter/composer.lock @@ -4,40 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "d0e3662dd9d910ffe4f71d325bc39319", + "content-hash": "a7276eb2d2108a26699f69c750d02d27", "packages": [ - { - "name": "container-interop/container-interop", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/container-interop/container-interop.git", - "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/container-interop/container-interop/zipball/79cbf1341c22ec75643d841642dd5d6acd83bdb8", - "reference": "79cbf1341c22ec75643d841642dd5d6acd83bdb8", - "shasum": "" - }, - "require": { - "psr/container": "^1.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Interop\\Container\\": "src/Interop/Container/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", - "homepage": "https://github.com/container-interop/container-interop", - "abandoned": "psr/container", - "time": "2017-02-14T19:40:03+00:00" - }, { "name": "nikic/fast-route", "version": "v1.3.0", @@ -84,56 +52,6 @@ ], "time": "2018-02-13T20:26:39+00:00" }, - { - "name": "pimple/pimple", - "version": "v3.2.3", - "source": { - "type": "git", - "url": "https://github.com/silexphp/Pimple.git", - "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/silexphp/Pimple/zipball/9e403941ef9d65d20cba7d54e29fe906db42cf32", - "reference": "9e403941ef9d65d20cba7d54e29fe906db42cf32", - "shasum": "" - }, - "require": { - "php": ">=5.3.0", - "psr/container": "^1.0" - }, - "require-dev": { - "symfony/phpunit-bridge": "^3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.2.x-dev" - } - }, - "autoload": { - "psr-0": { - "Pimple": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com" - } - ], - "description": "Pimple, a simple Dependency Injection Container", - "homepage": "http://pimple.sensiolabs.org", - "keywords": [ - "container", - "dependency injection" - ], - "time": "2018-01-21T07:42:36+00:00" - }, { "name": "psr/cache", "version": "1.0.1", @@ -182,27 +100,22 @@ }, { "name": "psr/container", - "version": "1.0.0", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/php-fig/container.git", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f" + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/b7ce3b176482dbbc1245ebf52b181af44c2cf55f", - "reference": "b7ce3b176482dbbc1245ebf52b181af44c2cf55f", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.4.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-4": { "Psr\\Container\\": "src/" @@ -215,7 +128,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common Container Interface (PHP FIG PSR-11)", @@ -227,24 +140,25 @@ "container-interop", "psr" ], - "time": "2017-02-14T16:28:37+00:00" + "time": "2021-11-05T16:50:12+00:00" }, { - "name": "psr/http-message", - "version": "1.0.1", + "name": "psr/http-factory", + "version": "1.0.2", "source": { "type": "git", - "url": "https://github.com/php-fig/http-message.git", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363" + "url": "https://github.com/php-fig/http-factory.git", + "reference": "e616d01114759c4c489f93b099585439f795fe35" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363", - "reference": "f6561bf28d520154e4b0ec72be95418abe6d9363", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35", + "reference": "e616d01114759c4c489f93b099585439f795fe35", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=7.0.0", + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { @@ -264,7 +178,58 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], + "time": "2023-04-10T20:10:41+00:00" + }, + { + "name": "psr/http-message", + "version": "2.0", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Message\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for HTTP messages", @@ -277,20 +242,126 @@ "request", "response" ], - "time": "2016-08-06T14:39:51+00:00" + "time": "2023-04-04T09:54:51+00:00" }, { - "name": "psr/log", - "version": "1.1.2", + "name": "psr/http-server-handler", + "version": "1.0.2", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801" + "url": "https://github.com/php-fig/http-server-handler.git", + "reference": "84c4fb66179be4caaf8e97bd239203245302e7d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/446d54b4cb6bf489fc9d75f55843658e6f25d801", - "reference": "446d54b4cb6bf489fc9d75f55843658e6f25d801", + "url": "https://api.github.com/repos/php-fig/http-server-handler/zipball/84c4fb66179be4caaf8e97bd239203245302e7d4", + "reference": "84c4fb66179be4caaf8e97bd239203245302e7d4", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "psr/http-message": "^1.0 || ^2.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Server\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP server-side request handler", + "keywords": [ + "handler", + "http", + "http-interop", + "psr", + "psr-15", + "psr-7", + "request", + "response", + "server" + ], + "time": "2023-04-10T20:06:20+00:00" + }, + { + "name": "psr/http-server-middleware", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/php-fig/http-server-middleware.git", + "reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/http-server-middleware/zipball/c1481f747daaa6a0782775cd6a8c26a1bf4a3829", + "reference": "c1481f747daaa6a0782775cd6a8c26a1bf4a3829", + "shasum": "" + }, + "require": { + "php": ">=7.0", + "psr/http-message": "^1.0 || ^2.0", + "psr/http-server-handler": "^1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Http\\Server\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common interface for HTTP server-side middleware", + "keywords": [ + "http", + "http-interop", + "middleware", + "psr", + "psr-15", + "psr-7", + "request", + "response" + ], + "time": "2023-04-11T06:14:47+00:00" + }, + { + "name": "psr/log", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/php-fig/log.git", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, "require": { @@ -314,7 +385,7 @@ "authors": [ { "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" + "homepage": "https://www.php-fig.org/" } ], "description": "Common interface for logging libraries", @@ -324,84 +395,55 @@ "psr", "psr-3" ], - "time": "2019-11-01T11:05:21+00:00" - }, - { - "name": "psr/simple-cache", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/php-fig/simple-cache.git", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", - "shasum": "" - }, - "require": { - "php": ">=5.3.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "Psr\\SimpleCache\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "PHP-FIG", - "homepage": "http://www.php-fig.org/" - } - ], - "description": "Common interfaces for simple caching", - "keywords": [ - "cache", - "caching", - "psr", - "psr-16", - "simple-cache" - ], - "time": "2017-10-23T01:57:42+00:00" + "time": "2021-05-03T11:20:27+00:00" }, { "name": "slim/slim", - "version": "3.9.2", + "version": "4.13.0", "source": { "type": "git", "url": "https://github.com/slimphp/Slim.git", - "reference": "4086d0106cf5a7135c69fce4161fe355a8feb118" + "reference": "038fd5713d5a41636fdff0e8dcceedecdd17fc17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/slimphp/Slim/zipball/4086d0106cf5a7135c69fce4161fe355a8feb118", - "reference": "4086d0106cf5a7135c69fce4161fe355a8feb118", + "url": "https://api.github.com/repos/slimphp/Slim/zipball/038fd5713d5a41636fdff0e8dcceedecdd17fc17", + "reference": "038fd5713d5a41636fdff0e8dcceedecdd17fc17", "shasum": "" }, "require": { - "container-interop/container-interop": "^1.2", - "nikic/fast-route": "^1.0", - "php": ">=5.5.0", - "pimple/pimple": "^3.0", - "psr/container": "^1.0", - "psr/http-message": "^1.0" - }, - "provide": { - "psr/http-message-implementation": "1.0" + "ext-json": "*", + "nikic/fast-route": "^1.3", + "php": "^7.4 || ^8.0", + "psr/container": "^1.0 || ^2.0", + "psr/http-factory": "^1.0", + "psr/http-message": "^1.1 || ^2.0", + "psr/http-server-handler": "^1.0", + "psr/http-server-middleware": "^1.0", + "psr/log": "^1.1 || ^2.0 || ^3.0" }, "require-dev": { - "phpunit/phpunit": "^4.0", - "squizlabs/php_codesniffer": "^2.5" + "adriansuter/php-autoload-override": "^1.4", + "ext-simplexml": "*", + "guzzlehttp/psr7": "^2.6", + "httpsoft/http-message": "^1.1", + "httpsoft/http-server-request": "^1.1", + "laminas/laminas-diactoros": "^2.17 || ^3", + "nyholm/psr7": "^1.8", + "nyholm/psr7-server": "^1.1", + "phpspec/prophecy": "^1.19", + "phpspec/prophecy-phpunit": "^2.1", + "phpstan/phpstan": "^1.10", + "phpunit/phpunit": "^9.6", + "slim/http": "^1.3", + "slim/psr7": "^1.6", + "squizlabs/php_codesniffer": "^3.9" + }, + "suggest": { + "ext-simplexml": "Needed to support XML format in BodyParsingMiddleware", + "ext-xml": "Needed to support XML format in BodyParsingMiddleware", + "php-di/php-di": "PHP-DI is the recommended container library to be used with Slim", + "slim/psr7": "Slim PSR-7 implementation. See https://www.slimframework.com/docs/v4/start/installation.html for more information." }, "type": "library", "autoload": { @@ -414,77 +456,100 @@ "MIT" ], "authors": [ - { - "name": "Rob Allen", - "email": "rob@akrabat.com", - "homepage": "http://akrabat.com" - }, { "name": "Josh Lockhart", "email": "hello@joshlockhart.com", "homepage": "https://joshlockhart.com" }, - { - "name": "Gabriel Manricks", - "email": "gmanricks@me.com", - "homepage": "http://gabrielmanricks.com" - }, { "name": "Andrew Smith", "email": "a.smith@silentworks.co.uk", "homepage": "http://silentworks.co.uk" + }, + { + "name": "Rob Allen", + "email": "rob@akrabat.com", + "homepage": "http://akrabat.com" + }, + { + "name": "Pierre Berube", + "email": "pierre@lgse.com", + "homepage": "http://www.lgse.com" + }, + { + "name": "Gabriel Manricks", + "email": "gmanricks@me.com", + "homepage": "http://gabrielmanricks.com" } ], "description": "Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs", - "homepage": "https://slimframework.com", + "homepage": "https://www.slimframework.com", "keywords": [ "api", "framework", "micro", "router" ], - "time": "2017-11-26T19:13:09+00:00" + "funding": [ + { + "url": "https://opencollective.com/slimphp", + "type": "open_collective" + }, + { + "url": "https://tidelift.com/funding/github/packagist/slim/slim", + "type": "tidelift" + } + ], + "time": "2024-03-03T21:25:30+00:00" }, { "name": "symfony/cache", - "version": "v3.4.36", + "version": "v4.4.48", "source": { "type": "git", "url": "https://github.com/symfony/cache.git", - "reference": "3d9f46a6960fd5cd7f030f86adc5b4b63bcfa4e3" + "reference": "3b98ed664887ad197b8ede3da2432787212eb915" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/cache/zipball/3d9f46a6960fd5cd7f030f86adc5b4b63bcfa4e3", - "reference": "3d9f46a6960fd5cd7f030f86adc5b4b63bcfa4e3", + "url": "https://api.github.com/repos/symfony/cache/zipball/3b98ed664887ad197b8ede3da2432787212eb915", + "reference": "3b98ed664887ad197b8ede3da2432787212eb915", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "psr/cache": "~1.0", - "psr/log": "~1.0", - "psr/simple-cache": "^1.0", - "symfony/polyfill-apcu": "~1.1" + "php": ">=7.1.3", + "psr/cache": "^1.0|^2.0", + "psr/log": "^1|^2|^3", + "symfony/cache-contracts": "^1.1.7|^2", + "symfony/polyfill-php73": "^1.9", + "symfony/polyfill-php80": "^1.16", + "symfony/service-contracts": "^1.1|^2", + "symfony/var-exporter": "^4.2|^5.0" }, "conflict": { - "symfony/var-dumper": "<3.3" + "doctrine/dbal": "<2.7", + "symfony/dependency-injection": "<3.4", + "symfony/http-kernel": "<4.4|>=5.0", + "symfony/var-dumper": "<4.4" }, "provide": { - "psr/cache-implementation": "1.0", - "psr/simple-cache-implementation": "1.0" + "psr/cache-implementation": "1.0|2.0", + "psr/simple-cache-implementation": "1.0|2.0", + "symfony/cache-implementation": "1.0|2.0" }, "require-dev": { "cache/integration-tests": "dev-master", - "doctrine/cache": "~1.6", - "doctrine/dbal": "~2.4", - "predis/predis": "~1.0" + "doctrine/cache": "^1.6|^2.0", + "doctrine/dbal": "^2.7|^3.0", + "predis/predis": "^1.1", + "psr/simple-cache": "^1.0|^2.0", + "symfony/config": "^4.2|^5.0", + "symfony/dependency-injection": "^3.4|^4.1|^5.0", + "symfony/filesystem": "^4.4|^5.0", + "symfony/http-kernel": "^4.4", + "symfony/var-dumper": "^4.4|^5.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.4-dev" - } - }, "autoload": { "psr-4": { "Symfony\\Component\\Cache\\": "" @@ -507,38 +572,188 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony Cache component with PSR-6, PSR-16, and tags", + "description": "Provides extended PSR-6, PSR-16 (and tags) implementations", "homepage": "https://symfony.com", "keywords": [ "caching", "psr6" ], - "time": "2019-12-01T10:45:41+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-10-17T20:21:54+00:00" }, { - "name": "symfony/expression-language", - "version": "v3.4.8", + "name": "symfony/cache-contracts", + "version": "v2.5.2", "source": { "type": "git", - "url": "https://github.com/symfony/expression-language.git", - "reference": "867e4d1f5d4e52435a8ffff6b24fd6a801582241" + "url": "https://github.com/symfony/cache-contracts.git", + "reference": "64be4a7acb83b6f2bf6de9a02cee6dad41277ebc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/expression-language/zipball/867e4d1f5d4e52435a8ffff6b24fd6a801582241", - "reference": "867e4d1f5d4e52435a8ffff6b24fd6a801582241", + "url": "https://api.github.com/repos/symfony/cache-contracts/zipball/64be4a7acb83b6f2bf6de9a02cee6dad41277ebc", + "reference": "64be4a7acb83b6f2bf6de9a02cee6dad41277ebc", "shasum": "" }, "require": { - "php": "^5.5.9|>=7.0.8", - "symfony/cache": "~3.1|~4.0" + "php": ">=7.2.5", + "psr/cache": "^1.0|^2.0|^3.0" + }, + "suggest": { + "symfony/cache-implementation": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.4-dev" + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" } }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Cache\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to caching", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-02T09:53:40+00:00" + }, + { + "name": "symfony/deprecation-contracts", + "version": "v2.5.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/deprecation-contracts.git", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "reference": "e8b495ea28c1d97b5e0c121748d6f9b53d075c66", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "files": [ + "function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-01-02T09:53:40+00:00" + }, + { + "name": "symfony/expression-language", + "version": "v3.4.47", + "source": { + "type": "git", + "url": "https://github.com/symfony/expression-language.git", + "reference": "de38e66398fca1fcb9c48e80279910e6889cb28f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/expression-language/zipball/de38e66398fca1fcb9c48e80279910e6889cb28f", + "reference": "de38e66398fca1fcb9c48e80279910e6889cb28f", + "shasum": "" + }, + "require": { + "php": "^5.5.9|>=7.0.8", + "symfony/cache": "~3.1|~4.0", + "symfony/polyfill-php70": "~1.6" + }, + "type": "library", "autoload": { "psr-4": { "Symfony\\Component\\ExpressionLanguage\\": "" @@ -563,37 +778,120 @@ ], "description": "Symfony ExpressionLanguage Component", "homepage": "https://symfony.com", - "time": "2018-01-03T07:37:34+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-24T10:57:07+00:00" }, { - "name": "symfony/polyfill-apcu", - "version": "v1.13.1", + "name": "symfony/polyfill-php70", + "version": "v1.20.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-apcu.git", - "reference": "a8e961c841b9ec52927a87914f8820a1ad8f8116" + "url": "https://github.com/symfony/polyfill-php70.git", + "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-apcu/zipball/a8e961c841b9ec52927a87914f8820a1ad8f8116", - "reference": "a8e961c841b9ec52927a87914f8820a1ad8f8116", + "url": "https://api.github.com/repos/symfony/polyfill-php70/zipball/5f03a781d984aae42cebd18e7912fa80f02ee644", + "reference": "5f03a781d984aae42cebd18e7912fa80f02ee644", "shasum": "" }, "require": { - "php": ">=5.3.3" + "php": ">=7.1" + }, + "type": "metapackage", + "extra": { + "branch-alias": { + "dev-main": "1.20-dev" + }, + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2020-10-23T14:02:19+00:00" + }, + { + "name": "symfony/polyfill-php73", + "version": "v1.29.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php73.git", + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/21bd091060673a1177ae842c0ef8fe30893114d2", + "reference": "21bd091060673a1177ae842c0ef8fe30893114d2", + "shasum": "" + }, + "require": { + "php": ">=7.1" }, "type": "library", "extra": { - "branch-alias": { - "dev-master": "1.13-dev" + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Apcu\\": "" - }, "files": [ "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php73\\": "" + }, + "classmap": [ + "Resources/stubs" ] }, "notification-url": "https://packagist.org/downloads/", @@ -610,16 +908,256 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting apcu_* functions to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ - "apcu", "compatibility", "polyfill", "portable", "shim" ], - "time": "2019-11-27T13:56:44+00:00" + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-01-29T20:11:03+00:00" + }, + { + "name": "symfony/polyfill-php80", + "version": "v1.29.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-php80.git", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "type": "library", + "extra": { + "thanks": { + "name": "symfony/polyfill", + "url": "https://github.com/symfony/polyfill" + } + }, + "autoload": { + "files": [ + "bootstrap.php" + ], + "psr-4": { + "Symfony\\Polyfill\\Php80\\": "" + }, + "classmap": [ + "Resources/stubs" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ion Bazan", + "email": "ion.bazan@gmail.com" + }, + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "homepage": "https://symfony.com", + "keywords": [ + "compatibility", + "polyfill", + "portable", + "shim" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-01-29T20:11:03+00:00" + }, + { + "name": "symfony/service-contracts", + "version": "v2.5.2", + "source": { + "type": "git", + "url": "https://github.com/symfony/service-contracts.git", + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "reference": "4b426aac47d6427cc1a1d0f7e2ac724627f5966c", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "psr/container": "^1.1", + "symfony/deprecation-contracts": "^2.1|^3" + }, + "conflict": { + "ext-psr": "<1.1|>=2" + }, + "suggest": { + "symfony/service-implementation": "" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "2.5-dev" + }, + "thanks": { + "name": "symfony/contracts", + "url": "https://github.com/symfony/contracts" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Contracts\\Service\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Generic abstractions related to writing services", + "homepage": "https://symfony.com", + "keywords": [ + "abstractions", + "contracts", + "decoupling", + "interfaces", + "interoperability", + "standards" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2022-05-30T19:17:29+00:00" + }, + { + "name": "symfony/var-exporter", + "version": "v5.4.35", + "source": { + "type": "git", + "url": "https://github.com/symfony/var-exporter.git", + "reference": "abb0a151b62d6b07e816487e20040464af96cae7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/var-exporter/zipball/abb0a151b62d6b07e816487e20040464af96cae7", + "reference": "abb0a151b62d6b07e816487e20040464af96cae7", + "shasum": "" + }, + "require": { + "php": ">=7.2.5", + "symfony/polyfill-php80": "^1.16" + }, + "require-dev": { + "symfony/var-dumper": "^4.4.9|^5.0.9|^6.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\VarExporter\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Allows exporting any serializable PHP data structure to plain PHP code", + "homepage": "https://symfony.com", + "keywords": [ + "clone", + "construct", + "export", + "hydrate", + "instantiate", + "serialize" + ], + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2024-01-23T13:51:25+00:00" } ], "packages-dev": [], @@ -628,8 +1166,10 @@ "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, - "platform": { - "php": ">=5.6.0" + "platform": [], + "platform-dev": [], + "platform-overrides": { + "php": "7.4" }, - "platform-dev": [] + "plugin-api-version": "1.1.0" } diff --git a/advancedcontentfilter/lang/bg/messages.po b/advancedcontentfilter/lang/bg/messages.po new file mode 100644 index 00000000..8c65990e --- /dev/null +++ b/advancedcontentfilter/lang/bg/messages.po @@ -0,0 +1,161 @@ +# ADDON advancedcontentfilter +# Copyright (C) +# This file is distributed under the same license as the Friendica advancedcontentfilter addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-05-11 08:54-0400\n" +"PO-Revision-Date: 2018-05-24 06:41+0000\n" +"Language-Team: Bulgarian (https://app.transifex.com/Friendica/teams/12172/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: advancedcontentfilter.php:154 +#, php-format +msgid "Filtered by rule: %s" +msgstr "" + +#: advancedcontentfilter.php:170 advancedcontentfilter.php:225 +msgid "Advanced Content Filter" +msgstr "" + +#: advancedcontentfilter.php:224 +msgid "Back to Addon Settings" +msgstr "" + +#: advancedcontentfilter.php:226 +msgid "Add a Rule" +msgstr "" + +#: advancedcontentfilter.php:227 +msgid "Help" +msgstr "" + +#: advancedcontentfilter.php:228 +msgid "" +"Add and manage your personal content filter rules in this screen. Rules have" +" a name and an arbitrary expression that will be matched against post data. " +"For a complete reference of the available operations and variables, check " +"the help page." +msgstr "" + +#: advancedcontentfilter.php:229 +msgid "Your rules" +msgstr "" + +#: advancedcontentfilter.php:230 +msgid "" +"You have no rules yet! Start adding one by clicking on the button above next" +" to the title." +msgstr "" + +#: advancedcontentfilter.php:231 +msgid "Disabled" +msgstr "" + +#: advancedcontentfilter.php:232 +msgid "Enabled" +msgstr "" + +#: advancedcontentfilter.php:233 +msgid "Disable this rule" +msgstr "" + +#: advancedcontentfilter.php:234 +msgid "Enable this rule" +msgstr "" + +#: advancedcontentfilter.php:235 +msgid "Edit this rule" +msgstr "" + +#: advancedcontentfilter.php:236 +msgid "Edit the rule" +msgstr "" + +#: advancedcontentfilter.php:237 +msgid "Save this rule" +msgstr "" + +#: advancedcontentfilter.php:238 +msgid "Delete this rule" +msgstr "" + +#: advancedcontentfilter.php:239 +msgid "Rule" +msgstr "" + +#: advancedcontentfilter.php:240 +msgid "Close" +msgstr "" + +#: advancedcontentfilter.php:241 +msgid "Add new rule" +msgstr "" + +#: advancedcontentfilter.php:242 +msgid "Rule Name" +msgstr "" + +#: advancedcontentfilter.php:243 +msgid "Rule Expression" +msgstr "" + +#: advancedcontentfilter.php:244 +msgid "Cancel" +msgstr "" + +#: advancedcontentfilter.php:295 +msgid "This addon requires this node having at least one post" +msgstr "" + +#: advancedcontentfilter.php:325 advancedcontentfilter.php:336 +#: advancedcontentfilter.php:347 advancedcontentfilter.php:383 +#: advancedcontentfilter.php:414 advancedcontentfilter.php:437 +msgid "You must be logged in to use this method" +msgstr "" + +#: advancedcontentfilter.php:351 advancedcontentfilter.php:387 +#: advancedcontentfilter.php:418 +msgid "Invalid form security token, please refresh the page." +msgstr "" + +#: advancedcontentfilter.php:363 +msgid "The rule name and expression are required." +msgstr "" + +#: advancedcontentfilter.php:377 +msgid "Rule successfully added" +msgstr "" + +#: advancedcontentfilter.php:391 advancedcontentfilter.php:422 +msgid "Rule doesn't exist or doesn't belong to you." +msgstr "" + +#: advancedcontentfilter.php:408 +msgid "Rule successfully updated" +msgstr "" + +#: advancedcontentfilter.php:431 +msgid "Rule successfully deleted" +msgstr "" + +#: advancedcontentfilter.php:441 +msgid "Missing argument: guid." +msgstr "" + +#: advancedcontentfilter.php:449 +#, php-format +msgid "Unknown post with guid: %s" +msgstr "" + +#: src/middlewares.php:49 +msgid "Method not found" +msgstr "" diff --git a/advancedcontentfilter/lang/bg/strings.php b/advancedcontentfilter/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/advancedcontentfilter/lang/bg/strings.php @@ -0,0 +1,7 @@ + 2 && n < 20) ? 2 : 3;\n" + +#: advancedcontentfilter.php:154 +#, php-format +msgid "Filtered by rule: %s" +msgstr "" + +#: advancedcontentfilter.php:170 advancedcontentfilter.php:225 +msgid "Advanced Content Filter" +msgstr "" + +#: advancedcontentfilter.php:224 +msgid "Back to Addon Settings" +msgstr "" + +#: advancedcontentfilter.php:226 +msgid "Add a Rule" +msgstr "" + +#: advancedcontentfilter.php:227 +msgid "Help" +msgstr "" + +#: advancedcontentfilter.php:228 +msgid "" +"Add and manage your personal content filter rules in this screen. Rules have" +" a name and an arbitrary expression that will be matched against post data. " +"For a complete reference of the available operations and variables, check " +"the help page." +msgstr "" + +#: advancedcontentfilter.php:229 +msgid "Your rules" +msgstr "" + +#: advancedcontentfilter.php:230 +msgid "" +"You have no rules yet! Start adding one by clicking on the button above next" +" to the title." +msgstr "" + +#: advancedcontentfilter.php:231 +msgid "Disabled" +msgstr "" + +#: advancedcontentfilter.php:232 +msgid "Enabled" +msgstr "" + +#: advancedcontentfilter.php:233 +msgid "Disable this rule" +msgstr "" + +#: advancedcontentfilter.php:234 +msgid "Enable this rule" +msgstr "" + +#: advancedcontentfilter.php:235 +msgid "Edit this rule" +msgstr "" + +#: advancedcontentfilter.php:236 +msgid "Edit the rule" +msgstr "" + +#: advancedcontentfilter.php:237 +msgid "Save this rule" +msgstr "" + +#: advancedcontentfilter.php:238 +msgid "Delete this rule" +msgstr "" + +#: advancedcontentfilter.php:239 +msgid "Rule" +msgstr "" + +#: advancedcontentfilter.php:240 +msgid "Close" +msgstr "" + +#: advancedcontentfilter.php:241 +msgid "Add new rule" +msgstr "" + +#: advancedcontentfilter.php:242 +msgid "Rule Name" +msgstr "" + +#: advancedcontentfilter.php:243 +msgid "Rule Expression" +msgstr "" + +#: advancedcontentfilter.php:244 +msgid "Cancel" +msgstr "" + +#: advancedcontentfilter.php:295 +msgid "This addon requires this node having at least one post" +msgstr "" + +#: advancedcontentfilter.php:325 advancedcontentfilter.php:336 +#: advancedcontentfilter.php:347 advancedcontentfilter.php:383 +#: advancedcontentfilter.php:414 advancedcontentfilter.php:437 +msgid "You must be logged in to use this method" +msgstr "" + +#: advancedcontentfilter.php:351 advancedcontentfilter.php:387 +#: advancedcontentfilter.php:418 +msgid "Invalid form security token, please refresh the page." +msgstr "" + +#: advancedcontentfilter.php:363 +msgid "The rule name and expression are required." +msgstr "" + +#: advancedcontentfilter.php:377 +msgid "Rule successfully added" +msgstr "" + +#: advancedcontentfilter.php:391 advancedcontentfilter.php:422 +msgid "Rule doesn't exist or doesn't belong to you." +msgstr "" + +#: advancedcontentfilter.php:408 +msgid "Rule successfully updated" +msgstr "" + +#: advancedcontentfilter.php:431 +msgid "Rule successfully deleted" +msgstr "" + +#: advancedcontentfilter.php:441 +msgid "Missing argument: guid." +msgstr "" + +#: advancedcontentfilter.php:449 +#, php-format +msgid "Unknown post with guid: %s" +msgstr "" + +#: src/middlewares.php:49 +msgid "Method not found" +msgstr "" diff --git a/advancedcontentfilter/lang/gd/strings.php b/advancedcontentfilter/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/advancedcontentfilter/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/advancedcontentfilter/lang/is/messages.po b/advancedcontentfilter/lang/is/messages.po new file mode 100644 index 00000000..4c50158d --- /dev/null +++ b/advancedcontentfilter/lang/is/messages.po @@ -0,0 +1,161 @@ +# ADDON advancedcontentfilter +# Copyright (C) +# This file is distributed under the same license as the Friendica advancedcontentfilter addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-05-11 08:54-0400\n" +"PO-Revision-Date: 2018-05-24 06:41+0000\n" +"Language-Team: Icelandic (https://app.transifex.com/Friendica/teams/12172/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: advancedcontentfilter.php:154 +#, php-format +msgid "Filtered by rule: %s" +msgstr "" + +#: advancedcontentfilter.php:170 advancedcontentfilter.php:225 +msgid "Advanced Content Filter" +msgstr "" + +#: advancedcontentfilter.php:224 +msgid "Back to Addon Settings" +msgstr "" + +#: advancedcontentfilter.php:226 +msgid "Add a Rule" +msgstr "" + +#: advancedcontentfilter.php:227 +msgid "Help" +msgstr "" + +#: advancedcontentfilter.php:228 +msgid "" +"Add and manage your personal content filter rules in this screen. Rules have" +" a name and an arbitrary expression that will be matched against post data. " +"For a complete reference of the available operations and variables, check " +"the help page." +msgstr "" + +#: advancedcontentfilter.php:229 +msgid "Your rules" +msgstr "" + +#: advancedcontentfilter.php:230 +msgid "" +"You have no rules yet! Start adding one by clicking on the button above next" +" to the title." +msgstr "" + +#: advancedcontentfilter.php:231 +msgid "Disabled" +msgstr "" + +#: advancedcontentfilter.php:232 +msgid "Enabled" +msgstr "" + +#: advancedcontentfilter.php:233 +msgid "Disable this rule" +msgstr "" + +#: advancedcontentfilter.php:234 +msgid "Enable this rule" +msgstr "" + +#: advancedcontentfilter.php:235 +msgid "Edit this rule" +msgstr "" + +#: advancedcontentfilter.php:236 +msgid "Edit the rule" +msgstr "" + +#: advancedcontentfilter.php:237 +msgid "Save this rule" +msgstr "" + +#: advancedcontentfilter.php:238 +msgid "Delete this rule" +msgstr "" + +#: advancedcontentfilter.php:239 +msgid "Rule" +msgstr "" + +#: advancedcontentfilter.php:240 +msgid "Close" +msgstr "" + +#: advancedcontentfilter.php:241 +msgid "Add new rule" +msgstr "" + +#: advancedcontentfilter.php:242 +msgid "Rule Name" +msgstr "" + +#: advancedcontentfilter.php:243 +msgid "Rule Expression" +msgstr "" + +#: advancedcontentfilter.php:244 +msgid "Cancel" +msgstr "" + +#: advancedcontentfilter.php:295 +msgid "This addon requires this node having at least one post" +msgstr "" + +#: advancedcontentfilter.php:325 advancedcontentfilter.php:336 +#: advancedcontentfilter.php:347 advancedcontentfilter.php:383 +#: advancedcontentfilter.php:414 advancedcontentfilter.php:437 +msgid "You must be logged in to use this method" +msgstr "" + +#: advancedcontentfilter.php:351 advancedcontentfilter.php:387 +#: advancedcontentfilter.php:418 +msgid "Invalid form security token, please refresh the page." +msgstr "" + +#: advancedcontentfilter.php:363 +msgid "The rule name and expression are required." +msgstr "" + +#: advancedcontentfilter.php:377 +msgid "Rule successfully added" +msgstr "" + +#: advancedcontentfilter.php:391 advancedcontentfilter.php:422 +msgid "Rule doesn't exist or doesn't belong to you." +msgstr "" + +#: advancedcontentfilter.php:408 +msgid "Rule successfully updated" +msgstr "" + +#: advancedcontentfilter.php:431 +msgid "Rule successfully deleted" +msgstr "" + +#: advancedcontentfilter.php:441 +msgid "Missing argument: guid." +msgstr "" + +#: advancedcontentfilter.php:449 +#, php-format +msgid "Unknown post with guid: %s" +msgstr "" + +#: src/middlewares.php:49 +msgid "Method not found" +msgstr "" diff --git a/advancedcontentfilter/lang/is/strings.php b/advancedcontentfilter/lang/is/strings.php new file mode 100644 index 00000000..975c341e --- /dev/null +++ b/advancedcontentfilter/lang/is/strings.php @@ -0,0 +1,7 @@ +, 2018 -# Sylke Vicious , 2021 +# Sylke Vicious , 2023 # #, fuzzy msgid "" @@ -14,7 +14,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-05-11 08:54-0400\n" "PO-Revision-Date: 2018-05-24 06:41+0000\n" -"Last-Translator: Sylke Vicious , 2021\n" +"Last-Translator: Sylke Vicious , 2023\n" "Language-Team: Italian (https://app.transifex.com/Friendica/teams/12172/it/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -125,7 +125,7 @@ msgstr "Annulla" #: advancedcontentfilter.php:295 msgid "This addon requires this node having at least one post" -msgstr "" +msgstr "Questo addon richiede che questo nodo abbia almeno un messaggio" #: advancedcontentfilter.php:325 advancedcontentfilter.php:336 #: advancedcontentfilter.php:347 advancedcontentfilter.php:383 diff --git a/advancedcontentfilter/lang/it/strings.php b/advancedcontentfilter/lang/it/strings.php index 5cc01739..d47d7a5a 100644 --- a/advancedcontentfilter/lang/it/strings.php +++ b/advancedcontentfilter/lang/it/strings.php @@ -27,6 +27,7 @@ $a->strings['Add new rule'] = 'Aggiungi nuova regola'; $a->strings['Rule Name'] = 'Nome Regola'; $a->strings['Rule Expression'] = 'Espressione Regola'; $a->strings['Cancel'] = 'Annulla'; +$a->strings['This addon requires this node having at least one post'] = 'Questo addon richiede che questo nodo abbia almeno un messaggio'; $a->strings['You must be logged in to use this method'] = 'Devi essere autenticato per usare questo metodo'; $a->strings['Invalid form security token, please refresh the page.'] = 'Token di sicurezza invalido, aggiorna la pagina.'; $a->strings['The rule name and expression are required.'] = 'Il nome e l\'espressione della regola sono richiesti.'; diff --git a/advancedcontentfilter/lang/pl/messages.po b/advancedcontentfilter/lang/pl/messages.po index 5fc9ca65..9f0483c6 100644 --- a/advancedcontentfilter/lang/pl/messages.po +++ b/advancedcontentfilter/lang/pl/messages.po @@ -6,7 +6,7 @@ # Translators: # Waldemar Stoczkowski, 2018 # Joe Doe, 2021 -# Piotr Strębski , 2022 +# Bartosz Kozień, 2025 # #, fuzzy msgid "" @@ -15,8 +15,8 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-05-11 08:54-0400\n" "PO-Revision-Date: 2018-05-24 06:41+0000\n" -"Last-Translator: Piotr Strębski , 2022\n" -"Language-Team: Polish (https://www.transifex.com/Friendica/teams/12172/pl/)\n" +"Last-Translator: Bartosz Kozień, 2025\n" +"Language-Team: Polish (https://app.transifex.com/Friendica/teams/12172/pl/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -126,7 +126,7 @@ msgstr "Anuluj" #: advancedcontentfilter.php:295 msgid "This addon requires this node having at least one post" -msgstr "Ten dodatek wymaga, aby ten węzeł miał co najmniej jeden wpis" +msgstr "Ten dodatek wymaga, aby ta instancja miała co najmniej jeden wpis" #: advancedcontentfilter.php:325 advancedcontentfilter.php:336 #: advancedcontentfilter.php:347 advancedcontentfilter.php:383 diff --git a/advancedcontentfilter/lang/pl/strings.php b/advancedcontentfilter/lang/pl/strings.php index 625819c1..57215c65 100644 --- a/advancedcontentfilter/lang/pl/strings.php +++ b/advancedcontentfilter/lang/pl/strings.php @@ -27,7 +27,7 @@ $a->strings['Add new rule'] = 'Dodaj nową regułę'; $a->strings['Rule Name'] = 'Nazwa reguły'; $a->strings['Rule Expression'] = 'Wyrażanie reguły'; $a->strings['Cancel'] = 'Anuluj'; -$a->strings['This addon requires this node having at least one post'] = 'Ten dodatek wymaga, aby ten węzeł miał co najmniej jeden wpis'; +$a->strings['This addon requires this node having at least one post'] = 'Ten dodatek wymaga, aby ta instancja miała co najmniej jeden wpis'; $a->strings['You must be logged in to use this method'] = 'Musisz być zalogowany, aby skorzystać z tej metody'; $a->strings['Invalid form security token, please refresh the page.'] = 'Nieprawidłowy token zabezpieczający formularz, odśwież stronę.'; $a->strings['The rule name and expression are required.'] = 'Nazwa reguły i wyrażenie są wymagane.'; diff --git a/advancedcontentfilter/src/middlewares.php b/advancedcontentfilter/src/middlewares.php deleted file mode 100644 index dffb9363..00000000 --- a/advancedcontentfilter/src/middlewares.php +++ /dev/null @@ -1,51 +0,0 @@ -. - * - */ - -use Friendica\DI; - -$container = $slim->getContainer(); - -// Error handler based off https://stackoverflow.com/a/48135009/757392 -$container['errorHandler'] = function () { - return function(Psr\Http\Message\RequestInterface $request, Psr\Http\Message\ResponseInterface $response, Exception $exception) - { - $responseCode = 500; - - if (is_a($exception, 'Friendica\Network\HTTPException')) { - $responseCode = $exception->getCode(); - } - - $errors['message'] = $exception->getMessage(); - - $errors['responseCode'] = $responseCode; - - return $response - ->withStatus($responseCode) - ->withJson($errors); - }; -}; - -$container['notFoundHandler'] = function () { - return function () - { - throw new \Friendica\Network\HTTPException\NotFoundException(DI::l10n()->t('Method not found')); - }; -}; diff --git a/advancedcontentfilter/templates/settings.tpl b/advancedcontentfilter/templates/settings.tpl index c9dfbe3a..8b82e595 100644 --- a/advancedcontentfilter/templates/settings.tpl +++ b/advancedcontentfilter/templates/settings.tpl @@ -3,7 +3,7 @@
- -EOT; -} - -function blockem_item_photo_menu(array &$b) -{ - global $blockem_words; - - if (!DI::userSession()->getLocalUserId() || $b['item']['self']) { - return; - } - - $blocked = false; - $author = $b['item']['author-link']; - - if (!empty($blockem_words)) { - foreach($blockem_words as $bloke) { - if (Strings::compareLink($bloke,$author)) { - $blocked = true; - break; - } - } - } - if ($blocked) { - $b['menu'][DI::l10n()->t('Unblock Author')] = 'javascript:blockemUnblock(\'' . $author . '\');'; - } else { - $b['menu'][DI::l10n()->t('Block Author')] = 'javascript:blockemBlock(\'' . $author . '\');'; - } -} - -/** - * This is a statement rather than an actual function definition. The simple - * existence of this method is checked to figure out if the addon offers a - * module. - */ -function blockem_module() {} - -function blockem_init() -{ - if (!DI::userSession()->getLocalUserId()) { - return; - } - - $words = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'blockem', 'words'); - - if (array_key_exists('block', $_GET) && $_GET['block']) { - if (strlen($words)) { - $words .= ','; - } - - $words .= trim($_GET['block']); - } - - if (array_key_exists('unblock', $_GET) && $_GET['unblock']) { - $arr = explode(',',$words); - $newarr = []; - - if (count($arr)) { - foreach ($arr as $x) { - if (!Strings::compareLink(trim($x), trim($_GET['unblock']))) { - $newarr[] = $x; - } - } - } - - $words = implode(',', $newarr); - } - - DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'blockem', 'words', $words); - exit(); -} diff --git a/blockem/lang/C/messages.po b/blockem/lang/C/messages.po deleted file mode 100644 index 64bb3fc4..00000000 --- a/blockem/lang/C/messages.po +++ /dev/null @@ -1,45 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: \n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-21 19:13-0500\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" - -#: blockem.php:39 -msgid "" -"Hides user's content by collapsing posts. Also replaces their avatar with " -"generic image." -msgstr "" - -#: blockem.php:40 -msgid "Comma separated profile URLS:" -msgstr "" - -#: blockem.php:45 -msgid "Blockem" -msgstr "" - -#: blockem.php:120 -#, php-format -msgid "Filtered user: %s" -msgstr "" - -#: blockem.php:183 -msgid "Unblock Author" -msgstr "" - -#: blockem.php:185 -msgid "Block Author" -msgstr "" diff --git a/blockem/lang/ar/messages.po b/blockem/lang/ar/messages.po deleted file mode 100644 index c9d6d5f9..00000000 --- a/blockem/lang/ar/messages.po +++ /dev/null @@ -1,52 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -# Translators: -# abidin toumi , 2021 -# Farida Khalaf , 2021 -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-01 18:15+0100\n" -"PO-Revision-Date: 2021-10-29 08:15+0000\n" -"Last-Translator: abidin toumi \n" -"Language-Team: Arabic (http://www.transifex.com/Friendica/friendica/language/ar/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: ar\n" -"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" - -#: blockem.php:42 blockem.php:46 -msgid "Blockem" -msgstr "احجبه
" - -#: blockem.php:50 -msgid "" -"Hides user's content by collapsing posts. Also replaces their avatar with " -"generic image." -msgstr "إخفاء محتوى المستخدم عن طريق تصغير المشاركات. و استبدال الصورة الرمزية الخاصة بهم بصورة عامة." - -#: blockem.php:51 -msgid "Comma separated profile URLS:" -msgstr "عناوين الملفات الشخصية مفصولة بفواصل:" - -#: blockem.php:55 -msgid "Save Settings" -msgstr "احفظ الإعدادات" - -#: blockem.php:131 -#, php-format -msgid "Filtered user: %s" -msgstr "ترشيح المستخدم :1%s" - -#: blockem.php:190 -msgid "Unblock Author" -msgstr "ألغ الحجب عن المدون" - -#: blockem.php:192 -msgid "Block Author" -msgstr "احجب المدون" diff --git a/blockem/lang/ar/strings.php b/blockem/lang/ar/strings.php deleted file mode 100644 index 0f58fa22..00000000 --- a/blockem/lang/ar/strings.php +++ /dev/null @@ -1,14 +0,0 @@ -=3 && $n%100<=10) { return 3; } else if ($n%100>=11 && $n%100<=99) { return 4; } else { return 5; } -}} -$a->strings['Blockem'] = 'احجبه
'; -$a->strings['Hides user\'s content by collapsing posts. Also replaces their avatar with generic image.'] = 'إخفاء محتوى المستخدم عن طريق تصغير المشاركات. و استبدال الصورة الرمزية الخاصة بهم بصورة عامة.'; -$a->strings['Comma separated profile URLS:'] = 'عناوين الملفات الشخصية مفصولة بفواصل:'; -$a->strings['Save Settings'] = 'احفظ الإعدادات'; -$a->strings['Filtered user: %s'] = 'ترشيح المستخدم :1%s'; -$a->strings['Unblock Author'] = 'ألغ الحجب عن المدون'; -$a->strings['Block Author'] = 'احجب المدون'; diff --git a/blockem/lang/ca/messages.po b/blockem/lang/ca/messages.po deleted file mode 100644 index 6d4c3468..00000000 --- a/blockem/lang/ca/messages.po +++ /dev/null @@ -1,59 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -# Translators: -# Joan Bar , 2019 -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-17 10:23+0200\n" -"PO-Revision-Date: 2019-10-14 11:50+0000\n" -"Last-Translator: Joan Bar \n" -"Language-Team: Catalan (http://www.transifex.com/Friendica/friendica/language/ca/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: ca\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: blockem.php:54 blockem.php:58 -msgid "Blockem" -msgstr "Blockem" - -#: blockem.php:62 -msgid "" -"Hides user's content by collapsing posts. Also replaces their avatar with " -"generic image." -msgstr "Amaga el contingut de l'usuari mitjançant la publicació col·lapsada. També substitueix el seu avatar per una imatge genèrica" - -#: blockem.php:63 -msgid "Comma separated profile URLS:" -msgstr "URL de perfil separats per comes:" - -#: blockem.php:67 -msgid "Save Settings" -msgstr "Desa la configuració" - -#: blockem.php:81 -msgid "BLOCKEM Settings saved." -msgstr "S'ha desat la configuració de BLOCKEM." - -#: blockem.php:143 -#, php-format -msgid "Filtered user: %s" -msgstr "Usuari filtrat:%s" - -#: blockem.php:202 -msgid "Unblock Author" -msgstr "Desbloca l'autor" - -#: blockem.php:204 -msgid "Block Author" -msgstr "Autor de bloc" - -#: blockem.php:244 -msgid "blockem settings updated" -msgstr "S'ha actualitzat la configuració de blockem" diff --git a/blockem/lang/ca/strings.php b/blockem/lang/ca/strings.php deleted file mode 100644 index be4deede..00000000 --- a/blockem/lang/ca/strings.php +++ /dev/null @@ -1,16 +0,0 @@ -strings['Blockem'] = 'Blockem'; -$a->strings['Hides user\'s content by collapsing posts. Also replaces their avatar with generic image.'] = 'Amaga el contingut de l\'usuari mitjançant la publicació col·lapsada. També substitueix el seu avatar per una imatge genèrica'; -$a->strings['Comma separated profile URLS:'] = 'URL de perfil separats per comes:'; -$a->strings['Save Settings'] = 'Desa la configuració'; -$a->strings['BLOCKEM Settings saved.'] = 'S\'ha desat la configuració de BLOCKEM.'; -$a->strings['Filtered user: %s'] = 'Usuari filtrat:%s'; -$a->strings['Unblock Author'] = 'Desbloca l\'autor'; -$a->strings['Block Author'] = 'Autor de bloc'; -$a->strings['blockem settings updated'] = 'S\'ha actualitzat la configuració de blockem'; diff --git a/blockem/lang/cs/messages.po b/blockem/lang/cs/messages.po deleted file mode 100644 index fb90a2ca..00000000 --- a/blockem/lang/cs/messages.po +++ /dev/null @@ -1,60 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -# Translators: -# Aditoo, 2018 -# michal_s , 2014 -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-17 10:23+0200\n" -"PO-Revision-Date: 2018-08-18 12:25+0000\n" -"Last-Translator: Aditoo\n" -"Language-Team: Czech (http://www.transifex.com/Friendica/friendica/language/cs/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: cs\n" -"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\n" - -#: blockem.php:54 blockem.php:58 -msgid "Blockem" -msgstr "Blockem" - -#: blockem.php:62 -msgid "" -"Hides user's content by collapsing posts. Also replaces their avatar with " -"generic image." -msgstr "Skrývá uživatelský obsah zabalením příspěvků. Navíc nahrazuje avatar generickým obrázkem." - -#: blockem.php:63 -msgid "Comma separated profile URLS:" -msgstr "URL adresy profilů, oddělené čárkami:" - -#: blockem.php:67 -msgid "Save Settings" -msgstr "Uložit nastavení" - -#: blockem.php:81 -msgid "BLOCKEM Settings saved." -msgstr "Nastavení BLOCKEM uložena." - -#: blockem.php:143 -#, php-format -msgid "Filtered user: %s" -msgstr "Filtrovaný uživatel: %s" - -#: blockem.php:202 -msgid "Unblock Author" -msgstr "Odblokovat autora" - -#: blockem.php:204 -msgid "Block Author" -msgstr "Zablokovat autora" - -#: blockem.php:244 -msgid "blockem settings updated" -msgstr "nastavení blockem aktualizována" diff --git a/blockem/lang/cs/strings.php b/blockem/lang/cs/strings.php deleted file mode 100644 index ac32d78f..00000000 --- a/blockem/lang/cs/strings.php +++ /dev/null @@ -1,16 +0,0 @@ -= 2 && $n <= 4 && $n % 1 == 0)) { return 1; } else if (($n % 1 != 0 )) { return 2; } else { return 3; } -}} -$a->strings['Blockem'] = 'Blockem'; -$a->strings['Hides user\'s content by collapsing posts. Also replaces their avatar with generic image.'] = 'Skrývá uživatelský obsah zabalením příspěvků. Navíc nahrazuje avatar generickým obrázkem.'; -$a->strings['Comma separated profile URLS:'] = 'URL adresy profilů, oddělené čárkami:'; -$a->strings['Save Settings'] = 'Uložit nastavení'; -$a->strings['BLOCKEM Settings saved.'] = 'Nastavení BLOCKEM uložena.'; -$a->strings['Filtered user: %s'] = 'Filtrovaný uživatel: %s'; -$a->strings['Unblock Author'] = 'Odblokovat autora'; -$a->strings['Block Author'] = 'Zablokovat autora'; -$a->strings['blockem settings updated'] = 'nastavení blockem aktualizována'; diff --git a/blockem/lang/da-dk/messages.po b/blockem/lang/da-dk/messages.po deleted file mode 100644 index e4a80bff..00000000 --- a/blockem/lang/da-dk/messages.po +++ /dev/null @@ -1,47 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -# Translators: -# Anton , 2022 -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-21 19:13-0500\n" -"PO-Revision-Date: 2014-06-22 11:20+0000\n" -"Last-Translator: Anton , 2022\n" -"Language-Team: Danish (Denmark) (http://www.transifex.com/Friendica/friendica/language/da_DK/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: da_DK\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: blockem.php:39 -msgid "" -"Hides user's content by collapsing posts. Also replaces their avatar with " -"generic image." -msgstr "Skjul brugers indhold ved at kollapse deres opslag. Erstatter også deres avatar med et generisk billede." - -#: blockem.php:40 -msgid "Comma separated profile URLS:" -msgstr "Kommasepareret liste over profil-URL's:" - -#: blockem.php:45 -msgid "Blockem" -msgstr "Blokdem" - -#: blockem.php:120 -#, php-format -msgid "Filtered user: %s" -msgstr "Filtreret bruger: %s" - -#: blockem.php:183 -msgid "Unblock Author" -msgstr "Fjern blokering af forfatter" - -#: blockem.php:185 -msgid "Block Author" -msgstr "Blokér forfatter" diff --git a/blockem/lang/da-dk/strings.php b/blockem/lang/da-dk/strings.php deleted file mode 100644 index e99144ec..00000000 --- a/blockem/lang/da-dk/strings.php +++ /dev/null @@ -1,13 +0,0 @@ -strings['Hides user\'s content by collapsing posts. Also replaces their avatar with generic image.'] = 'Skjul brugers indhold ved at kollapse deres opslag. Erstatter også deres avatar med et generisk billede.'; -$a->strings['Comma separated profile URLS:'] = 'Kommasepareret liste over profil-URL\'s:'; -$a->strings['Blockem'] = 'Blokdem'; -$a->strings['Filtered user: %s'] = 'Filtreret bruger: %s'; -$a->strings['Unblock Author'] = 'Fjern blokering af forfatter'; -$a->strings['Block Author'] = 'Blokér forfatter'; diff --git a/blockem/lang/de/messages.po b/blockem/lang/de/messages.po deleted file mode 100644 index d1e2f704..00000000 --- a/blockem/lang/de/messages.po +++ /dev/null @@ -1,50 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -# Translators: -# Andreas H., 2018 -# Tobias Diekershoff , 2014 -# Tobias Diekershoff , 2018 -# Ulf Rompe , 2019 -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-21 19:13-0500\n" -"PO-Revision-Date: 2021-12-22 15:27+0000\n" -"Last-Translator: Transifex Bot <>\n" -"Language-Team: German (http://www.transifex.com/Friendica/friendica/language/de/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: de\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: blockem.php:39 -msgid "" -"Hides user's content by collapsing posts. Also replaces their avatar with " -"generic image." -msgstr "Verbirgt Inhalte von Benutzern durch Zusammenklappen der Beiträge. Des Weiteren wird das Profilbild durch einen generischen Avatar ersetzt." - -#: blockem.php:40 -msgid "Comma separated profile URLS:" -msgstr "Komma-separierte Liste von Profil-URLs" - -#: blockem.php:45 -msgid "Blockem" -msgstr "Blockem" - -#: blockem.php:120 -#, php-format -msgid "Filtered user: %s" -msgstr "Gefilterte Person: %s" - -#: blockem.php:183 -msgid "Unblock Author" -msgstr "Autor freischalten" - -#: blockem.php:185 -msgid "Block Author" -msgstr "Autor blockieren" diff --git a/blockem/lang/de/strings.php b/blockem/lang/de/strings.php deleted file mode 100644 index 109af368..00000000 --- a/blockem/lang/de/strings.php +++ /dev/null @@ -1,13 +0,0 @@ -strings['Hides user\'s content by collapsing posts. Also replaces their avatar with generic image.'] = 'Verbirgt Inhalte von Benutzern durch Zusammenklappen der Beiträge. Des Weiteren wird das Profilbild durch einen generischen Avatar ersetzt.'; -$a->strings['Comma separated profile URLS:'] = 'Komma-separierte Liste von Profil-URLs'; -$a->strings['Blockem'] = 'Blockem'; -$a->strings['Filtered user: %s'] = 'Gefilterte Person: %s'; -$a->strings['Unblock Author'] = 'Autor freischalten'; -$a->strings['Block Author'] = 'Autor blockieren'; diff --git a/blockem/lang/en-gb/messages.po b/blockem/lang/en-gb/messages.po deleted file mode 100644 index 6bcc7b9b..00000000 --- a/blockem/lang/en-gb/messages.po +++ /dev/null @@ -1,59 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -# Translators: -# Andy H3 , 2018 -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-02-09 13:00+0100\n" -"PO-Revision-Date: 2018-03-15 14:10+0000\n" -"Last-Translator: Andy H3 \n" -"Language-Team: English (United Kingdom) (http://www.transifex.com/Friendica/friendica/language/en_GB/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: en_GB\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: blockem.php:51 blockem.php:55 -msgid "\"Blockem\"" -msgstr "\"Blockem\"" - -#: blockem.php:59 -msgid "" -"Hides user's content by collapsing posts. Also replaces their avatar with " -"generic image." -msgstr "Hides user's content by collapsing posts. Also replaces their avatar with generic image." - -#: blockem.php:60 -msgid "Comma separated profile URLS:" -msgstr "Comma separated profile URLs:" - -#: blockem.php:64 -msgid "Save Settings" -msgstr "Save settings" - -#: blockem.php:77 -msgid "BLOCKEM Settings saved." -msgstr "Blockem settings saved." - -#: blockem.php:140 -#, php-format -msgid "Hidden content by %s - Click to open/close" -msgstr "Hidden content by %s - Reveal/hide" - -#: blockem.php:193 -msgid "Unblock Author" -msgstr "Unblock author" - -#: blockem.php:195 -msgid "Block Author" -msgstr "Block author" - -#: blockem.php:227 -msgid "blockem settings updated" -msgstr "Blockem settings updated" diff --git a/blockem/lang/en-gb/strings.php b/blockem/lang/en-gb/strings.php deleted file mode 100644 index 0b9d9e4b..00000000 --- a/blockem/lang/en-gb/strings.php +++ /dev/null @@ -1,16 +0,0 @@ -strings['"Blockem"'] = '"Blockem"'; -$a->strings['Hides user\'s content by collapsing posts. Also replaces their avatar with generic image.'] = 'Hides user\'s content by collapsing posts. Also replaces their avatar with generic image.'; -$a->strings['Comma separated profile URLS:'] = 'Comma separated profile URLs:'; -$a->strings['Save Settings'] = 'Save settings'; -$a->strings['BLOCKEM Settings saved.'] = 'Blockem settings saved.'; -$a->strings['Hidden content by %s - Click to open/close'] = 'Hidden content by %s - Reveal/hide'; -$a->strings['Unblock Author'] = 'Unblock author'; -$a->strings['Block Author'] = 'Block author'; -$a->strings['blockem settings updated'] = 'Blockem settings updated'; diff --git a/blockem/lang/en-us/messages.po b/blockem/lang/en-us/messages.po deleted file mode 100644 index 1d64620b..00000000 --- a/blockem/lang/en-us/messages.po +++ /dev/null @@ -1,61 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -# Translators: -# Adam Clark , 2018 -# Andy H3 , 2018 -# R C , 2018 -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-04-01 11:11-0400\n" -"PO-Revision-Date: 2018-06-13 02:40+0000\n" -"Last-Translator: R C \n" -"Language-Team: English (United States) (http://www.transifex.com/Friendica/friendica/language/en_US/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: en_US\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: blockem.php:52 blockem.php:56 -msgid "\"Blockem\"" -msgstr "Blockem" - -#: blockem.php:60 -msgid "" -"Hides user's content by collapsing posts. Also replaces their avatar with " -"generic image." -msgstr "Hides user's content by collapsing posts. Also replaces their avatar with generic image." - -#: blockem.php:61 -msgid "Comma separated profile URLS:" -msgstr "Comma-separated profile URLs:" - -#: blockem.php:65 -msgid "Save Settings" -msgstr "Save settings" - -#: blockem.php:78 -msgid "BLOCKEM Settings saved." -msgstr "Blockem settings saved." - -#: blockem.php:136 -#, php-format -msgid "Filtered user: %s" -msgstr "Filtered user: %s" - -#: blockem.php:189 -msgid "Unblock Author" -msgstr "Unblock author" - -#: blockem.php:191 -msgid "Block Author" -msgstr "Block author" - -#: blockem.php:223 -msgid "blockem settings updated" -msgstr "Blockem settings updated" diff --git a/blockem/lang/en-us/strings.php b/blockem/lang/en-us/strings.php deleted file mode 100644 index fd76a1bc..00000000 --- a/blockem/lang/en-us/strings.php +++ /dev/null @@ -1,16 +0,0 @@ -strings['"Blockem"'] = 'Blockem'; -$a->strings['Hides user\'s content by collapsing posts. Also replaces their avatar with generic image.'] = 'Hides user\'s content by collapsing posts. Also replaces their avatar with generic image.'; -$a->strings['Comma separated profile URLS:'] = 'Comma-separated profile URLs:'; -$a->strings['Save Settings'] = 'Save settings'; -$a->strings['BLOCKEM Settings saved.'] = 'Blockem settings saved.'; -$a->strings['Filtered user: %s'] = 'Filtered user: %s'; -$a->strings['Unblock Author'] = 'Unblock author'; -$a->strings['Block Author'] = 'Block author'; -$a->strings['blockem settings updated'] = 'Blockem settings updated'; diff --git a/blockem/lang/eo/strings.php b/blockem/lang/eo/strings.php deleted file mode 100644 index b6116507..00000000 --- a/blockem/lang/eo/strings.php +++ /dev/null @@ -1,10 +0,0 @@ -strings["\"Blockem\" Settings"] = "\"Blockem\" Agordoj"; -$a->strings["Comma separated profile URLS to block"] = "Blokotaj URL adresoj, disigita per komo"; -$a->strings["Submit"] = "Sendi"; -$a->strings["BLOCKEM Settings saved."] = "Konservis Agordojn de BLOCKEM."; -$a->strings["Blocked %s - Click to open/close"] = "%s blokita - Klaku por malfermi/fermi"; -$a->strings["Unblock Author"] = "Malbloki Aŭtoron"; -$a->strings["Block Author"] = "Bloki Aŭtoron"; -$a->strings["blockem settings updated"] = "Ĝisdatigis la blockem agordojn"; diff --git a/blockem/lang/es/messages.po b/blockem/lang/es/messages.po deleted file mode 100644 index 0b59921e..00000000 --- a/blockem/lang/es/messages.po +++ /dev/null @@ -1,53 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -# Translators: -# Albert, 2018 -# Senex Petrovic , 2021 -# Tupambae.org, 2016 -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-01 18:15+0100\n" -"PO-Revision-Date: 2021-04-01 09:45+0000\n" -"Last-Translator: Senex Petrovic \n" -"Language-Team: Spanish (http://www.transifex.com/Friendica/friendica/language/es/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: es\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: blockem.php:42 blockem.php:46 -msgid "Blockem" -msgstr "Blockem (Bloquealos)" - -#: blockem.php:50 -msgid "" -"Hides user's content by collapsing posts. Also replaces their avatar with " -"generic image." -msgstr "Oculta el contenido del usuario al colapsar las publicaciones. También reemplaza su avatar con una imagen genérica." - -#: blockem.php:51 -msgid "Comma separated profile URLS:" -msgstr "URLs de perfil separadas por comas:" - -#: blockem.php:55 -msgid "Save Settings" -msgstr "Guardar configuración" - -#: blockem.php:131 -#, php-format -msgid "Filtered user: %s" -msgstr "Usuario filtrado: %s" - -#: blockem.php:190 -msgid "Unblock Author" -msgstr "Desbloquear autor" - -#: blockem.php:192 -msgid "Block Author" -msgstr "Bloquear autor" diff --git a/blockem/lang/es/strings.php b/blockem/lang/es/strings.php deleted file mode 100644 index 7d1de601..00000000 --- a/blockem/lang/es/strings.php +++ /dev/null @@ -1,14 +0,0 @@ -strings['Blockem'] = 'Blockem (Bloquealos)'; -$a->strings['Hides user\'s content by collapsing posts. Also replaces their avatar with generic image.'] = 'Oculta el contenido del usuario al colapsar las publicaciones. También reemplaza su avatar con una imagen genérica.'; -$a->strings['Comma separated profile URLS:'] = 'URLs de perfil separadas por comas:'; -$a->strings['Save Settings'] = 'Guardar configuración'; -$a->strings['Filtered user: %s'] = 'Usuario filtrado: %s'; -$a->strings['Unblock Author'] = 'Desbloquear autor'; -$a->strings['Block Author'] = 'Bloquear autor'; diff --git a/blockem/lang/fi-fi/messages.po b/blockem/lang/fi-fi/messages.po deleted file mode 100644 index 4fac9aa7..00000000 --- a/blockem/lang/fi-fi/messages.po +++ /dev/null @@ -1,60 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -# Translators: -# Kris, 2018 -# Kris, 2018 -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-04-01 11:11-0400\n" -"PO-Revision-Date: 2018-04-18 14:44+0000\n" -"Last-Translator: Kris\n" -"Language-Team: Finnish (Finland) (http://www.transifex.com/Friendica/friendica/language/fi_FI/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: fi_FI\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: blockem.php:52 blockem.php:56 -msgid "\"Blockem\"" -msgstr "\"Blockem\"" - -#: blockem.php:60 -msgid "" -"Hides user's content by collapsing posts. Also replaces their avatar with " -"generic image." -msgstr "" - -#: blockem.php:61 -msgid "Comma separated profile URLS:" -msgstr "Profiilien URL-osoitteet pilkulla erotettuina:" - -#: blockem.php:65 -msgid "Save Settings" -msgstr "Tallenna asetukset" - -#: blockem.php:78 -msgid "BLOCKEM Settings saved." -msgstr "Blockem -asetukset tallennettu" - -#: blockem.php:136 -#, php-format -msgid "Filtered user: %s" -msgstr "Suodatettu käyttäjä: %s" - -#: blockem.php:189 -msgid "Unblock Author" -msgstr "Poista kirjoittaja estolistalta" - -#: blockem.php:191 -msgid "Block Author" -msgstr "Lisää kirjoittaja estolistalle" - -#: blockem.php:223 -msgid "blockem settings updated" -msgstr "blockem -asetukset päivitetty" diff --git a/blockem/lang/fi-fi/strings.php b/blockem/lang/fi-fi/strings.php deleted file mode 100644 index d15b4a56..00000000 --- a/blockem/lang/fi-fi/strings.php +++ /dev/null @@ -1,15 +0,0 @@ -strings['"Blockem"'] = '"Blockem"'; -$a->strings['Comma separated profile URLS:'] = 'Profiilien URL-osoitteet pilkulla erotettuina:'; -$a->strings['Save Settings'] = 'Tallenna asetukset'; -$a->strings['BLOCKEM Settings saved.'] = 'Blockem -asetukset tallennettu'; -$a->strings['Filtered user: %s'] = 'Suodatettu käyttäjä: %s'; -$a->strings['Unblock Author'] = 'Poista kirjoittaja estolistalta'; -$a->strings['Block Author'] = 'Lisää kirjoittaja estolistalle'; -$a->strings['blockem settings updated'] = 'blockem -asetukset päivitetty'; diff --git a/blockem/lang/fr/messages.po b/blockem/lang/fr/messages.po deleted file mode 100644 index d3617290..00000000 --- a/blockem/lang/fr/messages.po +++ /dev/null @@ -1,50 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -# Translators: -# Hypolite Petovan , 2016 -# Marie Olive , 2018 -# StefOfficiel , 2015 -# Vladimir Núñez , 2018 -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-21 19:13-0500\n" -"PO-Revision-Date: 2014-06-22 11:20+0000\n" -"Last-Translator: Vladimir Núñez , 2018\n" -"Language-Team: French (http://www.transifex.com/Friendica/friendica/language/fr/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: fr\n" -"Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n" - -#: blockem.php:39 -msgid "" -"Hides user's content by collapsing posts. Also replaces their avatar with " -"generic image." -msgstr "Cache le contenu de l'utilisateur en contractant les publications. Remplace aussi leur avatar par une image générique." - -#: blockem.php:40 -msgid "Comma separated profile URLS:" -msgstr "URLs de profil séparées par des virgules:" - -#: blockem.php:45 -msgid "Blockem" -msgstr "Bloquez-les" - -#: blockem.php:120 -#, php-format -msgid "Filtered user: %s" -msgstr "Utilisateur filtré:%s" - -#: blockem.php:183 -msgid "Unblock Author" -msgstr "Débloquer l'Auteur" - -#: blockem.php:185 -msgid "Block Author" -msgstr "Bloquer l'Auteur" diff --git a/blockem/lang/fr/strings.php b/blockem/lang/fr/strings.php deleted file mode 100644 index 26b86f24..00000000 --- a/blockem/lang/fr/strings.php +++ /dev/null @@ -1,13 +0,0 @@ -strings['Hides user\'s content by collapsing posts. Also replaces their avatar with generic image.'] = 'Cache le contenu de l\'utilisateur en contractant les publications. Remplace aussi leur avatar par une image générique.'; -$a->strings['Comma separated profile URLS:'] = 'URLs de profil séparées par des virgules:'; -$a->strings['Blockem'] = 'Bloquez-les'; -$a->strings['Filtered user: %s'] = 'Utilisateur filtré:%s'; -$a->strings['Unblock Author'] = 'Débloquer l\'Auteur'; -$a->strings['Block Author'] = 'Bloquer l\'Auteur'; diff --git a/blockem/lang/hu/messages.po b/blockem/lang/hu/messages.po deleted file mode 100644 index 3a29b820..00000000 --- a/blockem/lang/hu/messages.po +++ /dev/null @@ -1,47 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -# Translators: -# Balázs Úr, 2020 -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-21 19:13-0500\n" -"PO-Revision-Date: 2014-06-22 11:20+0000\n" -"Last-Translator: Balázs Úr, 2020\n" -"Language-Team: Hungarian (http://www.transifex.com/Friendica/friendica/language/hu/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: hu\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: blockem.php:39 -msgid "" -"Hides user's content by collapsing posts. Also replaces their avatar with " -"generic image." -msgstr "Elrejti a felhasználók tartalmát a bejegyzések összecsukásával. Ezenkívül lecseréli a profilképeiket egy általános képre." - -#: blockem.php:40 -msgid "Comma separated profile URLS:" -msgstr "Profil URL-ek vesszővel elválasztva:" - -#: blockem.php:45 -msgid "Blockem" -msgstr "Blockem" - -#: blockem.php:120 -#, php-format -msgid "Filtered user: %s" -msgstr "Kiszűrt felhasználó: %s" - -#: blockem.php:183 -msgid "Unblock Author" -msgstr "Szerző tiltásának feloldása" - -#: blockem.php:185 -msgid "Block Author" -msgstr "Szerző tiltása" diff --git a/blockem/lang/hu/strings.php b/blockem/lang/hu/strings.php deleted file mode 100644 index 5a3abfec..00000000 --- a/blockem/lang/hu/strings.php +++ /dev/null @@ -1,13 +0,0 @@ -strings['Hides user\'s content by collapsing posts. Also replaces their avatar with generic image.'] = 'Elrejti a felhasználók tartalmát a bejegyzések összecsukásával. Ezenkívül lecseréli a profilképeiket egy általános képre.'; -$a->strings['Comma separated profile URLS:'] = 'Profil URL-ek vesszővel elválasztva:'; -$a->strings['Blockem'] = 'Blockem'; -$a->strings['Filtered user: %s'] = 'Kiszűrt felhasználó: %s'; -$a->strings['Unblock Author'] = 'Szerző tiltásának feloldása'; -$a->strings['Block Author'] = 'Szerző tiltása'; diff --git a/blockem/lang/is/strings.php b/blockem/lang/is/strings.php deleted file mode 100644 index 3075c457..00000000 --- a/blockem/lang/is/strings.php +++ /dev/null @@ -1,10 +0,0 @@ -strings["\"Blockem\" Settings"] = "\"Blockem\" stillingar"; -$a->strings["Comma separated profile URLS to block"] = "Banna lista af forsíðum (komma á milli)"; -$a->strings["Submit"] = "Senda inn"; -$a->strings["BLOCKEM Settings saved."] = "BLOCKEM stillingar vistaðar."; -$a->strings["Blocked %s - Click to open/close"] = "%s sett í straff - Smella til að taka úr/setja á"; -$a->strings["Unblock Author"] = "Leyfa notanda"; -$a->strings["Block Author"] = "Banna notanda"; -$a->strings["blockem settings updated"] = ""; diff --git a/blockem/lang/it/messages.po b/blockem/lang/it/messages.po deleted file mode 100644 index cdf74f99..00000000 --- a/blockem/lang/it/messages.po +++ /dev/null @@ -1,59 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -# Translators: -# fabrixxm , 2014,2018-2019 -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-17 10:23+0200\n" -"PO-Revision-Date: 2019-03-11 14:21+0000\n" -"Last-Translator: fabrixxm \n" -"Language-Team: Italian (http://www.transifex.com/Friendica/friendica/language/it/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: it\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: blockem.php:54 blockem.php:58 -msgid "Blockem" -msgstr "Blockem" - -#: blockem.php:62 -msgid "" -"Hides user's content by collapsing posts. Also replaces their avatar with " -"generic image." -msgstr "Nascondi il contenuto degli utenti collassando i messaggi. Sostituisce anche gli avatar con un'immagine generica." - -#: blockem.php:63 -msgid "Comma separated profile URLS:" -msgstr "URL profili separati da virgola:" - -#: blockem.php:67 -msgid "Save Settings" -msgstr "Salva Impostazioni" - -#: blockem.php:81 -msgid "BLOCKEM Settings saved." -msgstr "Impostazioni BLOCKEM salvate." - -#: blockem.php:143 -#, php-format -msgid "Filtered user: %s" -msgstr "Utente filtrato: %s" - -#: blockem.php:202 -msgid "Unblock Author" -msgstr "Sblocca autore" - -#: blockem.php:204 -msgid "Block Author" -msgstr "Blocca autore" - -#: blockem.php:244 -msgid "blockem settings updated" -msgstr "Impostazioni 'blockem' aggiornate." diff --git a/blockem/lang/it/strings.php b/blockem/lang/it/strings.php deleted file mode 100644 index aa73286a..00000000 --- a/blockem/lang/it/strings.php +++ /dev/null @@ -1,16 +0,0 @@ -strings['Blockem'] = 'Blockem'; -$a->strings['Hides user\'s content by collapsing posts. Also replaces their avatar with generic image.'] = 'Nascondi il contenuto degli utenti collassando i messaggi. Sostituisce anche gli avatar con un\'immagine generica.'; -$a->strings['Comma separated profile URLS:'] = 'URL profili separati da virgola:'; -$a->strings['Save Settings'] = 'Salva Impostazioni'; -$a->strings['BLOCKEM Settings saved.'] = 'Impostazioni BLOCKEM salvate.'; -$a->strings['Filtered user: %s'] = 'Utente filtrato: %s'; -$a->strings['Unblock Author'] = 'Sblocca autore'; -$a->strings['Block Author'] = 'Blocca autore'; -$a->strings['blockem settings updated'] = 'Impostazioni \'blockem\' aggiornate.'; diff --git a/blockem/lang/nb-no/strings.php b/blockem/lang/nb-no/strings.php deleted file mode 100644 index 0dd6660d..00000000 --- a/blockem/lang/nb-no/strings.php +++ /dev/null @@ -1,10 +0,0 @@ -strings["\"Blockem\" Settings"] = ""; -$a->strings["Comma separated profile URLS to block"] = ""; -$a->strings["Submit"] = "Lagre"; -$a->strings["BLOCKEM Settings saved."] = ""; -$a->strings["Blocked %s - Click to open/close"] = ""; -$a->strings["Unblock Author"] = ""; -$a->strings["Block Author"] = ""; -$a->strings["blockem settings updated"] = ""; diff --git a/blockem/lang/nl/messages.po b/blockem/lang/nl/messages.po deleted file mode 100644 index f8bde25c..00000000 --- a/blockem/lang/nl/messages.po +++ /dev/null @@ -1,60 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -# Translators: -# AgnesElisa , 2018 -# Jeroen De Meerleer , 2018 -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-17 10:23+0200\n" -"PO-Revision-Date: 2018-08-24 13:49+0000\n" -"Last-Translator: Jeroen De Meerleer \n" -"Language-Team: Dutch (http://www.transifex.com/Friendica/friendica/language/nl/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: nl\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: blockem.php:54 blockem.php:58 -msgid "Blockem" -msgstr "Blockem" - -#: blockem.php:62 -msgid "" -"Hides user's content by collapsing posts. Also replaces their avatar with " -"generic image." -msgstr "Verbergt de inhoud van het bericht van de gebruiker. Daarnaast vervangt het de avatar door een standaardafbeelding." - -#: blockem.php:63 -msgid "Comma separated profile URLS:" -msgstr "Profiel URLs (kommagescheiden):" - -#: blockem.php:67 -msgid "Save Settings" -msgstr "Instellingen opslaan" - -#: blockem.php:81 -msgid "BLOCKEM Settings saved." -msgstr "BLOCKEM instellingen opgeslagen." - -#: blockem.php:143 -#, php-format -msgid "Filtered user: %s" -msgstr "Gefilterde gebruiker: %s" - -#: blockem.php:202 -msgid "Unblock Author" -msgstr "Deblokkeer Auteur" - -#: blockem.php:204 -msgid "Block Author" -msgstr "Auteur blokkeren" - -#: blockem.php:244 -msgid "blockem settings updated" -msgstr "blockem instellingen opgeslagen" diff --git a/blockem/lang/nl/strings.php b/blockem/lang/nl/strings.php deleted file mode 100644 index b523cdc4..00000000 --- a/blockem/lang/nl/strings.php +++ /dev/null @@ -1,16 +0,0 @@ -strings['Blockem'] = 'Blockem'; -$a->strings['Hides user\'s content by collapsing posts. Also replaces their avatar with generic image.'] = 'Verbergt de inhoud van het bericht van de gebruiker. Daarnaast vervangt het de avatar door een standaardafbeelding.'; -$a->strings['Comma separated profile URLS:'] = 'Profiel URLs (kommagescheiden):'; -$a->strings['Save Settings'] = 'Instellingen opslaan'; -$a->strings['BLOCKEM Settings saved.'] = 'BLOCKEM instellingen opgeslagen.'; -$a->strings['Filtered user: %s'] = 'Gefilterde gebruiker: %s'; -$a->strings['Unblock Author'] = 'Deblokkeer Auteur'; -$a->strings['Block Author'] = 'Auteur blokkeren'; -$a->strings['blockem settings updated'] = 'blockem instellingen opgeslagen'; diff --git a/blockem/lang/pl/messages.po b/blockem/lang/pl/messages.po deleted file mode 100644 index 8e70e0b5..00000000 --- a/blockem/lang/pl/messages.po +++ /dev/null @@ -1,47 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -# Translators: -# Waldemar Stoczkowski, 2018 -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-21 19:13-0500\n" -"PO-Revision-Date: 2014-06-22 11:20+0000\n" -"Last-Translator: Waldemar Stoczkowski, 2018\n" -"Language-Team: Polish (http://www.transifex.com/Friendica/friendica/language/pl/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: pl\n" -"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n" - -#: blockem.php:39 -msgid "" -"Hides user's content by collapsing posts. Also replaces their avatar with " -"generic image." -msgstr "Ukrywa zawartość użytkownika, zwijając posty. Zastępuje również awatar wygenerowanym obrazem." - -#: blockem.php:40 -msgid "Comma separated profile URLS:" -msgstr "Rozdzielone przecinkami adresy URL profilu:" - -#: blockem.php:45 -msgid "Blockem" -msgstr "Zablokowanie" - -#: blockem.php:120 -#, php-format -msgid "Filtered user: %s" -msgstr "Użytkownik filtrowany: %s" - -#: blockem.php:183 -msgid "Unblock Author" -msgstr "Odblokuj autora" - -#: blockem.php:185 -msgid "Block Author" -msgstr "Zablokuj autora" diff --git a/blockem/lang/pl/strings.php b/blockem/lang/pl/strings.php deleted file mode 100644 index 49951a68..00000000 --- a/blockem/lang/pl/strings.php +++ /dev/null @@ -1,13 +0,0 @@ -=2 && $n%10<=4) && ($n%100<12 || $n%100>14)) { return 1; } else if ($n!=1 && ($n%10>=0 && $n%10<=1) || ($n%10>=5 && $n%10<=9) || ($n%100>=12 && $n%100<=14)) { return 2; } else { return 3; } -}} -$a->strings['Hides user\'s content by collapsing posts. Also replaces their avatar with generic image.'] = 'Ukrywa zawartość użytkownika, zwijając posty. Zastępuje również awatar wygenerowanym obrazem.'; -$a->strings['Comma separated profile URLS:'] = 'Rozdzielone przecinkami adresy URL profilu:'; -$a->strings['Blockem'] = 'Zablokowanie'; -$a->strings['Filtered user: %s'] = 'Użytkownik filtrowany: %s'; -$a->strings['Unblock Author'] = 'Odblokuj autora'; -$a->strings['Block Author'] = 'Zablokuj autora'; diff --git a/blockem/lang/pt-br/strings.php b/blockem/lang/pt-br/strings.php deleted file mode 100644 index 49f69cc3..00000000 --- a/blockem/lang/pt-br/strings.php +++ /dev/null @@ -1,10 +0,0 @@ -strings["\"Blockem\" Settings"] = "Configurações \"Blockem\""; -$a->strings["Comma separated profile URLS to block"] = "URLS de perfis separados por vírgulas a serem bloqueados"; -$a->strings["Submit"] = "Enviar"; -$a->strings["BLOCKEM Settings saved."] = "Configurações BLOCKEM armazenadas."; -$a->strings["Blocked %s - Click to open/close"] = "Bloqueado %s - Clique para abrir/fechar"; -$a->strings["Unblock Author"] = "Desbloqueie Autor"; -$a->strings["Block Author"] = "Bloqueie Autor"; -$a->strings["blockem settings updated"] = "configurações blockem atualizadas"; diff --git a/blockem/lang/ro/messages.po b/blockem/lang/ro/messages.po deleted file mode 100644 index a74e5757..00000000 --- a/blockem/lang/ro/messages.po +++ /dev/null @@ -1,52 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -# Translators: -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-06-22 13:18+0200\n" -"PO-Revision-Date: 2014-07-08 11:43+0000\n" -"Last-Translator: Arian - Cazare Muncitori \n" -"Language-Team: Romanian (Romania) (http://www.transifex.com/projects/p/friendica/language/ro_RO/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: ro_RO\n" -"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n" - -#: blockem.php:53 blockem.php:57 -msgid "\"Blockem\"" -msgstr "\"Blockem\"" - -#: blockem.php:61 -msgid "Comma separated profile URLS to block" -msgstr "Adresele URL de profil, de blocat, separate prin virgulă" - -#: blockem.php:65 -msgid "Save Settings" -msgstr "Salvare Configurări" - -#: blockem.php:78 -msgid "BLOCKEM Settings saved." -msgstr "Configurările BLOCKEM au fost salvate." - -#: blockem.php:142 -#, php-format -msgid "Blocked %s - Click to open/close" -msgstr "%s Blocate - Apăsați pentru a deschide/închide" - -#: blockem.php:197 -msgid "Unblock Author" -msgstr "Deblocare Autor" - -#: blockem.php:199 -msgid "Block Author" -msgstr "Blocare Autor" - -#: blockem.php:231 -msgid "blockem settings updated" -msgstr "Configurările blockem au fost actualizate" diff --git a/blockem/lang/ro/strings.php b/blockem/lang/ro/strings.php deleted file mode 100644 index 6fc8a094..00000000 --- a/blockem/lang/ro/strings.php +++ /dev/null @@ -1,15 +0,0 @@ -19)||(($n%100==0)&&($n!=0)))) { return 2; } else { return 1; } -}} -$a->strings['"Blockem"'] = '"Blockem"'; -$a->strings['Comma separated profile URLS to block'] = 'Adresele URL de profil, de blocat, separate prin virgulă'; -$a->strings['Save Settings'] = 'Salvare Configurări'; -$a->strings['BLOCKEM Settings saved.'] = 'Configurările BLOCKEM au fost salvate.'; -$a->strings['Blocked %s - Click to open/close'] = '%s Blocate - Apăsați pentru a deschide/închide'; -$a->strings['Unblock Author'] = 'Deblocare Autor'; -$a->strings['Block Author'] = 'Blocare Autor'; -$a->strings['blockem settings updated'] = 'Configurările blockem au fost actualizate'; diff --git a/blockem/lang/ru/messages.po b/blockem/lang/ru/messages.po deleted file mode 100644 index 22427327..00000000 --- a/blockem/lang/ru/messages.po +++ /dev/null @@ -1,60 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -# Translators: -# Alexander An , 2020 -# Stanislav N. , 2017-2018 -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-08-17 10:23+0200\n" -"PO-Revision-Date: 2020-04-23 14:13+0000\n" -"Last-Translator: Alexander An \n" -"Language-Team: Russian (http://www.transifex.com/Friendica/friendica/language/ru/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: ru\n" -"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" - -#: blockem.php:54 blockem.php:58 -msgid "Blockem" -msgstr "Blockem" - -#: blockem.php:62 -msgid "" -"Hides user's content by collapsing posts. Also replaces their avatar with " -"generic image." -msgstr "Скрыть контент пользователя. Также заменяет его аватар изображением по-умолчанию." - -#: blockem.php:63 -msgid "Comma separated profile URLS:" -msgstr "URL профилей, разделенные запятыми:" - -#: blockem.php:67 -msgid "Save Settings" -msgstr "Сохранить настройки" - -#: blockem.php:81 -msgid "BLOCKEM Settings saved." -msgstr "BLOCKEM Настройки сохранены." - -#: blockem.php:143 -#, php-format -msgid "Filtered user: %s" -msgstr "Отфильтрованный пользователь: %s" - -#: blockem.php:202 -msgid "Unblock Author" -msgstr "Разблокировать автора" - -#: blockem.php:204 -msgid "Block Author" -msgstr "Блокировать автора" - -#: blockem.php:244 -msgid "blockem settings updated" -msgstr "Настройки Blockem обновлены" diff --git a/blockem/lang/ru/strings.php b/blockem/lang/ru/strings.php deleted file mode 100644 index ef586740..00000000 --- a/blockem/lang/ru/strings.php +++ /dev/null @@ -1,16 +0,0 @@ -=2 && $n%10<=4 && ($n%100<12 || $n%100>14)) { return 1; } else if ($n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)) { return 2; } else { return 3; } -}} -$a->strings['Blockem'] = 'Blockem'; -$a->strings['Hides user\'s content by collapsing posts. Also replaces their avatar with generic image.'] = 'Скрыть контент пользователя. Также заменяет его аватар изображением по-умолчанию.'; -$a->strings['Comma separated profile URLS:'] = 'URL профилей, разделенные запятыми:'; -$a->strings['Save Settings'] = 'Сохранить настройки'; -$a->strings['BLOCKEM Settings saved.'] = 'BLOCKEM Настройки сохранены.'; -$a->strings['Filtered user: %s'] = 'Отфильтрованный пользователь: %s'; -$a->strings['Unblock Author'] = 'Разблокировать автора'; -$a->strings['Block Author'] = 'Блокировать автора'; -$a->strings['blockem settings updated'] = 'Настройки Blockem обновлены'; diff --git a/blockem/lang/sv/messages.po b/blockem/lang/sv/messages.po deleted file mode 100644 index ede8ee94..00000000 --- a/blockem/lang/sv/messages.po +++ /dev/null @@ -1,47 +0,0 @@ -# ADDON blockem -# Copyright (C) -# This file is distributed under the same license as the Friendica blockem addon package. -# -# -# Translators: -# Bjoessi , 2019 -msgid "" -msgstr "" -"Project-Id-Version: friendica\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-21 19:13-0500\n" -"PO-Revision-Date: 2021-12-22 15:27+0000\n" -"Last-Translator: Transifex Bot <>\n" -"Language-Team: Swedish (http://www.transifex.com/Friendica/friendica/language/sv/)\n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Language: sv\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" - -#: blockem.php:39 -msgid "" -"Hides user's content by collapsing posts. Also replaces their avatar with " -"generic image." -msgstr "Döljer användares inlägg genom sammanslagning nedåt. Användarens profilbild ersätts med en standardbild." - -#: blockem.php:40 -msgid "Comma separated profile URLS:" -msgstr "Kommaseparerade profiladresser:" - -#: blockem.php:45 -msgid "Blockem" -msgstr "BLOCKEM" - -#: blockem.php:120 -#, php-format -msgid "Filtered user: %s" -msgstr "Filtrerat på användare:%s" - -#: blockem.php:183 -msgid "Unblock Author" -msgstr "Avblockera författare" - -#: blockem.php:185 -msgid "Block Author" -msgstr "Blockera författare" diff --git a/blockem/lang/sv/strings.php b/blockem/lang/sv/strings.php deleted file mode 100644 index 724e2d23..00000000 --- a/blockem/lang/sv/strings.php +++ /dev/null @@ -1,13 +0,0 @@ -strings['Hides user\'s content by collapsing posts. Also replaces their avatar with generic image.'] = 'Döljer användares inlägg genom sammanslagning nedåt. Användarens profilbild ersätts med en standardbild.'; -$a->strings['Comma separated profile URLS:'] = 'Kommaseparerade profiladresser:'; -$a->strings['Blockem'] = 'BLOCKEM'; -$a->strings['Filtered user: %s'] = 'Filtrerat på användare:%s'; -$a->strings['Unblock Author'] = 'Avblockera författare'; -$a->strings['Block Author'] = 'Blockera författare'; diff --git a/blockem/lang/zh-cn/strings.php b/blockem/lang/zh-cn/strings.php deleted file mode 100644 index 3a3dfaeb..00000000 --- a/blockem/lang/zh-cn/strings.php +++ /dev/null @@ -1,10 +0,0 @@ -strings["\"Blockem\" Settings"] = "「Blockem」配置"; -$a->strings["Comma separated profile URLS to block"] = "逗号分简介URL为栏"; -$a->strings["Submit"] = "提交"; -$a->strings["BLOCKEM Settings saved."] = "「Blockem」配置保存了。"; -$a->strings["Blocked %s - Click to open/close"] = "%s拦了-点击为开关"; -$a->strings["Unblock Author"] = "不拦作家"; -$a->strings["Block Author"] = "拦作家"; -$a->strings["blockem settings updated"] = "blockem设置更新了"; diff --git a/blockem/templates/settings.tpl b/blockem/templates/settings.tpl deleted file mode 100644 index 67398400..00000000 --- a/blockem/templates/settings.tpl +++ /dev/null @@ -1 +0,0 @@ -{{include file="field_textarea.tpl" field=$words}} diff --git a/bluesky/README.md b/bluesky/README.md new file mode 100644 index 00000000..bf900fcd --- /dev/null +++ b/bluesky/README.md @@ -0,0 +1,9 @@ +Bluesky Addon +============== + +This addon supports posting to and receiving posts from Bluesky. + +No setup is needed for the admins to make it work for their users. + +Bluesky itself is under development as well. It is planned to make it decentral. +The addon is prepared to support different servers. But it isn't enabled yet. \ No newline at end of file diff --git a/bluesky/bluesky.php b/bluesky/bluesky.php new file mode 100644 index 00000000..e1f096c7 --- /dev/null +++ b/bluesky/bluesky.php @@ -0,0 +1,1209 @@ + + * + * @todo + * Currently technical issues in the core: + * - Outgoing mentions + * + * At some point in time: + * - post videos + * - direct messages + * - Sending Quote shares https://atproto.com/lexicons/app-bsky-embed#appbskyembedrecord and https://atproto.com/lexicons/app-bsky-embed#appbskyembedrecordwithmedia + * + * Possibly not possible: + * - only fetch new posts + * + * Currently not possible, due to limitations in Friendica + * - mute contacts https://atproto.com/lexicons/app-bsky-graph#appbskygraphmuteactor + * - unmute contacts https://atproto.com/lexicons/app-bsky-graph#appbskygraphunmuteactor + * + * Possibly interesting: + * - https://atproto.com/lexicons/com-atproto-label#comatprotolabelsubscribelabels + */ + +use Friendica\Content\Text\BBCode; +use Friendica\Content\Text\Plaintext; +use Friendica\Core\Cache\Enum\Duration; +use Friendica\Core\Config\Util\ConfigFileManager; +use Friendica\Core\Hook; +use Friendica\Core\Protocol; +use Friendica\Core\Renderer; +use Friendica\Core\Worker; +use Friendica\Database\DBA; +use Friendica\DI; +use Friendica\Model\Contact; +use Friendica\Model\Conversation; +use Friendica\Model\Item; +use Friendica\Model\Photo; +use Friendica\Model\Post; +use Friendica\Model\User; +use Friendica\Object\Image; +use Friendica\Protocol\Activity; +use Friendica\Protocol\ATProtocol; +use Friendica\Protocol\Relay; +use Friendica\Util\DateTimeFormat; +use Friendica\Util\Strings; + +const BLUESKY_DEFAULT_POLL_INTERVAL = 10; // given in minutes +const BLUESKY_IMAGE_SIZE = [1000000, 500000, 100000, 50000]; + +function bluesky_install() +{ + Hook::register('load_config', __FILE__, 'bluesky_load_config'); + Hook::register('hook_fork', __FILE__, 'bluesky_hook_fork'); + Hook::register('post_local', __FILE__, 'bluesky_post_local'); + Hook::register('notifier_normal', __FILE__, 'bluesky_send'); + Hook::register('jot_networks', __FILE__, 'bluesky_jot_nets'); + Hook::register('connector_settings', __FILE__, 'bluesky_settings'); + Hook::register('connector_settings_post', __FILE__, 'bluesky_settings_post'); + Hook::register('cron', __FILE__, 'bluesky_cron'); + Hook::register('support_follow', __FILE__, 'bluesky_support_follow'); + Hook::register('follow', __FILE__, 'bluesky_follow'); + Hook::register('unfollow', __FILE__, 'bluesky_unfollow'); + Hook::register('block', __FILE__, 'bluesky_block'); + Hook::register('unblock', __FILE__, 'bluesky_unblock'); + Hook::register('check_item_notification', __FILE__, 'bluesky_check_item_notification'); + Hook::register('item_by_link', __FILE__, 'bluesky_item_by_link'); +} + +function bluesky_load_config(ConfigFileManager $loader) +{ + DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('bluesky'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); +} + +function bluesky_check_item_notification(array &$notification_data) +{ + if (empty($notification_data['uid'])) { + return; + } + + $did = DI::atProtocol()->getUserDid($notification_data['uid']); + if (empty($did)) { + return; + } + + $notification_data['profiles'][] = $did; +} + +function bluesky_item_by_link(array &$hookData) +{ + // Don't overwrite an existing result + if (isset($hookData['item_id'])) { + return; + } + + if (substr($hookData['uri'], 0, 5) != 'at://') { + if (!preg_match('#^' . ATProtocol::WEB . '/profile/(.+)/post/(.+)#', $hookData['uri'], $matches)) { + return; + } + + $did = DI::atProtocol()->getDid($matches[1]); + if (empty($did)) { + return; + } + + DI::logger()->debug('Found bluesky post', ['uri' => $hookData['uri'], 'did' => $did, 'cid' => $matches[2]]); + + $uri = 'at://' . $did . '/app.bsky.feed.post/' . $matches[2]; + } else { + $uri = $hookData['uri']; + } + + $uri = DI::atpProcessor()->fetchMissingPost($uri, $hookData['uid'], Item::PR_FETCHED, 0, 0); + DI::logger()->debug('Got post', ['uri' => $uri]); + if (!empty($uri)) { + $item = Post::selectFirst(['id'], ['uri' => $uri, 'uid' => $hookData['uid']]); + if (!empty($item['id'])) { + $hookData['item_id'] = $item['id']; + } + } +} + +function bluesky_support_follow(array &$data) +{ + if ($data['protocol'] == Protocol::BLUESKY) { + $data['result'] = true; + } +} + +function bluesky_follow(array &$hook_data) +{ + $token = DI::atProtocol()->getUserToken($hook_data['uid']); + if (empty($token)) { + return; + } + + DI::logger()->debug('Check if contact is bluesky', ['data' => $hook_data]); + $contact = DBA::selectFirst('contact', [], ['network' => Protocol::BLUESKY, 'nurl' => Strings::normaliseLink($hook_data['url']), 'uid' => [0, $hook_data['uid']]]); + if (empty($contact)) { + return; + } + + $record = [ + 'subject' => $contact['url'], + 'createdAt' => DateTimeFormat::utcNow(DateTimeFormat::ATOM), + '$type' => 'app.bsky.graph.follow' + ]; + + $post = [ + 'collection' => 'app.bsky.graph.follow', + 'repo' => DI::atProtocol()->getUserDid($hook_data['uid']), + 'record' => $record + ]; + + $activity = DI::atProtocol()->XRPCPost($hook_data['uid'], 'com.atproto.repo.createRecord', $post); + if (!empty($activity->uri)) { + $hook_data['contact'] = $contact; + DI::logger()->debug('Successfully start following', ['url' => $contact['url'], 'uri' => $activity->uri]); + } +} + +function bluesky_unfollow(array &$hook_data) +{ + $token = DI::atProtocol()->getUserToken($hook_data['uid']); + if (empty($token)) { + return; + } + + if ($hook_data['contact']['network'] != Protocol::BLUESKY) { + return; + } + + $data = DI::atProtocol()->XRPCGet('app.bsky.actor.getProfile', ['actor' => $hook_data['contact']['url']], $hook_data['uid']); + if (empty($data->viewer) || empty($data->viewer->following)) { + return; + } + + bluesky_delete_post($data->viewer->following, $hook_data['uid']); + + $hook_data['result'] = true; +} + +function bluesky_block(array &$hook_data) +{ + $token = DI::atProtocol()->getUserToken($hook_data['uid']); + if (empty($token)) { + return; + } + + if ($hook_data['contact']['network'] != Protocol::BLUESKY) { + return; + } + + $record = [ + 'subject' => $hook_data['contact']['url'], + 'createdAt' => DateTimeFormat::utcNow(DateTimeFormat::ATOM), + '$type' => 'app.bsky.graph.block' + ]; + + $post = [ + 'collection' => 'app.bsky.graph.block', + 'repo' => DI::atProtocol()->getUserDid($hook_data['uid']), + 'record' => $record + ]; + + $activity = DI::atProtocol()->XRPCPost($hook_data['uid'], 'com.atproto.repo.createRecord', $post); + if (!empty($activity->uri)) { + $ucid = Contact::getUserContactId($hook_data['contact']['id'], $hook_data['uid']); + if ($ucid) { + Contact::remove($ucid); + } + DI::logger()->debug('Successfully blocked contact', ['url' => $hook_data['contact']['url'], 'uri' => $activity->uri]); + } +} + +function bluesky_unblock(array &$hook_data) +{ + $token = DI::atProtocol()->getUserToken($hook_data['uid']); + if (empty($token)) { + return; + } + + if ($hook_data['contact']['network'] != Protocol::BLUESKY) { + return; + } + + $data = DI::atProtocol()->XRPCGet('app.bsky.actor.getProfile', ['actor' => $hook_data['contact']['url']], $hook_data['uid']); + if (empty($data->viewer) || empty($data->viewer->blocking)) { + return; + } + + bluesky_delete_post($data->viewer->blocking, $hook_data['uid']); + + $hook_data['result'] = true; +} + +function bluesky_addon_admin(string &$o) +{ + $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/bluesky/'); + + $o = Renderer::replaceMacros($t, [ + '$submit' => DI::l10n()->t('Save Settings'), + '$friendica_handles' => ['friendica_handles', DI::l10n()->t('Allow your users to use your hostname for their Bluesky handles'), DI::config()->get('bluesky', 'friendica_handles'), DI::l10n()->t('Before enabling this option, you have to setup a wildcard domain configuration and you have to enable wildcard requests in your webserver configuration. On Apache this is done by adding "ServerAlias *.%s" to your HTTP configuration. You don\'t need to change the HTTPS configuration.', DI::baseUrl()->getHost())], + ]); +} + +function bluesky_addon_admin_post() +{ + DI::config()->set('bluesky', 'friendica_handles', (bool)$_POST['friendica_handles']); +} + +function bluesky_settings(array &$data) +{ + if (!DI::userSession()->getLocalUserId()) { + return; + } + + $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'post') ?? false; + $def_enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'post_by_default') ?? false; + $pds = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'pds'); + $handle = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'handle'); + $did = DI::atProtocol()->getUserDid(DI::userSession()->getLocalUserId()); + $token = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'access_token'); + $import = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'import') ?? false; + $import_feeds = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'import_feeds') ?? false; + $complete_threads = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'complete_threads') ?? false; + $custom_handle = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'friendica_handle') ?? false; + + if (DI::config()->get('bluesky', 'friendica_handles')) { + $self = User::getById(DI::userSession()->getLocalUserId(), ['nickname']); + $host_handle = $self['nickname'] . '.' . DI::baseUrl()->getHost(); + $friendica_handle = ['bluesky_friendica_handle', DI::l10n()->t('Allow to use %s as your Bluesky handle.', $host_handle), $custom_handle, DI::l10n()->t('When enabled, you can use %s as your Bluesky handle. After you enabled this option, please go to https://bsky.app/settings and select to change your handle. Select that you have got your own domain. Then enter %s and select "No DNS Panel". Then select "Verify Text File".', $host_handle, $host_handle)]; + if ($custom_handle) { + $handle = $host_handle; + } + } else { + $friendica_handle = []; + } + + $t = Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/bluesky/'); + $html = Renderer::replaceMacros($t, [ + '$enable' => ['bluesky', DI::l10n()->t('Enable Bluesky Post Addon'), $enabled], + '$bydefault' => ['bluesky_bydefault', DI::l10n()->t('Post to Bluesky by default'), $def_enabled], + '$import' => ['bluesky_import', DI::l10n()->t('Import the remote timeline'), $import], + '$import_feeds' => ['bluesky_import_feeds', DI::l10n()->t('Import the pinned feeds'), $import_feeds, DI::l10n()->t('When activated, Posts will be imported from all the feeds that you pinned in Bluesky.')], + '$complete_threads' => ['bluesky_complete_threads', DI::l10n()->t('Complete the threads'), $complete_threads, DI::l10n()->t('When activated, the system fetches additional replies for the posts in the timeline. This leads to more complete threads.')], + '$custom_handle' => $friendica_handle, + '$pds' => ['bluesky_pds', DI::l10n()->t('Personal Data Server'), $pds, DI::l10n()->t('The personal data server (PDS) is the system that hosts your profile.'), '', 'readonly'], + '$handle' => ['bluesky_handle', DI::l10n()->t('Bluesky handle'), $handle, '', '', $custom_handle ? 'readonly' : ''], + '$did' => ['bluesky_did', DI::l10n()->t('Bluesky DID'), $did, DI::l10n()->t('This is the unique identifier. It will be fetched automatically, when the handle is entered.'), '', 'readonly'], + '$password' => ['bluesky_password', DI::l10n()->t('Bluesky app password'), '', DI::l10n()->t("Please don't add your real password here, but instead create a specific app password in the Bluesky settings.")], + '$status' => bluesky_get_status($handle, $did, $pds, $token), + ]); + + $data = [ + 'connector' => 'bluesky', + 'title' => DI::l10n()->t('Bluesky Import/Export'), + 'image' => 'images/bluesky.jpg', + 'enabled' => $enabled, + 'html' => $html, + ]; +} + +function bluesky_get_status(string $handle = null, string $did = null, string $pds = null, string $token = null): string +{ + if (empty($handle)) { + return DI::l10n()->t('You are not authenticated. Please enter your handle and the app password.'); + } + + $status = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'status') ?? ATProtocol::STATUS_UNKNOWN; + $message = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'status-message') ?? ''; + + // Fallback mechanism for connection that had been established before the introduction of the status + if ($status == ATProtocol::STATUS_UNKNOWN) { + if (empty($did)) { + $status = ATProtocol::STATUS_DID_FAIL; + } elseif (empty($pds)) { + $status = ATProtocol::STATUS_PDS_FAIL; + } elseif (!empty($token)) { + $status = ATProtocol::STATUS_TOKEN_OK; + } else { + $status = ATProtocol::STATUS_TOKEN_FAIL; + } + } + + switch ($status) { + case ATProtocol::STATUS_TOKEN_OK: + return DI::l10n()->t("You are authenticated to Bluesky. For security reasons the password isn't stored."); + case ATProtocol::STATUS_SUCCESS: + return DI::l10n()->t('The communication with the personal data server service (PDS) is established.'); + case ATProtocol::STATUS_API_FAIL; + return DI::l10n()->t('Communication issues with the personal data server service (PDS): %s', $message); + case ATProtocol::STATUS_DID_FAIL: + return DI::l10n()->t('The DID for the provided handle could not be detected. Please check if you entered the correct handle.'); + case ATProtocol::STATUS_PDS_FAIL: + return DI::l10n()->t('The personal data server service (PDS) could not be detected.'); + case ATProtocol::STATUS_TOKEN_FAIL: + return DI::l10n()->t('The authentication with the provided handle and password failed. Please check if you entered the correct password.'); + default: + return ''; + } +} + +function bluesky_settings_post(array &$b) +{ + if (empty($_POST['bluesky-submit'])) { + return; + } + + $old_pds = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'pds'); + $old_handle = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'handle'); + $old_did = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'did'); + + $handle = trim($_POST['bluesky_handle'], ' @'); + + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'post', intval($_POST['bluesky'])); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'post_by_default', intval($_POST['bluesky_bydefault'])); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'handle', $handle); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'import', intval($_POST['bluesky_import'])); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'import_feeds', intval($_POST['bluesky_import_feeds'])); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'complete_threads', intval($_POST['bluesky_complete_threads'])); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'friendica_handle', intval($_POST['bluesky_friendica_handle'] ?? false)); + + if (!empty($handle)) { + $did = DI::atProtocol()->getUserDid(DI::userSession()->getLocalUserId(), empty($old_did) || $old_handle != $handle); + if (!empty($did) && (empty($old_pds) || $old_handle != $handle)) { + $pds = DI::atProtocol()->getPdsOfDid($did); + if (empty($pds)) { + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'status', ATProtocol::STATUS_PDS_FAIL); + } + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'bluesky', 'pds', $pds); + } else { + $pds = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'pds'); + } + } else { + DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'bluesky', 'did'); + DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'bluesky', 'pds'); + DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'bluesky', 'password'); + DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'bluesky', 'access_token'); + DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'bluesky', 'refresh_token'); + DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'bluesky', 'token_created'); + DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'bluesky', 'status'); + } + + if (!empty($did) && !empty($pds) && !empty($_POST['bluesky_password'])) { + DI::atProtocol()->createUserToken(DI::userSession()->getLocalUserId(), $_POST['bluesky_password']); + } +} + +function bluesky_jot_nets(array &$jotnets_fields) +{ + if (!DI::userSession()->getLocalUserId()) { + return; + } + + if (DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'post')) { + $jotnets_fields[] = [ + 'type' => 'checkbox', + 'field' => [ + 'bluesky_enable', + DI::l10n()->t('Post to Bluesky'), + DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'post_by_default') + ] + ]; + } +} + +function bluesky_cron() +{ + $last = (int)DI::keyValue()->get('bluesky_last_poll'); + + $poll_interval = intval(DI::config()->get('bluesky', 'poll_interval')); + if (!$poll_interval) { + $poll_interval = BLUESKY_DEFAULT_POLL_INTERVAL; + } + + if ($last) { + $next = $last + ($poll_interval * 60); + if ($next > time()) { + DI::logger()->notice('poll interval not reached'); + return; + } + } + DI::logger()->notice('cron_start'); + + $abandon_days = intval(DI::config()->get('system', 'account_abandon_days')); + if ($abandon_days < 1) { + $abandon_days = 0; + } + + $abandon_limit = date(DateTimeFormat::MYSQL, time() - $abandon_days * 86400); + + $pconfigs = DBA::selectToArray('pconfig', [], ["`cat` = ? AND `k` IN (?, ?) AND `v`", 'bluesky', 'import', 'import_feeds']); + foreach ($pconfigs as $pconfig) { + if (empty(DI::atProtocol()->getUserDid($pconfig['uid']))) { + DI::logger()->debug('User has got no valid DID', ['uid' => $pconfig['uid']]); + continue; + } + + if ($abandon_days != 0) { + if (!DBA::exists('user', ["`uid` = ? AND `login_date` >= ?", $pconfig['uid'], $abandon_limit])) { + DI::logger()->notice('abandoned account: timeline from user will not be imported', ['user' => $pconfig['uid']]); + continue; + } + } + + // Refresh the token now, so that it doesn't need to be refreshed in parallel by the following workers + DI::logger()->debug('Refresh the token', ['uid' => $pconfig['uid']]); + DI::atProtocol()->getUserToken($pconfig['uid']); + + $last_sync = DI::pConfig()->get($pconfig['uid'], 'bluesky', 'last_contact_sync'); + if ($last_sync < (time() - 86400)) { + DI::atpActor()->syncContacts($pconfig['uid']); + DI::pConfig()->set($pconfig['uid'], 'bluesky', 'last_contact_sync', time()); + } + + Worker::add(['priority' => Worker::PRIORITY_MEDIUM, 'force_priority' => true], 'addon/bluesky/bluesky_notifications.php', $pconfig['uid']); + if (DI::pConfig()->get($pconfig['uid'], 'bluesky', 'import')) { + Worker::add(['priority' => Worker::PRIORITY_MEDIUM, 'force_priority' => true], 'addon/bluesky/bluesky_timeline.php', $pconfig['uid']); + } + if (DI::pConfig()->get($pconfig['uid'], 'bluesky', 'import_feeds')) { + DI::logger()->debug('Fetch feeds for user', ['uid' => $pconfig['uid']]); + $feeds = bluesky_get_feeds($pconfig['uid']); + foreach ($feeds as $feed) { + Worker::add(['priority' => Worker::PRIORITY_MEDIUM, 'force_priority' => true], 'addon/bluesky/bluesky_feed.php', $pconfig['uid'], $feed); + } + } + DI::logger()->debug('Polling done for user', ['uid' => $pconfig['uid']]); + } + + DI::logger()->notice('Polling done for all users'); + + DI::keyValue()->set('bluesky_last_poll', time()); + + $last_clean = DI::keyValue()->get('bluesky_last_clean'); + if (empty($last_clean) || ($last_clean + 86400 < time())) { + DI::logger()->notice('Start contact cleanup'); + $contacts = DBA::select('account-user-view', ['id', 'pid'], ["`network` = ? AND `uid` != ? AND `rel` = ?", Protocol::BLUESKY, 0, Contact::NOTHING]); + while ($contact = DBA::fetch($contacts)) { + Worker::add(Worker::PRIORITY_LOW, 'MergeContact', $contact['pid'], $contact['id'], 0); + } + DBA::close($contacts); + DI::keyValue()->set('bluesky_last_clean', time()); + DI::logger()->notice('Contact cleanup done'); + } + + DI::logger()->notice('cron_end'); +} + +function bluesky_hook_fork(array &$b) +{ + if ($b['name'] != 'notifier_normal') { + return; + } + + $post = $b['data']; + + if (($post['created'] !== $post['edited']) && !$post['deleted']) { + DI::logger()->info('Editing is not supported by the addon'); + $b['execute'] = false; + return; + } + + if (DI::pConfig()->get($post['uid'], 'bluesky', 'import')) { + // Don't post if it isn't a reply to a bluesky post + if (($post['gravity'] != Item::GRAVITY_PARENT) && !Post::exists(['id' => $post['parent'], 'network' => Protocol::BLUESKY])) { + DI::logger()->notice('No bluesky parent found', ['item' => $post['id']]); + $b['execute'] = false; + return; + } + } elseif (!strstr($post['postopts'] ?? '', 'bluesky') || ($post['gravity'] != Item::GRAVITY_PARENT) || ($post['private'] == Item::PRIVATE)) { + DI::logger()->info('Post will not be exported', ['uid' => $post['uid'], 'postopts' => $post['postopts'], 'gravity' => $post['gravity'], 'private' => $post['private']]); + $b['execute'] = false; + return; + } +} + +function bluesky_post_local(array &$b) +{ + if (!DI::userSession()->getLocalUserId() || (DI::userSession()->getLocalUserId() != $b['uid'])) { + return; + } + + if ($b['edit'] || ($b['private'] == Item::PRIVATE) || ($b['gravity'] != Item::GRAVITY_PARENT)) { + return; + } + + $bluesky_post = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'post')); + $bluesky_enable = (($bluesky_post && !empty($_REQUEST['bluesky_enable'])) ? intval($_REQUEST['bluesky_enable']) : 0); + + // if API is used, default to the chosen settings + if ($b['api_source'] && intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'bluesky', 'post_by_default'))) { + $bluesky_enable = 1; + } + + if (!$bluesky_enable) { + return; + } + + if (strlen($b['postopts'])) { + $b['postopts'] .= ','; + } + + $b['postopts'] .= 'bluesky'; +} + +function bluesky_send(array &$b) +{ + if (($b['created'] !== $b['edited']) && !$b['deleted']) { + return; + } + + if (Item::isGroupPost($b['uri-id'])) { + return; + } + + if ($b['gravity'] != Item::GRAVITY_PARENT) { + DI::logger()->debug('Got comment', ['item' => $b]); + + if ($b['deleted']) { + $uri = DI::atpProcessor()->getUriClass($b['uri']); + if (empty($uri)) { + DI::logger()->debug('Not a bluesky post', ['uri' => $b['uri']]); + return; + } + bluesky_delete_post($b['uri'], $b['uid']); + return; + } + + $root = DI::atpProcessor()->getUriClass($b['parent-uri']); + $parent = DI::atpProcessor()->getUriClass($b['thr-parent']); + + if (empty($root) || empty($parent)) { + DI::logger()->debug('No bluesky post', ['parent' => $b['parent'], 'thr-parent' => $b['thr-parent']]); + return; + } + + if ($b['gravity'] == Item::GRAVITY_COMMENT) { + DI::logger()->debug('Posting comment', ['root' => $root, 'parent' => $parent]); + bluesky_create_post($b, $root, $parent); + return; + } elseif (in_array($b['verb'], [Activity::LIKE, Activity::ANNOUNCE])) { + bluesky_create_activity($b, $parent); + } + return; + } elseif (($b['private'] == Item::PRIVATE) || !strstr($b['postopts'], 'bluesky')) { + return; + } + + bluesky_create_post($b); +} + +function bluesky_create_activity(array $item, stdClass $parent = null) +{ + $uid = $item['uid']; + $token = DI::atProtocol()->getUserToken($uid); + if (empty($token)) { + return; + } + + $did = DI::atProtocol()->getUserDid($uid); + if (empty($did)) { + return; + } + + $post = []; + + if ($item['verb'] == Activity::LIKE) { + $record = [ + 'subject' => $parent, + 'createdAt' => DateTimeFormat::utcNow(DateTimeFormat::ATOM), + '$type' => 'app.bsky.feed.like' + ]; + + $post = [ + 'collection' => 'app.bsky.feed.like', + 'repo' => $did, + 'record' => $record + ]; + } elseif ($item['verb'] == Activity::ANNOUNCE) { + $record = [ + 'subject' => $parent, + 'createdAt' => DateTimeFormat::utcNow(DateTimeFormat::ATOM), + '$type' => 'app.bsky.feed.repost' + ]; + + $post = [ + 'collection' => 'app.bsky.feed.repost', + 'repo' => $did, + 'record' => $record + ]; + } + + $activity = DI::atProtocol()->XRPCPost($uid, 'com.atproto.repo.createRecord', $post); + if (empty($activity->uri)) { + return; + } + DI::logger()->debug('Activity done', ['return' => $activity]); + $uri = DI::atpProcessor()->getUri($activity); + Item::update(['extid' => $uri], ['guid' => $item['guid']]); + DI::logger()->debug('Set extid', ['id' => $item['id'], 'extid' => $activity]); +} + +function bluesky_create_post(array $item, stdClass $root = null, stdClass $parent = null) +{ + $uid = $item['uid']; + $token = DI::atProtocol()->getUserToken($uid); + if (empty($token)) { + return; + } + + // Try to fetch the language from the post itself + if (!empty($item['language'])) { + $language = array_key_first(json_decode($item['language'], true)); + } else { + $language = ''; + } + + $item['body'] = Post\Media::removeFromBody($item['body']); + + foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::AUDIO, Post\Media::VIDEO, Post\Media::ACTIVITY]) as $media) { + if (strpos($item['body'], $media['url']) === false) { + $item['body'] .= "\n[url]" . $media['url'] . "[/url]\n"; + } + } + + if (!empty($item['quote-uri-id'])) { + $quote = Post::selectFirstPost(['uri', 'plink'], ['uri-id' => $item['quote-uri-id']]); + if (!empty($quote)) { + if ((strpos($item['body'], $quote['plink'] ?: $quote['uri']) === false) && (strpos($item['body'], $quote['uri']) === false)) { + $item['body'] .= "\n[url]" . ($quote['plink'] ?: $quote['uri']) . "[/url]\n"; + } + } + } + + $item['body'] = bluesky_set_mentions($item['body']); + + $urls = bluesky_get_urls($item['body']); + $item['body'] = $urls['body']; + + $msg = Plaintext::getPost($item, 300, false, BBCode::BLUESKY); + foreach ($msg['parts'] as $key => $part) { + + $facets = bluesky_get_facets($part, $urls['urls']); + + $record = [ + 'text' => $facets['body'], + '$type' => 'app.bsky.feed.post', + 'createdAt' => DateTimeFormat::utcNow(DateTimeFormat::ATOM), + ]; + + if (!empty($language)) { + $record['langs'] = [$language]; + } + + if (!empty($facets['facets'])) { + $record['facets'] = $facets['facets']; + } + + if (!empty($root)) { + $record['reply'] = ['root' => $root, 'parent' => $parent]; + } + + if ($key == count($msg['parts']) - 1) { + $record = bluesky_add_embed($uid, $msg, $record); + if (empty($record)) { + if (Worker::getRetrial() < 3) { + Worker::defer(); + } + return; + } + } + + $post = [ + 'collection' => 'app.bsky.feed.post', + 'repo' => DI::atProtocol()->getUserDid($uid), + 'record' => $record + ]; + + $parent = DI::atProtocol()->XRPCPost($uid, 'com.atproto.repo.createRecord', $post); + if (empty($parent->uri)) { + if ($part == 0) { + Worker::defer(); + } + return; + } + DI::logger()->debug('Posting done', ['return' => $parent]); + if (empty($root)) { + $root = $parent; + } + if (($key == 0) && ($item['gravity'] != Item::GRAVITY_PARENT)) { + $uri = DI::atpProcessor()->getUri($parent); + Item::update(['extid' => $uri], ['guid' => $item['guid']]); + DI::logger()->debug('Set extid', ['id' => $item['id'], 'extid' => $uri]); + } + } +} + +function bluesky_set_mentions(string $body): string +{ + // Remove all url based mention links + $body = preg_replace("/([@!])\[url\=(.*?)\](.*?)\[\/url\]/ism", '$1$3', $body); + + if (!preg_match_all("/[@!]\[url\=(did:.*?)\](.*?)\[\/url\]/ism", $body, $matches, PREG_SET_ORDER)) { + return $body; + } + + foreach ($matches as $match) { + $contact = Contact::selectFirst(['addr'], ['nurl' => $match[1]]); + if (!empty($contact['addr'])) { + $body = str_replace($match[0], '@[url=' . $match[1] . ']' . $contact['addr'] . '[/url]', $body); + } else { + $body = str_replace($match[0], '@' . $match[2], $body); + } + } + + return $body; +} + +function bluesky_get_urls(string $body): array +{ + $body = BBCode::expandVideoLinks($body); + $urls = []; + + // Search for Mentions + if (preg_match_all("/[@!]\[url\=(did:.*?)\](.*?)\[\/url\]/ism", $body, $matches, PREG_SET_ORDER)) { + foreach ($matches as $match) { + $text = '@' . $match[2]; + $urls[strpos($body, $match[0])] = ['mention' => $match[1], 'text' => $text, 'hash' => $text]; + $body = str_replace($match[0], $text, $body); + } + } + + // Search for hash tags + if (preg_match_all("/#\[url\=(https?:.*?)\](.*?)\[\/url\]/ism", $body, $matches, PREG_SET_ORDER)) { + foreach ($matches as $match) { + $text = '#' . $match[2]; + $urls[strpos($body, $match[0])] = ['tag' => $match[2], 'text' => $text, 'hash' => $text]; + $body = str_replace($match[0], $text, $body); + } + } + + // Search for pure links + if (preg_match_all("/\[url\](https?:.*?)\[\/url\]/ism", $body, $matches, PREG_SET_ORDER)) { + foreach ($matches as $match) { + $text = Strings::getStyledURL($match[1]); + $hash = bluesky_get_hash_for_url($match[0], mb_strlen($text)); + $urls[strpos($body, $match[0])] = ['url' => $match[1], 'text' => $text, 'hash' => $hash]; + $body = str_replace($match[0], $hash, $body); + } + } + + // Search for links with descriptions + if (preg_match_all("/\[url\=(https?:.*?)\](.*?)\[\/url\]/ism", $body, $matches, PREG_SET_ORDER)) { + foreach ($matches as $match) { + if ($match[1] == $match[2]) { + $text = Strings::getStyledURL($match[1]); + } else { + $text = $match[2]; + } + if (mb_strlen($text) < 100) { + $hash = bluesky_get_hash_for_url($match[0], mb_strlen($text)); + $urls[strpos($body, $match[0])] = ['url' => $match[1], 'text' => $text, 'hash' => $hash]; + $body = str_replace($match[0], $hash, $body); + } else { + $text = Strings::getStyledURL($match[1]); + $hash = bluesky_get_hash_for_url($match[0], mb_strlen($text)); + $urls[strpos($body, $match[0])] = ['url' => $match[1], 'text' => $text, 'hash' => $hash]; + $body = str_replace($match[0], $text . ' ' . $hash, $body); + } + } + } + + asort($urls); + + return ['body' => $body, 'urls' => $urls]; +} + +function bluesky_get_hash_for_url(string $text, int $linklength): string +{ + if ($linklength <= 10) { + return '|' . hash('crc32', $text) . '|'; + } + return substr('|' . hash('crc32', $text) . base64_encode($text), 0, $linklength - 2) . '|'; +} + +function bluesky_get_facets(string $body, array $urls): array +{ + $facets = []; + + foreach ($urls as $url) { + $pos = strpos($body, $url['hash']); + if ($pos === false) { + continue; + } + if ($pos > 0) { + $prefix = substr($body, 0, $pos); + } else { + $prefix = ''; + } + + $body = $prefix . $url['text'] . substr($body, $pos + strlen($url['hash'])); + + $facet = new stdClass; + $facet->index = new stdClass; + $facet->index->byteEnd = $pos + strlen($url['text']); + $facet->index->byteStart = $pos; + + $feature = new stdClass; + + $type = '$type'; + if (!empty($url['tag'])) { + $feature->tag = $url['tag']; + $feature->$type = 'app.bsky.richtext.facet#tag'; + } elseif (!empty($url['url'])) { + $feature->uri = $url['url']; + $feature->$type = 'app.bsky.richtext.facet#link'; + } elseif (!empty($url['mention'])) { + $feature->did = $url['mention']; + $feature->$type = 'app.bsky.richtext.facet#mention'; + } else { + continue; + } + + $facet->features = [$feature]; + $facets[] = $facet; + } + + return ['facets' => $facets, 'body' => $body]; +} + +function bluesky_add_embed(int $uid, array $msg, array $record): array +{ + if (($msg['type'] != 'link') && !empty($msg['images'])) { + $images = []; + foreach ($msg['images'] as $image) { + if (count($images) == 4) { + continue; + } + $photo = Photo::selectFirst([], ['id' => $image['id']]); + $blob = bluesky_upload_blob($uid, $photo); + if (empty($blob)) { + return []; + } + $images[] = [ + 'alt' => $image['description'] ?? '', + 'image' => $blob, + 'aspectRatio' => [ + 'width' => $photo['width'], + 'height' => $photo['height'], + ] + ]; + } + if (!empty($images)) { + $record['embed'] = ['$type' => 'app.bsky.embed.images', 'images' => $images]; + } + } elseif ($msg['type'] == 'link') { + $record['embed'] = [ + '$type' => 'app.bsky.embed.external', + 'external' => [ + 'uri' => $msg['url'], + 'title' => $msg['title'] ?? '', + 'description' => $msg['description'] ?? '', + ] + ]; + if (!empty($msg['image'])) { + $photo = Photo::createPhotoForExternalResource($msg['image']); + $blob = bluesky_upload_blob($uid, $photo); + if (!empty($blob)) { + $record['embed']['external']['thumb'] = $blob; + } + } + } + return $record; +} + +function bluesky_upload_blob(int $uid, array $photo): ?stdClass +{ + $retrial = Worker::getRetrial(); + $content = Photo::getImageForPhoto($photo); + + $picture = new Image($content, $photo['type'], $photo['filename']); + $height = $picture->getHeight(); + $width = $picture->getWidth(); + $size = strlen($content); + + $picture = Photo::resizeToFileSize($picture, BLUESKY_IMAGE_SIZE[$retrial]); + $new_height = $picture->getHeight(); + $new_width = $picture->getWidth(); + $content = (string)$picture->asString(); + $new_size = strlen($content); + + if (($size != 0) && ($new_size == 0) && ($retrial == 0)) { + DI::logger()->warning('Size is empty after resize, uploading original file', ['uid' => $uid, 'retrial' => $retrial, 'height' => $new_height, 'width' => $new_width, 'size' => $new_size, 'orig-height' => $height, 'orig-width' => $width, 'orig-size' => $size]); + $content = Photo::getImageForPhoto($photo); + } else { + DI::logger()->info('Uploading', ['uid' => $uid, 'retrial' => $retrial, 'height' => $new_height, 'width' => $new_width, 'size' => $new_size, 'orig-height' => $height, 'orig-width' => $width, 'orig-size' => $size]); + } + + $data = DI::atProtocol()->post($uid, '/xrpc/com.atproto.repo.uploadBlob', $content, ['Content-type' => $photo['type'], 'Authorization' => ['Bearer ' . DI::atProtocol()->getUserToken($uid)]]); + if (empty($data) || empty($data->blob)) { + DI::logger()->info('Uploading failed', ['uid' => $uid, 'retrial' => $retrial, 'height' => $new_height, 'width' => $new_width, 'size' => $new_size, 'orig-height' => $height, 'orig-width' => $width, 'orig-size' => $size]); + return null; + } + + Item::incrementOutbound(Protocol::BLUESKY); + DI::logger()->debug('Uploaded blob', ['return' => $data, 'uid' => $uid, 'retrial' => $retrial, 'height' => $new_height, 'width' => $new_width, 'size' => $new_size, 'orig-height' => $height, 'orig-width' => $width, 'orig-size' => $size]); + return $data->blob; +} + +function bluesky_delete_post(string $uri, int $uid) +{ + $parts = DI::atpProcessor()->getUriParts($uri); + if (empty($parts)) { + DI::logger()->debug('No uri delected', ['uri' => $uri]); + return; + } + DI::atProtocol()->XRPCPost($uid, 'com.atproto.repo.deleteRecord', $parts); + DI::logger()->debug('Deleted', ['parts' => $parts]); +} + +function bluesky_fetch_timeline(int $uid) +{ + $data = DI::atProtocol()->XRPCGet('app.bsky.feed.getTimeline', [], $uid); + if (empty($data)) { + return; + } + + if (empty($data->feed)) { + return; + } + + foreach (array_reverse($data->feed) as $entry) { + $causer = DI::atpActor()->getContactByDID($entry->post->author->did, $uid, 0, true); + if (!empty($entry->reply)) { + if (!empty($entry->reply->root)) { + bluesky_complete_post($entry->reply->root, $uid, Item::PR_COMMENT, $causer['id'], Conversation::PARCEL_CONNECTOR); + } + if (!empty($entry->reply->parent)) { + bluesky_complete_post($entry->reply->parent, $uid, Item::PR_COMMENT, $causer['id'], Conversation::PARCEL_CONNECTOR); + } + } + DI::atpProcessor()->processPost($entry->post, $uid, Item::PR_NONE, 0, 0, Conversation::PARCEL_CONNECTOR); + if (!empty($entry->reason)) { + bluesky_process_reason($entry->reason, DI::atpProcessor()->getUri($entry->post), $uid); + } + } +} + +function bluesky_complete_post(stdClass $post, int $uid, int $post_reason, int $causer, int $protocol): int +{ + $complete = DI::pConfig()->get($uid, 'bluesky', 'complete_threads'); + $existing_uri = DI::atpProcessor()->getPostUri(DI::atpProcessor()->getUri($post), $uid); + if (!empty($existing_uri)) { + $comments = Post::countPosts(['thr-parent' => $existing_uri, 'gravity' => Item::GRAVITY_COMMENT]); + if (($post->replyCount <= $comments) || !$complete) { + return DI::atpProcessor()->fetchUriId($existing_uri, $uid); + } + } + + if ($complete) { + $uri = DI::atpProcessor()->fetchMissingPost(DI::atpProcessor()->getUri($post), $uid, $post_reason, $causer, 0, '', true, $protocol); + $uri_id = DI::atpProcessor()->fetchUriId($uri, $uid); + } else { + $uri_id = DI::atpProcessor()->processPost($post, $uid, $post_reason, $causer, 0, $protocol); + } + return $uri_id; +} + +function bluesky_process_reason(stdClass $reason, string $uri, int $uid) +{ + $type = '$type'; + if ($reason->$type != 'app.bsky.feed.defs#reasonRepost') { + return; + } + + $contact = DI::atpActor()->getContactByDID($reason->by->did, $uid, 0); + + $item = [ + 'network' => Protocol::BLUESKY, + 'protocol' => Conversation::PARCEL_CONNECTOR, + 'uid' => $uid, + 'wall' => false, + 'uri' => $reason->by->did . '/app.bsky.feed.repost/' . $reason->indexedAt, + 'private' => Item::UNLISTED, + 'contact-id' => $contact['id'], + 'author-name' => $contact['name'], + 'author-link' => $contact['url'], + 'author-avatar' => $contact['avatar'], + 'verb' => Activity::ANNOUNCE, + 'body' => Activity::ANNOUNCE, + 'gravity' => Item::GRAVITY_ACTIVITY, + 'object-type' => Activity\ObjectType::NOTE, + 'thr-parent' => $uri, + ]; + + if (Post::exists(['uri' => $item['uri'], 'uid' => $uid])) { + return; + } + + if (Post::exists(['uid' => $item['uid'], 'thr-parent' => $item['thr-parent'], 'verb' => $item['verb'], 'contact-id' => $item['contact-id']])) { + return; + } + + $item['guid'] = Item::guidFromUri($item['uri'], $contact['alias']); + $item['owner-name'] = $item['author-name']; + $item['owner-link'] = $item['author-link']; + $item['owner-avatar'] = $item['author-avatar']; + if (Item::insert($item)) { + $pcid = Contact::getPublicContactId($contact['id'], $uid); + Item::update(['post-reason' => Item::PR_ANNOUNCEMENT, 'causer-id' => $pcid], ['uri' => $uri, 'uid' => $uid]); + } +} + +function bluesky_fetch_notifications(int $uid) +{ + $data = DI::atProtocol()->XRPCGet('app.bsky.notification.listNotifications', [], $uid); + if (empty($data->notifications)) { + return; + } + + foreach ($data->notifications as $notification) { + $uri = DI::atpProcessor()->getUri($notification); + if (Post::exists(['uri' => $uri, 'uid' => $uid]) || Post::exists(['extid' => $uri, 'uid' => $uid])) { + DI::logger()->debug('Notification already processed', ['uid' => $uid, 'reason' => $notification->reason, 'uri' => $uri, 'indexedAt' => $notification->indexedAt]); + continue; + } + DI::logger()->debug('Process notification', ['uid' => $uid, 'reason' => $notification->reason, 'uri' => $uri, 'indexedAt' => $notification->indexedAt]); + switch ($notification->reason) { + case 'like': + $item = DI::atpProcessor()->getHeaderFromPost($notification, $uri, $uid, Conversation::PARCEL_CONNECTOR); + $item['gravity'] = Item::GRAVITY_ACTIVITY; + $item['body'] = $item['verb'] = Activity::LIKE; + $item['thr-parent'] = DI::atpProcessor()->getUri($notification->record->subject); + $item['thr-parent'] = DI::atpProcessor()->fetchMissingPost($item['thr-parent'], $uid, Item::PR_FETCHED, $item['contact-id'], 0); + if (!empty($item['thr-parent'])) { + $data = Item::insert($item); + DI::logger()->debug('Got like', ['uid' => $uid, 'result' => $data, 'uri' => $uri]); + } else { + DI::logger()->info('Thread parent not found', ['uid' => $uid, 'parent' => $item['thr-parent'], 'uri' => $uri]); + } + break; + + case 'repost': + $item = DI::atpProcessor()->getHeaderFromPost($notification, $uri, $uid, Conversation::PARCEL_CONNECTOR); + $item['gravity'] = Item::GRAVITY_ACTIVITY; + $item['body'] = $item['verb'] = Activity::ANNOUNCE; + $item['thr-parent'] = DI::atpProcessor()->getUri($notification->record->subject); + $item['thr-parent'] = DI::atpProcessor()->fetchMissingPost($item['thr-parent'], $uid, Item::PR_FETCHED, $item['contact-id'], 0); + if (!empty($item['thr-parent'])) { + $data = Item::insert($item); + DI::logger()->debug('Got repost', ['uid' => $uid, 'result' => $data, 'uri' => $uri]); + } else { + DI::logger()->info('Thread parent not found', ['uid' => $uid, 'parent' => $item['thr-parent'], 'uri' => $uri]); + } + break; + + case 'follow': + $contact = DI::atpActor()->getContactByDID($notification->author->did, $uid, $uid); + DI::logger()->debug('New follower', ['uid' => $uid, 'nick' => $contact['nick'], 'uri' => $uri]); + break; + + case 'mention': + $contact = DI::atpActor()->getContactByDID($notification->author->did, $uid, 0); + $result = DI::atpProcessor()->fetchMissingPost($uri, $uid, Item::PR_TO, $contact['id'], 0); + DI::logger()->debug('Got mention', ['uid' => $uid, 'nick' => $contact['nick'], 'result' => $result, 'uri' => $uri]); + break; + + case 'reply': + $contact = DI::atpActor()->getContactByDID($notification->author->did, $uid, 0); + $result = DI::atpProcessor()->fetchMissingPost($uri, $uid, Item::PR_COMMENT, $contact['id'], 0); + DI::logger()->debug('Got reply', ['uid' => $uid, 'nick' => $contact['nick'], 'result' => $result, 'uri' => $uri]); + break; + + case 'quote': + $contact = DI::atpActor()->getContactByDID($notification->author->did, $uid, 0); + $result = DI::atpProcessor()->fetchMissingPost($uri, $uid, Item::PR_PUSHED, $contact['id'], 0); + DI::logger()->debug('Got quote', ['uid' => $uid, 'nick' => $contact['nick'], 'result' => $result, 'uri' => $uri]); + break; + + default: + DI::logger()->notice('Unhandled reason', ['reason' => $notification->reason, 'uri' => $uri]); + break; + } + } +} + +function bluesky_fetch_feed(int $uid, string $feed) +{ + $data = DI::atProtocol()->XRPCGet('app.bsky.feed.getFeed', ['feed' => $feed], $uid); + if (empty($data)) { + return; + } + + if (empty($data->feed)) { + return; + } + + $feeddata = DI::atProtocol()->XRPCGet('app.bsky.feed.getFeedGenerator', ['feed' => $feed], $uid); + if (!empty($feeddata) && !empty($feeddata->view)) { + $feedurl = $feeddata->view->uri; + $feedname = $feeddata->view->displayName; + } else { + $feedurl = $feed; + $feedname = $feed; + } + + foreach (array_reverse($data->feed) as $entry) { + $contact = DI::atpActor()->getContactByDID($entry->post->author->did, $uid, 0); + $languages = $entry->post->record->langs ?? []; + + if (!Relay::isWantedLanguage($entry->post->record->text, 0, $contact['id'] ?? 0, $languages)) { + DI::logger()->debug('Unwanted language detected', ['languages' => $languages, 'text' => $entry->post->record->text]); + continue; + } + $causer = DI::atpActor()->getContactByDID($entry->post->author->did, $uid, 0); + $uri_id = bluesky_complete_post($entry->post, $uid, Item::PR_TAG, $causer['id'], Conversation::PARCEL_CONNECTOR); + if (!empty($uri_id)) { + $stored = Post\Category::storeFileByURIId($uri_id, $uid, Post\Category::SUBCRIPTION, $feedname, $feedurl); + DI::logger()->debug('Stored tag subscription for user', ['uri-id' => $uri_id, 'uid' => $uid, 'name' => $feedname, 'url' => $feedurl, 'stored' => $stored]); + } else { + DI::logger()->notice('Post not found', ['entry' => $entry]); + } + if (!empty($entry->reason)) { + bluesky_process_reason($entry->reason, DI::atpProcessor()->getUri($entry->post), $uid); + } + } +} + +function bluesky_get_feeds(int $uid): array +{ + $type = '$type'; + $preferences = bluesky_get_preferences($uid); + if (empty($preferences) || empty($preferences->preferences)) { + return []; + } + foreach ($preferences->preferences as $preference) { + if ($preference->$type == 'app.bsky.actor.defs#savedFeedsPrefV2') { + $pinned = []; + foreach ($preference->items as $item) { + if (($item->type == 'feed') && $item->pinned) { + $pinned[] = $item->value; + } + } + return $pinned; + } + } + return []; +} + +function bluesky_get_preferences(int $uid): ?stdClass +{ + $cachekey = 'bluesky:preferences:' . $uid; + $data = DI::cache()->get($cachekey); + if (!is_null($data)) { + return $data; + } + + $data = DI::atProtocol()->XRPCGet('app.bsky.actor.getPreferences', [], $uid); + if (empty($data)) { + return null; + } + + DI::cache()->set($cachekey, $data, Duration::HOUR); + return $data; +} diff --git a/bluesky/bluesky_feed.php b/bluesky/bluesky_feed.php new file mode 100644 index 00000000..e4aa3fdc --- /dev/null +++ b/bluesky/bluesky_feed.php @@ -0,0 +1,16 @@ +debug('Importing feed - start', ['user' => $argv[1], 'feed' => $argv[2]]); + bluesky_fetch_feed($argv[1], $argv[2]); + DI::logger()->debug('Importing feed - done', ['user' => $argv[1], 'feed' => $argv[2]]); +} diff --git a/bluesky/bluesky_notifications.php b/bluesky/bluesky_notifications.php new file mode 100644 index 00000000..e1bf2047 --- /dev/null +++ b/bluesky/bluesky_notifications.php @@ -0,0 +1,16 @@ +notice('importing notifications - start', ['user' => $argv[1]]); + bluesky_fetch_notifications($argv[1]); + DI::logger()->notice('importing notifications - done', ['user' => $argv[1]]); +} diff --git a/bluesky/bluesky_timeline.php b/bluesky/bluesky_timeline.php new file mode 100644 index 00000000..37b22d99 --- /dev/null +++ b/bluesky/bluesky_timeline.php @@ -0,0 +1,16 @@ +notice('importing timeline - start', ['user' => $argv[1]]); + bluesky_fetch_timeline($argv[1]); + DI::logger()->notice('importing timeline - done', ['user' => $argv[1]]); +} diff --git a/bluesky/lang/C/messages.po b/bluesky/lang/C/messages.po new file mode 100644 index 00000000..d573972c --- /dev/null +++ b/bluesky/lang/C/messages.po @@ -0,0 +1,133 @@ +# ADDON bluesky +# Copyright (C) +# This file is distributed under the same license as the Friendica bluesky addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-09-29 18:16+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: bluesky.php:335 +msgid "Save Settings" +msgstr "" + +#: bluesky.php:336 +msgid "Allow your users to use your hostname for their Bluesky handles" +msgstr "" + +#: bluesky.php:336 +#, php-format +msgid "Before enabling this option, you have to setup a wildcard domain configuration and you have to enable wildcard requests in your webserver configuration. On Apache this is done by adding \"ServerAlias *.%s\" to your HTTP configuration. You don't need to change the HTTPS configuration." +msgstr "" + +#: bluesky.php:365 +#, php-format +msgid "Allow to use %s as your Bluesky handle." +msgstr "" + +#: bluesky.php:365 +#, php-format +msgid "When enabled, you can use %s as your Bluesky handle. After you enabled this option, please go to https://bsky.app/settings and select to change your handle. Select that you have got your own domain. Then enter %s and select \"No DNS Panel\". Then select \"Verify Text File\"." +msgstr "" + +#: bluesky.php:375 +msgid "Enable Bluesky Post Addon" +msgstr "" + +#: bluesky.php:376 +msgid "Post to Bluesky by default" +msgstr "" + +#: bluesky.php:377 +msgid "Import the remote timeline" +msgstr "" + +#: bluesky.php:378 +msgid "Import the pinned feeds" +msgstr "" + +#: bluesky.php:378 +msgid "When activated, Posts will be imported from all the feeds that you pinned in Bluesky." +msgstr "" + +#: bluesky.php:379 +msgid "Complete the threads" +msgstr "" + +#: bluesky.php:379 +msgid "When activated, the system fetches additional replies for the posts in the timeline. This leads to more complete threads." +msgstr "" + +#: bluesky.php:381 +msgid "Personal Data Server" +msgstr "" + +#: bluesky.php:381 +msgid "The personal data server (PDS) is the system that hosts your profile." +msgstr "" + +#: bluesky.php:382 +msgid "Bluesky handle" +msgstr "" + +#: bluesky.php:383 +msgid "Bluesky DID" +msgstr "" + +#: bluesky.php:383 +msgid "This is the unique identifier. It will be fetched automatically, when the handle is entered." +msgstr "" + +#: bluesky.php:384 +msgid "Bluesky app password" +msgstr "" + +#: bluesky.php:384 +msgid "Please don't add your real password here, but instead create a specific app password in the Bluesky settings." +msgstr "" + +#: bluesky.php:390 +msgid "Bluesky Import/Export" +msgstr "" + +#: bluesky.php:400 +msgid "You are not authenticated. Please enter your handle and the app password." +msgstr "" + +#: bluesky.php:420 +msgid "You are authenticated to Bluesky. For security reasons the password isn't stored." +msgstr "" + +#: bluesky.php:422 +msgid "The communication with the personal data server service (PDS) is established." +msgstr "" + +#: bluesky.php:424 +msgid "Communication issues with the personal data server service (PDS)." +msgstr "" + +#: bluesky.php:426 +msgid "The DID for the provided handle could not be detected. Please check if you entered the correct handle." +msgstr "" + +#: bluesky.php:428 +msgid "The personal data server service (PDS) could not be detected." +msgstr "" + +#: bluesky.php:430 +msgid "The authentication with the provided handle and password failed. Please check if you entered the correct password." +msgstr "" + +#: bluesky.php:492 +msgid "Post to Bluesky" +msgstr "" diff --git a/bluesky/lang/de/messages.po b/bluesky/lang/de/messages.po new file mode 100644 index 00000000..13ea8e96 --- /dev/null +++ b/bluesky/lang/de/messages.po @@ -0,0 +1,89 @@ +# ADDON bluesky +# Copyright (C) +# This file is distributed under the same license as the Friendica bluesky addon package. +# +# +# Translators: +# Tobias Diekershoff , 2023 +# haheute , 2023 +# Raroun, 2023 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-05-24 05:52+0000\n" +"PO-Revision-Date: 2023-05-24 06:02+0000\n" +"Last-Translator: Raroun, 2023\n" +"Language-Team: German (https://app.transifex.com/Friendica/teams/12172/de/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: bluesky.php:100 +msgid "" +"You are authenticated to Bluesky. For security reasons the password isn't " +"stored." +msgstr "" +"Du bist auf Bluesky authentifiziert. Aus Sicherheitsgründen wird das " +"Passwort nicht gespeichert." + +#: bluesky.php:100 +msgid "You are not authenticated. Please enter the app password." +msgstr "" +"Du bist derzeit nicht authentifiziert. Bitte gib dein App Passwort ein." + +#: bluesky.php:104 +msgid "Enable Bluesky Post Addon" +msgstr "Bluesky Post Addon aktivieren" + +#: bluesky.php:105 +msgid "Post to Bluesky by default" +msgstr "Standardmäßig auf Bluesky veröffentlichen" + +#: bluesky.php:106 +msgid "Import the remote timeline" +msgstr "Importiere die entfernte Timeline" + +#: bluesky.php:107 +msgid "Bluesky host" +msgstr "Bluesky Host" + +#: bluesky.php:108 +msgid "Bluesky handle" +msgstr "Bluesky Handle" + +#: bluesky.php:109 +msgid "Bluesky DID" +msgstr "Bluesky DID" + +#: bluesky.php:109 +msgid "" +"This is the unique identifier. It will be fetched automatically, when the " +"handle is entered." +msgstr "" +"Sobald das Handle eingegeben ist, wird diese einzigartige Kennung " +"automatisch abgerufen." + +#: bluesky.php:110 +msgid "Bluesky app password" +msgstr "Bluesky App Passwort" + +#: bluesky.php:110 +msgid "" +"Please don't add your real password here, but instead create a specific app " +"password in the Bluesky settings." +msgstr "" +"Bitte verwende hier nicht dein echtes Passwort, sondern stattdessen ein " +"speziell für diese App in den Bluesky Einstellungen festgelegtes Passwort." + +#: bluesky.php:116 +msgid "Bluesky Import/Export" +msgstr "Bluesky Import/Export" + +#: bluesky.php:167 +msgid "Post to Bluesky" +msgstr "Auf Bluesky veröffentlichen" diff --git a/bluesky/lang/de/strings.php b/bluesky/lang/de/strings.php new file mode 100644 index 00000000..8e3c9421 --- /dev/null +++ b/bluesky/lang/de/strings.php @@ -0,0 +1,20 @@ +strings['You are authenticated to Bluesky. For security reasons the password isn\'t stored.'] = 'Du bist auf Bluesky authentifiziert. Aus Sicherheitsgründen wird das Passwort nicht gespeichert.'; +$a->strings['You are not authenticated. Please enter the app password.'] = 'Du bist derzeit nicht authentifiziert. Bitte gib dein App Passwort ein.'; +$a->strings['Enable Bluesky Post Addon'] = 'Bluesky Post Addon aktivieren'; +$a->strings['Post to Bluesky by default'] = 'Standardmäßig auf Bluesky veröffentlichen'; +$a->strings['Import the remote timeline'] = 'Importiere die entfernte Timeline'; +$a->strings['Bluesky host'] = 'Bluesky Host'; +$a->strings['Bluesky handle'] = 'Bluesky Handle'; +$a->strings['Bluesky DID'] = 'Bluesky DID'; +$a->strings['This is the unique identifier. It will be fetched automatically, when the handle is entered.'] = 'Sobald das Handle eingegeben ist, wird diese einzigartige Kennung automatisch abgerufen.'; +$a->strings['Bluesky app password'] = 'Bluesky App Passwort'; +$a->strings['Please don\'t add your real password here, but instead create a specific app password in the Bluesky settings.'] = 'Bitte verwende hier nicht dein echtes Passwort, sondern stattdessen ein speziell für diese App in den Bluesky Einstellungen festgelegtes Passwort.'; +$a->strings['Bluesky Import/Export'] = 'Bluesky Import/Export'; +$a->strings['Post to Bluesky'] = 'Auf Bluesky veröffentlichen'; diff --git a/bluesky/lang/zh-cn/messages.po b/bluesky/lang/zh-cn/messages.po new file mode 100644 index 00000000..9074ce34 --- /dev/null +++ b/bluesky/lang/zh-cn/messages.po @@ -0,0 +1,80 @@ +# ADDON bluesky +# Copyright (C) +# This file is distributed under the same license as the Friendica bluesky addon package. +# +# +# Translators: +# tslmuun, 2023 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-05-24 05:52+0000\n" +"PO-Revision-Date: 2023-05-24 06:02+0000\n" +"Last-Translator: tslmuun, 2023\n" +"Language-Team: Chinese (China) (https://app.transifex.com/Friendica/teams/12172/zh_CN/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: zh_CN\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +#: bluesky.php:100 +msgid "" +"You are authenticated to Bluesky. For security reasons the password isn't " +"stored." +msgstr "您已通过 Bluesky 的身份验证。 出于安全原因,不存储密码。" + +#: bluesky.php:100 +msgid "You are not authenticated. Please enter the app password." +msgstr "您未通过身份验证。 请输入应用密码。" + +#: bluesky.php:104 +msgid "Enable Bluesky Post Addon" +msgstr "启用Bluesky插件" + +#: bluesky.php:105 +msgid "Post to Bluesky by default" +msgstr "默认发布到Bluesky" + +#: bluesky.php:106 +msgid "Import the remote timeline" +msgstr "导入远程时间线" + +#: bluesky.php:107 +msgid "Bluesky host" +msgstr "Bluesky地址" + +#: bluesky.php:108 +msgid "Bluesky handle" +msgstr "Bluesky handle" + +#: bluesky.php:109 +msgid "Bluesky DID" +msgstr "Bluesky DID" + +#: bluesky.php:109 +msgid "" +"This is the unique identifier. It will be fetched automatically, when the " +"handle is entered." +msgstr "这是唯一标识符。 输入句柄时,它将自动获取。" + +#: bluesky.php:110 +msgid "Bluesky app password" +msgstr "Bluesky 应用密码" + +#: bluesky.php:110 +msgid "" +"Please don't add your real password here, but instead create a specific app " +"password in the Bluesky settings." +msgstr "请不要在此处填写您的真实密码,而是在 Bluesky 设置中创建一个特定的应用程序密码。" + +#: bluesky.php:116 +msgid "Bluesky Import/Export" +msgstr "Bluesky 导入/导出" + +#: bluesky.php:167 +msgid "Post to Bluesky" +msgstr "发布到Bluesky" diff --git a/bluesky/lang/zh-cn/strings.php b/bluesky/lang/zh-cn/strings.php new file mode 100644 index 00000000..9c71d974 --- /dev/null +++ b/bluesky/lang/zh-cn/strings.php @@ -0,0 +1,20 @@ +strings['You are authenticated to Bluesky. For security reasons the password isn\'t stored.'] = '您已通过 Bluesky 的身份验证。 出于安全原因,不存储密码。'; +$a->strings['You are not authenticated. Please enter the app password.'] = '您未通过身份验证。 请输入应用密码。'; +$a->strings['Enable Bluesky Post Addon'] = '启用Bluesky插件'; +$a->strings['Post to Bluesky by default'] = '默认发布到Bluesky'; +$a->strings['Import the remote timeline'] = '导入远程时间线'; +$a->strings['Bluesky host'] = 'Bluesky地址'; +$a->strings['Bluesky handle'] = 'Bluesky handle'; +$a->strings['Bluesky DID'] = 'Bluesky DID'; +$a->strings['This is the unique identifier. It will be fetched automatically, when the handle is entered.'] = '这是唯一标识符。 输入句柄时,它将自动获取。'; +$a->strings['Bluesky app password'] = 'Bluesky 应用密码'; +$a->strings['Please don\'t add your real password here, but instead create a specific app password in the Bluesky settings.'] = '请不要在此处填写您的真实密码,而是在 Bluesky 设置中创建一个特定的应用程序密码。'; +$a->strings['Bluesky Import/Export'] = 'Bluesky 导入/导出'; +$a->strings['Post to Bluesky'] = '发布到Bluesky'; diff --git a/bluesky/templates/admin.tpl b/bluesky/templates/admin.tpl new file mode 100644 index 00000000..7b752a88 --- /dev/null +++ b/bluesky/templates/admin.tpl @@ -0,0 +1,2 @@ +{{include file="field_checkbox.tpl" field=$friendica_handles}} +
diff --git a/bluesky/templates/connector_settings.tpl b/bluesky/templates/connector_settings.tpl new file mode 100644 index 00000000..a85bcd89 --- /dev/null +++ b/bluesky/templates/connector_settings.tpl @@ -0,0 +1,13 @@ +

{{$status}}

+{{include file="field_checkbox.tpl" field=$enable}} +{{include file="field_checkbox.tpl" field=$bydefault}} +{{include file="field_checkbox.tpl" field=$import}} +{{include file="field_checkbox.tpl" field=$import_feeds}} +{{include file="field_checkbox.tpl" field=$complete_threads}} +{{if $custom_handle}} + {{include file="field_checkbox.tpl" field=$custom_handle}} +{{/if}} +{{include file="field_input.tpl" field=$pds}} +{{include file="field_input.tpl" field=$handle}} +{{include file="field_input.tpl" field=$did}} +{{include file="field_input.tpl" field=$password}} \ No newline at end of file diff --git a/buglink/buglink.php b/buglink/buglink.php index 78fb8bef..b7dd6504 100644 --- a/buglink/buglink.php +++ b/buglink/buglink.php @@ -6,7 +6,6 @@ * Author: Mike Macgirvin */ -use Friendica\App; use Friendica\Core\Hook; use Friendica\DI; diff --git a/buglink/lang/bg/messages.po b/buglink/lang/bg/messages.po new file mode 100644 index 00000000..d3a60344 --- /dev/null +++ b/buglink/lang/bg/messages.po @@ -0,0 +1,23 @@ +# ADDON buglink +# Copyright (C) +# This file is distributed under the same license as the Friendica buglink addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2014-06-22 11:27+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: buglink.php:20 +msgid "Report Bug" +msgstr "" diff --git a/buglink/lang/bg/strings.php b/buglink/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/buglink/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: buglink.php:20 +msgid "Report Bug" +msgstr "" diff --git a/buglink/lang/eo/strings.php b/buglink/lang/eo/strings.php index 00d95a40..68e8a64c 100644 --- a/buglink/lang/eo/strings.php +++ b/buglink/lang/eo/strings.php @@ -1,3 +1,7 @@ -strings["Report Bug"] = "Skribi cimraporton"; +\n" +"Language-Team: Estonian (http://app.transifex.com/Friendica/friendica/language/et/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: et\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: buglink.php:20 +msgid "Report Bug" +msgstr "" diff --git a/buglink/lang/et/strings.php b/buglink/lang/et/strings.php new file mode 100644 index 00000000..dfe78358 --- /dev/null +++ b/buglink/lang/et/strings.php @@ -0,0 +1,7 @@ + */ -use Friendica\App; use Friendica\Core\Hook; use Friendica\DI; @@ -16,7 +15,7 @@ function calc_install() { function calc_app_menu(array &$b) { - $b['app_menu'][] = ''; + $b['app_menu'][] = ''; } /** @@ -296,7 +295,7 @@ $o .= <<< EOT

Calculator



-
+
La Libravatar kromprogramo retropaŝos al Gravatar se neniu troveblis ĉe Libravatar."; -$a->strings["Submit"] = "Sendi"; -$a->strings["Default avatar image"] = "Defaŭlta avatarbildo"; -$a->strings["Select default avatar image if none was found. See README"] = "Elektu la defaŭltan avatar bildon sen neniu troveblis. Legu README."; -$a->strings["Libravatar settings updated."] = "Ĝisdatigis Libravatar agordojn."; +The " +"Libravatar addon will fall back to Gravatar if nothing was found at " +"Libravatar." +msgstr "" + +#: libravatar.php:83 +msgid "Save Settings" +msgstr "" + +#: libravatar.php:84 +msgid "Default avatar image" +msgstr "" + +#: libravatar.php:84 +msgid "Select default avatar image if none was found. See README" +msgstr "" diff --git a/libravatar/lang/et/strings.php b/libravatar/lang/et/strings.php new file mode 100644 index 00000000..dfe78358 --- /dev/null +++ b/libravatar/lang/et/strings.php @@ -0,0 +1,7 @@ +, 2022 # Hypolite Petovan , 2016 # ea1cd8241cb389ffb6f92bc6891eff5d_dc12308 <70dced5587d47e18d88f9298024d96f8_93383>, 2015 @@ -13,8 +14,8 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-02-01 18:15+0100\n" "PO-Revision-Date: 2014-06-23 09:49+0000\n" -"Last-Translator: Hypolite Petovan , 2022\n" -"Language-Team: French (http://www.transifex.com/Friendica/friendica/language/fr/)\n" +"Last-Translator: cracrayol, 2025\n" +"Language-Team: French (http://app.transifex.com/Friendica/friendica/language/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -62,7 +63,7 @@ msgstr "L'extension Gravatar est installée. Veuillez la désactiver.
L'exte #: libravatar.php:83 msgid "Save Settings" -msgstr "Enregistrer les paramètres" +msgstr "Sauvegarder les paramètres" #: libravatar.php:84 msgid "Default avatar image" diff --git a/libravatar/lang/fr/strings.php b/libravatar/lang/fr/strings.php index dd3cbe2c..87a3a9ab 100644 --- a/libravatar/lang/fr/strings.php +++ b/libravatar/lang/fr/strings.php @@ -14,6 +14,6 @@ $a->strings['roboter face'] = 'Tête de robot'; $a->strings['retro adventure game character'] = 'Personnage de jeu d\'aventure rétro'; $a->strings['Information'] = 'Information'; $a->strings['Gravatar addon is installed. Please disable the Gravatar addon.
The Libravatar addon will fall back to Gravatar if nothing was found at Libravatar.'] = 'L\'extension Gravatar est installée. Veuillez la désactiver.
L\'extension Libravatar se repose sur Gravatar si l\'avatar n\'a pas été trouvé sur Libravatar.'; -$a->strings['Save Settings'] = 'Enregistrer les paramètres'; +$a->strings['Save Settings'] = 'Sauvegarder les paramètres'; $a->strings['Default avatar image'] = 'Avatar par défaut'; $a->strings['Select default avatar image if none was found. See README'] = 'Sélectionnez un avatar par défaut si rien n\'a été trouvé. Voir le README'; diff --git a/libravatar/lang/gd/messages.po b/libravatar/lang/gd/messages.po new file mode 100644 index 00000000..95c88e99 --- /dev/null +++ b/libravatar/lang/gd/messages.po @@ -0,0 +1,70 @@ +# ADDON libravatar +# Copyright (C) +# This file is distributed under the same license as the Friendica libravatar addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2014-06-23 09:49+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: libravatar.php:68 +msgid "generic profile image" +msgstr "" + +#: libravatar.php:69 +msgid "random geometric pattern" +msgstr "" + +#: libravatar.php:70 +msgid "monster face" +msgstr "" + +#: libravatar.php:71 +msgid "computer generated face" +msgstr "" + +#: libravatar.php:72 +msgid "retro arcade style face" +msgstr "" + +#: libravatar.php:73 +msgid "roboter face" +msgstr "" + +#: libravatar.php:74 +msgid "retro adventure game character" +msgstr "" + +#: libravatar.php:78 +msgid "Information" +msgstr "" + +#: libravatar.php:78 +msgid "" +"Gravatar addon is installed. Please disable the Gravatar addon.
The " +"Libravatar addon will fall back to Gravatar if nothing was found at " +"Libravatar." +msgstr "" + +#: libravatar.php:83 +msgid "Save Settings" +msgstr "" + +#: libravatar.php:84 +msgid "Default avatar image" +msgstr "" + +#: libravatar.php:84 +msgid "Select default avatar image if none was found. See README" +msgstr "" diff --git a/libravatar/lang/gd/strings.php b/libravatar/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/libravatar/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/libravatar/lang/is/messages.po b/libravatar/lang/is/messages.po new file mode 100644 index 00000000..75746e3d --- /dev/null +++ b/libravatar/lang/is/messages.po @@ -0,0 +1,70 @@ +# ADDON libravatar +# Copyright (C) +# This file is distributed under the same license as the Friendica libravatar addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2014-06-23 09:49+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: libravatar.php:68 +msgid "generic profile image" +msgstr "" + +#: libravatar.php:69 +msgid "random geometric pattern" +msgstr "" + +#: libravatar.php:70 +msgid "monster face" +msgstr "" + +#: libravatar.php:71 +msgid "computer generated face" +msgstr "" + +#: libravatar.php:72 +msgid "retro arcade style face" +msgstr "" + +#: libravatar.php:73 +msgid "roboter face" +msgstr "" + +#: libravatar.php:74 +msgid "retro adventure game character" +msgstr "" + +#: libravatar.php:78 +msgid "Information" +msgstr "" + +#: libravatar.php:78 +msgid "" +"Gravatar addon is installed. Please disable the Gravatar addon.
The " +"Libravatar addon will fall back to Gravatar if nothing was found at " +"Libravatar." +msgstr "" + +#: libravatar.php:83 +msgid "Save Settings" +msgstr "" + +#: libravatar.php:84 +msgid "Default avatar image" +msgstr "" + +#: libravatar.php:84 +msgid "Select default avatar image if none was found. See README" +msgstr "" diff --git a/libravatar/lang/is/strings.php b/libravatar/lang/is/strings.php index 25de0e53..975c341e 100644 --- a/libravatar/lang/is/strings.php +++ b/libravatar/lang/is/strings.php @@ -1,17 +1,7 @@ -strings["Could NOT install Libravatar successfully.
It requires PHP >= 5.3"] = ""; -$a->strings["generic profile image"] = ""; -$a->strings["random geometric pattern"] = ""; -$a->strings["monster face"] = ""; -$a->strings["computer generated face"] = ""; -$a->strings["retro arcade style face"] = ""; -$a->strings["Warning"] = ""; -$a->strings["Your PHP version %s is lower than the required PHP >= 5.3."] = ""; -$a->strings["This addon is not functional on your server."] = ""; -$a->strings["Information"] = ""; -$a->strings["Gravatar addon is installed. Please disable the Gravatar addon.
The Libravatar addon will fall back to Gravatar if nothing was found at Libravatar."] = ""; -$a->strings["Submit"] = "Senda inn"; -$a->strings["Default avatar image"] = ""; -$a->strings["Select default avatar image if none was found. See README"] = ""; -$a->strings["Libravatar settings updated."] = ""; +\n" +"Language-Team: Russian (http://app.transifex.com/Friendica/friendica/language/ru/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ru\n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" + +#: libravatar.php:68 +msgid "generic profile image" +msgstr "" + +#: libravatar.php:69 +msgid "random geometric pattern" +msgstr "" + +#: libravatar.php:70 +msgid "monster face" +msgstr "" + +#: libravatar.php:71 +msgid "computer generated face" +msgstr "" + +#: libravatar.php:72 +msgid "retro arcade style face" +msgstr "" + +#: libravatar.php:73 +msgid "roboter face" +msgstr "" + +#: libravatar.php:74 +msgid "retro adventure game character" +msgstr "" + +#: libravatar.php:78 +msgid "Information" +msgstr "Информация" + +#: libravatar.php:78 +msgid "" +"Gravatar addon is installed. Please disable the Gravatar addon.
The " +"Libravatar addon will fall back to Gravatar if nothing was found at " +"Libravatar." +msgstr "" + +#: libravatar.php:83 +msgid "Save Settings" +msgstr "" + +#: libravatar.php:84 +msgid "Default avatar image" +msgstr "" + +#: libravatar.php:84 +msgid "Select default avatar image if none was found. See README" +msgstr "" diff --git a/libravatar/lang/ru/strings.php b/libravatar/lang/ru/strings.php index 6414c889..053d0249 100644 --- a/libravatar/lang/ru/strings.php +++ b/libravatar/lang/ru/strings.php @@ -1,17 +1,8 @@ -strings["Could NOT install Libravatar successfully.
It requires PHP >= 5.3"] = ""; -$a->strings["generic profile image"] = ""; -$a->strings["random geometric pattern"] = ""; -$a->strings["monster face"] = ""; -$a->strings["computer generated face"] = ""; -$a->strings["retro arcade style face"] = ""; -$a->strings["Warning"] = ""; -$a->strings["Your PHP version %s is lower than the required PHP >= 5.3."] = ""; -$a->strings["This addon is not functional on your server."] = ""; -$a->strings["Information"] = ""; -$a->strings["Gravatar addon is installed. Please disable the Gravatar addon.
The Libravatar addon will fall back to Gravatar if nothing was found at Libravatar."] = ""; -$a->strings["Submit"] = "Подтвердить"; -$a->strings["Default avatar image"] = ""; -$a->strings["Select default avatar image if none was found. See README"] = ""; -$a->strings["Libravatar settings updated."] = ""; +=2 && $n%10<=4 && ($n%100<12 || $n%100>14)) { return 1; } else if ($n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)) { return 2; } else { return 3; } +}} +$a->strings['Information'] = 'Информация'; diff --git a/libravatar/libravatar.php b/libravatar/libravatar.php index 54594b88..6f47bf51 100644 --- a/libravatar/libravatar.php +++ b/libravatar/libravatar.php @@ -6,10 +6,7 @@ * Author: Klaus Weidenbach */ -use Friendica\App; -use Friendica\Core\Addon; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; use Friendica\Core\Config\Util\ConfigFileManager; @@ -21,12 +18,12 @@ function libravatar_install() { Hook::register('load_config', 'addon/libravatar/libravatar.php', 'libravatar_load_config'); Hook::register('avatar_lookup', 'addon/libravatar/libravatar.php', 'libravatar_lookup'); - Logger::notice("registered libravatar in avatar_lookup hook"); + DI::logger()->notice("registered libravatar in avatar_lookup hook"); } function libravatar_load_config(ConfigFileManager $loader) { - DI::app()->getConfigCache()->load($loader->loadAddonConfig('libravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); + DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('libravatar'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); } /** @@ -73,7 +70,9 @@ function libravatar_addon_admin(string &$o) 'pagan' => DI::l10n()->t('retro adventure game character'), ]; - if (Addon::isEnabled('gravatar')) { + $addonHelper = DI::addonHelper(); + + if ($addonHelper->isAddonEnabled('gravatar')) { $o = '
' .DI::l10n()->t('Information') .'

' .DI::l10n()->t('Gravatar addon is installed. Please disable the Gravatar addon.
The Libravatar addon will fall back to Gravatar if nothing was found at Libravatar.') .'



'; } diff --git a/ljpost/lang/bg/messages.po b/ljpost/lang/bg/messages.po new file mode 100644 index 00000000..344ae537 --- /dev/null +++ b/ljpost/lang/bg/messages.po @@ -0,0 +1,43 @@ +# ADDON ljpost +# Copyright (C) +# This file is distributed under the same license as the Friendica ljpost addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:17-0500\n" +"PO-Revision-Date: 2014-06-23 09:51+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: ljpost.php:43 +msgid "Post to LiveJournal" +msgstr "" + +#: ljpost.php:63 +msgid "Enable LiveJournal Post Addon" +msgstr "" + +#: ljpost.php:64 +msgid "LiveJournal username" +msgstr "" + +#: ljpost.php:65 +msgid "LiveJournal password" +msgstr "" + +#: ljpost.php:66 +msgid "Post to LiveJournal by default" +msgstr "" + +#: ljpost.php:71 +msgid "LiveJournal Export" +msgstr "" diff --git a/ljpost/lang/bg/strings.php b/ljpost/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/ljpost/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: ljpost.php:43 +msgid "Post to LiveJournal" +msgstr "" + +#: ljpost.php:63 +msgid "Enable LiveJournal Post Addon" +msgstr "" + +#: ljpost.php:64 +msgid "LiveJournal username" +msgstr "" + +#: ljpost.php:65 +msgid "LiveJournal password" +msgstr "" + +#: ljpost.php:66 +msgid "Post to LiveJournal by default" +msgstr "" + +#: ljpost.php:71 +msgid "LiveJournal Export" +msgstr "" diff --git a/ljpost/lang/ca/strings.php b/ljpost/lang/ca/strings.php index ec370df8..d34874f6 100644 --- a/ljpost/lang/ca/strings.php +++ b/ljpost/lang/ca/strings.php @@ -1,9 +1,7 @@ -strings["Post to LiveJournal"] = "Missatge a Livejournal"; -$a->strings["LiveJournal Post Settings"] = "Configuració d'enviaments a Livejournal"; -$a->strings["Enable LiveJournal Post Addon"] = "Habilitat el addon d'enviaments a Livejournal"; -$a->strings["LiveJournal username"] = "Nom d'usuari a Livejournal"; -$a->strings["LiveJournal password"] = "Contrasenya a Livejournal"; -$a->strings["Post to LiveJournal by default"] = "Enviar per defecte a Livejournal"; -$a->strings["Submit"] = "Enviar"; +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: ljpost.php:43 +msgid "Post to LiveJournal" +msgstr "" + +#: ljpost.php:63 +msgid "Enable LiveJournal Post Addon" +msgstr "" + +#: ljpost.php:64 +msgid "LiveJournal username" +msgstr "" + +#: ljpost.php:65 +msgid "LiveJournal password" +msgstr "" + +#: ljpost.php:66 +msgid "Post to LiveJournal by default" +msgstr "" + +#: ljpost.php:71 +msgid "LiveJournal Export" +msgstr "" diff --git a/ljpost/lang/eo/strings.php b/ljpost/lang/eo/strings.php index 1bd09a6f..68e8a64c 100644 --- a/ljpost/lang/eo/strings.php +++ b/ljpost/lang/eo/strings.php @@ -1,9 +1,7 @@ -strings["Post to LiveJournal"] = "Afiŝi ĉe LiveJournal"; -$a->strings["LiveJournal Post Settings"] = "Agordoj pri afiŝoj ĉe LiveJournal"; -$a->strings["Enable LiveJournal Post Addon"] = "Ŝalti la LiveJournal-afiŝo kromprogramon."; -$a->strings["LiveJournal username"] = "LiveJournal Salutnomo"; -$a->strings["LiveJournal password"] = "LiveJournal pasvorto"; -$a->strings["Post to LiveJournal by default"] = "Defaŭlte afiŝi al LiveJournal"; -$a->strings["Submit"] = "Sendi"; +\n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: ljpost.php:43 +msgid "Post to LiveJournal" +msgstr "" + +#: ljpost.php:63 +msgid "Enable LiveJournal Post Addon" +msgstr "" + +#: ljpost.php:64 +msgid "LiveJournal username" +msgstr "" + +#: ljpost.php:65 +msgid "LiveJournal password" +msgstr "" + +#: ljpost.php:66 +msgid "Post to LiveJournal by default" +msgstr "" + +#: ljpost.php:71 +msgid "LiveJournal Export" +msgstr "" diff --git a/ljpost/lang/gd/strings.php b/ljpost/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/ljpost/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/ljpost/lang/is/messages.po b/ljpost/lang/is/messages.po new file mode 100644 index 00000000..73e10103 --- /dev/null +++ b/ljpost/lang/is/messages.po @@ -0,0 +1,43 @@ +# ADDON ljpost +# Copyright (C) +# This file is distributed under the same license as the Friendica ljpost addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:17-0500\n" +"PO-Revision-Date: 2014-06-23 09:51+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: ljpost.php:43 +msgid "Post to LiveJournal" +msgstr "" + +#: ljpost.php:63 +msgid "Enable LiveJournal Post Addon" +msgstr "" + +#: ljpost.php:64 +msgid "LiveJournal username" +msgstr "" + +#: ljpost.php:65 +msgid "LiveJournal password" +msgstr "" + +#: ljpost.php:66 +msgid "Post to LiveJournal by default" +msgstr "" + +#: ljpost.php:71 +msgid "LiveJournal Export" +msgstr "" diff --git a/ljpost/lang/is/strings.php b/ljpost/lang/is/strings.php index 164dc441..975c341e 100644 --- a/ljpost/lang/is/strings.php +++ b/ljpost/lang/is/strings.php @@ -1,9 +1,7 @@ -strings["Post to LiveJournal"] = ""; -$a->strings["LiveJournal Post Settings"] = ""; -$a->strings["Enable LiveJournal Post Addon"] = ""; -$a->strings["LiveJournal username"] = ""; -$a->strings["LiveJournal password"] = ""; -$a->strings["Post to LiveJournal by default"] = ""; -$a->strings["Submit"] = "Senda inn"; + */ -use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; +use Friendica\Model\Item; use Friendica\Model\Post; use Friendica\Model\Tag; use Friendica\Model\User; @@ -35,7 +34,7 @@ function ljpost_jot_nets(array &$jotnets_fields) return; } - if (DI::pConfig()->get(DI::userSession()->getLocalUserId(),'ljpost','post')) { + if (DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'ljpost', 'post')) { $jotnets_fields[] = [ 'type' => 'checkbox', 'field' => [ @@ -57,7 +56,7 @@ function ljpost_settings(array &$data) $ij_username = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'ljpost', 'ij_username'); $def_enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'ljpost', 'post_by_default'); - $t= Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/ljpost/'); + $t = Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/ljpost/'); $html = Renderer::replaceMacros($t, [ '$enabled' => ['ljpost', DI::l10n()->t('Enable LiveJournal Post Addon'), $enabled], '$username' => ['ij_username', DI::l10n()->t('LiveJournal username'), $ij_username], @@ -86,20 +85,16 @@ function ljpost_settings_post(array &$b) function ljpost_post_local(array &$b) { - // This can probably be changed to allow editing by pointing to a different API endpoint - if ($b['edit']) { - return; - } - if (!DI::userSession()->getLocalUserId() || (DI::userSession()->getLocalUserId() != $b['uid'])) { return; } - if ($b['private'] || $b['parent']) { + // This can probably be changed to allow editing by pointing to a different API endpoint + if ($b['edit'] || ($b['private'] == Item::PRIVATE) || ($b['gravity'] != Item::GRAVITY_PARENT)) { return; } - $lj_post = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(),'ljpost','post')); + $lj_post = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'ljpost', 'post')); $lj_enable = (($lj_post && !empty($_REQUEST['ljpost_enable'])) ? intval($_REQUEST['ljpost_enable']) : 0); if ($b['api_source'] && intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'ljpost', 'post_by_default'))) { @@ -118,11 +113,15 @@ function ljpost_post_local(array &$b) function ljpost_send(array &$b) { - if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) { + if ($b['deleted'] || ($b['private'] == Item::PRIVATE) || ($b['created'] !== $b['edited'])) { return; } - if (!strstr($b['postopts'],'ljpost')) { + if (!strstr($b['postopts'], 'ljpost')) { + return; + } + + if (Item::isGroupPost($b['uri-id'])) { return; } @@ -139,13 +138,13 @@ function ljpost_send(array &$b) $user = User::getById($b['uid']); $tz = $user['timezone'] ?: 'UTC'; - $lj_username = XML::escape(DI::pConfig()->get($b['uid'],'ljpost','lj_username')); - $lj_password = XML::escape(DI::pConfig()->get($b['uid'],'ljpost','lj_password')); - $lj_journal = XML::escape(DI::pConfig()->get($b['uid'],'ljpost','lj_journal')); -// if(! $lj_journal) -// $lj_journal = $lj_username; + $lj_username = XML::escape(DI::pConfig()->get($b['uid'], 'ljpost', 'lj_username')); + $lj_password = XML::escape(DI::pConfig()->get($b['uid'], 'ljpost', 'lj_password')); + $lj_journal = XML::escape(DI::pConfig()->get($b['uid'], 'ljpost', 'lj_journal')); + // if(! $lj_journal) + // $lj_journal = $lj_username; - $lj_blog = XML::escape(DI::pConfig()->get($b['uid'],'ljpost','lj_blog')); + $lj_blog = XML::escape(DI::pConfig()->get($b['uid'], 'ljpost', 'lj_blog')); if (!strlen($lj_blog)) { $lj_blog = XML::escape('http://www.livejournal.com/interface/xmlrpc'); } @@ -157,11 +156,11 @@ function ljpost_send(array &$b) $tags = Tag::getCSVByURIId($b['uri-id'], [Tag::HASHTAG]); $date = DateTimeFormat::convert($b['created'], $tz); - $year = intval(substr($date,0,4)); - $mon = intval(substr($date,5,2)); - $day = intval(substr($date,8,2)); - $hour = intval(substr($date,11,2)); - $min = intval(substr($date,14,2)); + $year = intval(substr($date, 0, 4)); + $mon = intval(substr($date, 5, 2)); + $day = intval(substr($date, 8, 2)); + $hour = intval(substr($date, 11, 2)); + $min = intval(substr($date, 14, 2)); $xml = <<< EOT @@ -204,12 +203,14 @@ function ljpost_send(array &$b) EOT; - Logger::debug('ljpost: data: ' . $xml); + DI::logger()->debug('ljpost: data: ' . $xml); + + $x = ''; if ($lj_blog !== 'test') { - $x = DI::httpClient()->post($lj_blog, $xml, ['Content-Type' => 'text/xml'])->getBody(); + $x = DI::httpClient()->post($lj_blog, $xml, ['Content-Type' => 'text/xml'])->getBodyString(); } - Logger::info('posted to livejournal: ' . ($x) ? $x : ''); + DI::logger()->info('posted to livejournal: ' . $x); } } diff --git a/mailstream/lang/bg/messages.po b/mailstream/lang/bg/messages.po new file mode 100644 index 00000000..8d39dfa6 --- /dev/null +++ b/mailstream/lang/bg/messages.po @@ -0,0 +1,101 @@ +# ADDON mailstream +# Copyright (C) +# This file is distributed under the same license as the Friendica mailstream addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:15-0500\n" +"PO-Revision-Date: 2014-06-23 09:54+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: mailstream.php:77 +msgid "From Address" +msgstr "" + +#: mailstream.php:79 +msgid "Email address that stream items will appear to be from." +msgstr "" + +#: mailstream.php:82 +msgid "Save Settings" +msgstr "" + +#: mailstream.php:311 +msgid "Re:" +msgstr "" + +#: mailstream.php:324 mailstream.php:327 +msgid "Friendica post" +msgstr "" + +#: mailstream.php:330 +msgid "Diaspora post" +msgstr "" + +#: mailstream.php:340 +msgid "Feed item" +msgstr "" + +#: mailstream.php:343 +msgid "Email" +msgstr "" + +#: mailstream.php:345 +msgid "Friendica Item" +msgstr "" + +#: mailstream.php:419 +msgid "Upstream" +msgstr "" + +#: mailstream.php:420 +msgid "URI" +msgstr "" + +#: mailstream.php:421 +msgid "Local" +msgstr "" + +#: mailstream.php:499 +msgid "Enabled" +msgstr "" + +#: mailstream.php:504 +msgid "Email Address" +msgstr "" + +#: mailstream.php:506 +msgid "Leave blank to use your account email address" +msgstr "" + +#: mailstream.php:510 +msgid "Exclude Likes" +msgstr "" + +#: mailstream.php:512 +msgid "Check this to omit mailing \"Like\" notifications" +msgstr "" + +#: mailstream.php:516 +msgid "Attach Images" +msgstr "" + +#: mailstream.php:518 +msgid "" +"Download images in posts and attach them to the email. Useful for reading " +"email while offline." +msgstr "" + +#: mailstream.php:525 +msgid "Mail Stream Settings" +msgstr "" diff --git a/mailstream/lang/bg/strings.php b/mailstream/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/mailstream/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: mailstream.php:77 +msgid "From Address" +msgstr "" + +#: mailstream.php:79 +msgid "Email address that stream items will appear to be from." +msgstr "" + +#: mailstream.php:82 +msgid "Save Settings" +msgstr "" + +#: mailstream.php:311 +msgid "Re:" +msgstr "" + +#: mailstream.php:324 mailstream.php:327 +msgid "Friendica post" +msgstr "" + +#: mailstream.php:330 +msgid "Diaspora post" +msgstr "" + +#: mailstream.php:340 +msgid "Feed item" +msgstr "" + +#: mailstream.php:343 +msgid "Email" +msgstr "" + +#: mailstream.php:345 +msgid "Friendica Item" +msgstr "" + +#: mailstream.php:419 +msgid "Upstream" +msgstr "" + +#: mailstream.php:420 +msgid "URI" +msgstr "" + +#: mailstream.php:421 +msgid "Local" +msgstr "" + +#: mailstream.php:499 +msgid "Enabled" +msgstr "" + +#: mailstream.php:504 +msgid "Email Address" +msgstr "" + +#: mailstream.php:506 +msgid "Leave blank to use your account email address" +msgstr "" + +#: mailstream.php:510 +msgid "Exclude Likes" +msgstr "" + +#: mailstream.php:512 +msgid "Check this to omit mailing \"Like\" notifications" +msgstr "" + +#: mailstream.php:516 +msgid "Attach Images" +msgstr "" + +#: mailstream.php:518 +msgid "" +"Download images in posts and attach them to the email. Useful for reading " +"email while offline." +msgstr "" + +#: mailstream.php:525 +msgid "Mail Stream Settings" +msgstr "" diff --git a/mailstream/lang/ca/strings.php b/mailstream/lang/ca/strings.php new file mode 100644 index 00000000..d34874f6 --- /dev/null +++ b/mailstream/lang/ca/strings.php @@ -0,0 +1,7 @@ +, 2022 +# Raroun, 2023 # Tobias Diekershoff , 2018 # Ulf Rompe , 2019 msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-03-11 19:13+0100\n" -"PO-Revision-Date: 2019-02-18 15:05+0000\n" -"Last-Translator: Ulf Rompe \n" -"Language-Team: German (http://www.transifex.com/Friendica/friendica/language/de/)\n" +"POT-Creation-Date: 2021-11-21 19:15-0500\n" +"PO-Revision-Date: 2014-06-23 09:54+0000\n" +"Last-Translator: Raroun, 2023\n" +"Language-Team: German (http://app.transifex.com/Friendica/friendica/language/de/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -29,72 +31,76 @@ msgstr "Absender" msgid "Email address that stream items will appear to be from." msgstr "E-Mail-Adresse, die in hochgeladenen Artikeln erscheint." -#: mailstream.php:82 mailstream.php:380 +#: mailstream.php:82 msgid "Save Settings" msgstr "Einstellungen speichern" -#: mailstream.php:223 +#: mailstream.php:311 msgid "Re:" msgstr "Re:" -#: mailstream.php:231 +#: mailstream.php:324 mailstream.php:327 msgid "Friendica post" msgstr "Friendica-Veröffentlichung" -#: mailstream.php:234 +#: mailstream.php:330 msgid "Diaspora post" msgstr "Diaspora-Veröffentlichung" -#: mailstream.php:244 +#: mailstream.php:340 msgid "Feed item" msgstr "Artikel-Feed" -#: mailstream.php:247 +#: mailstream.php:343 msgid "Email" msgstr "E-Mail" -#: mailstream.php:249 +#: mailstream.php:345 msgid "Friendica Item" msgstr "Friendica-Artikel" -#: mailstream.php:293 +#: mailstream.php:419 msgid "Upstream" msgstr "Upstream" -#: mailstream.php:294 +#: mailstream.php:420 +msgid "URI" +msgstr "URI" + +#: mailstream.php:421 msgid "Local" msgstr "Lokal" -#: mailstream.php:362 +#: mailstream.php:499 msgid "Enabled" -msgstr "eingeschaltet" +msgstr "Aktiv" -#: mailstream.php:366 +#: mailstream.php:504 msgid "Email Address" msgstr "E-Mail-Adresse" -#: mailstream.php:368 +#: mailstream.php:506 msgid "Leave blank to use your account email address" msgstr "Leer lassen für deine Konto-E-Mail-Addresse" -#: mailstream.php:371 +#: mailstream.php:510 msgid "Exclude Likes" msgstr "Likes ignorieren" -#: mailstream.php:373 +#: mailstream.php:512 msgid "Check this to omit mailing \"Like\" notifications" msgstr "Diese Option verhindert das Versenden von \"Like\"-Benachrichtigungen per E-Mail." -#: mailstream.php:376 +#: mailstream.php:516 msgid "Attach Images" msgstr "Bilder anhängen" -#: mailstream.php:378 +#: mailstream.php:518 msgid "" "Download images in posts and attach them to the email. Useful for reading " "email while offline." msgstr "Sollen Bilder, die im Beitrag eingebettet sind, als Dateianhang in den E-Mails verschickt werden?" -#: mailstream.php:379 +#: mailstream.php:525 msgid "Mail Stream Settings" msgstr "Mail-Nachrichten-Einstellungen" diff --git a/mailstream/lang/de/strings.php b/mailstream/lang/de/strings.php index 80f9a7a2..e107b7d0 100644 --- a/mailstream/lang/de/strings.php +++ b/mailstream/lang/de/strings.php @@ -15,8 +15,9 @@ $a->strings['Feed item'] = 'Artikel-Feed'; $a->strings['Email'] = 'E-Mail'; $a->strings['Friendica Item'] = 'Friendica-Artikel'; $a->strings['Upstream'] = 'Upstream'; +$a->strings['URI'] = 'URI'; $a->strings['Local'] = 'Lokal'; -$a->strings['Enabled'] = 'eingeschaltet'; +$a->strings['Enabled'] = 'Aktiv'; $a->strings['Email Address'] = 'E-Mail-Adresse'; $a->strings['Leave blank to use your account email address'] = 'Leer lassen für deine Konto-E-Mail-Addresse'; $a->strings['Exclude Likes'] = 'Likes ignorieren'; diff --git a/mailstream/lang/eo/messages.po b/mailstream/lang/eo/messages.po new file mode 100644 index 00000000..3898f09e --- /dev/null +++ b/mailstream/lang/eo/messages.po @@ -0,0 +1,101 @@ +# ADDON mailstream +# Copyright (C) +# This file is distributed under the same license as the Friendica mailstream addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:15-0500\n" +"PO-Revision-Date: 2014-06-23 09:54+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: mailstream.php:77 +msgid "From Address" +msgstr "" + +#: mailstream.php:79 +msgid "Email address that stream items will appear to be from." +msgstr "" + +#: mailstream.php:82 +msgid "Save Settings" +msgstr "" + +#: mailstream.php:311 +msgid "Re:" +msgstr "" + +#: mailstream.php:324 mailstream.php:327 +msgid "Friendica post" +msgstr "" + +#: mailstream.php:330 +msgid "Diaspora post" +msgstr "" + +#: mailstream.php:340 +msgid "Feed item" +msgstr "" + +#: mailstream.php:343 +msgid "Email" +msgstr "" + +#: mailstream.php:345 +msgid "Friendica Item" +msgstr "" + +#: mailstream.php:419 +msgid "Upstream" +msgstr "" + +#: mailstream.php:420 +msgid "URI" +msgstr "" + +#: mailstream.php:421 +msgid "Local" +msgstr "" + +#: mailstream.php:499 +msgid "Enabled" +msgstr "" + +#: mailstream.php:504 +msgid "Email Address" +msgstr "" + +#: mailstream.php:506 +msgid "Leave blank to use your account email address" +msgstr "" + +#: mailstream.php:510 +msgid "Exclude Likes" +msgstr "" + +#: mailstream.php:512 +msgid "Check this to omit mailing \"Like\" notifications" +msgstr "" + +#: mailstream.php:516 +msgid "Attach Images" +msgstr "" + +#: mailstream.php:518 +msgid "" +"Download images in posts and attach them to the email. Useful for reading " +"email while offline." +msgstr "" + +#: mailstream.php:525 +msgid "Mail Stream Settings" +msgstr "" diff --git a/mailstream/lang/eo/strings.php b/mailstream/lang/eo/strings.php new file mode 100644 index 00000000..68e8a64c --- /dev/null +++ b/mailstream/lang/eo/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Estonian (http://app.transifex.com/Friendica/friendica/language/et/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: et\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: mailstream.php:77 +msgid "From Address" +msgstr "" + +#: mailstream.php:79 +msgid "Email address that stream items will appear to be from." +msgstr "" + +#: mailstream.php:82 +msgid "Save Settings" +msgstr "" + +#: mailstream.php:311 +msgid "Re:" +msgstr "" + +#: mailstream.php:324 mailstream.php:327 +msgid "Friendica post" +msgstr "" + +#: mailstream.php:330 +msgid "Diaspora post" +msgstr "" + +#: mailstream.php:340 +msgid "Feed item" +msgstr "" + +#: mailstream.php:343 +msgid "Email" +msgstr "" + +#: mailstream.php:345 +msgid "Friendica Item" +msgstr "" + +#: mailstream.php:419 +msgid "Upstream" +msgstr "" + +#: mailstream.php:420 +msgid "URI" +msgstr "" + +#: mailstream.php:421 +msgid "Local" +msgstr "" + +#: mailstream.php:499 +msgid "Enabled" +msgstr "" + +#: mailstream.php:504 +msgid "Email Address" +msgstr "" + +#: mailstream.php:506 +msgid "Leave blank to use your account email address" +msgstr "" + +#: mailstream.php:510 +msgid "Exclude Likes" +msgstr "" + +#: mailstream.php:512 +msgid "Check this to omit mailing \"Like\" notifications" +msgstr "" + +#: mailstream.php:516 +msgid "Attach Images" +msgstr "" + +#: mailstream.php:518 +msgid "" +"Download images in posts and attach them to the email. Useful for reading " +"email while offline." +msgstr "" + +#: mailstream.php:525 +msgid "Mail Stream Settings" +msgstr "" diff --git a/mailstream/lang/et/strings.php b/mailstream/lang/et/strings.php new file mode 100644 index 00000000..dfe78358 --- /dev/null +++ b/mailstream/lang/et/strings.php @@ -0,0 +1,7 @@ +, 2015 # StefOfficiel , 2015 @@ -13,8 +14,8 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-11-21 19:15-0500\n" "PO-Revision-Date: 2014-06-23 09:54+0000\n" -"Last-Translator: Nicolas Derive, 2022\n" -"Language-Team: French (http://www.transifex.com/Friendica/friendica/language/fr/)\n" +"Last-Translator: Florent C., 2023\n" +"Language-Team: French (http://app.transifex.com/Friendica/friendica/language/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -33,68 +34,72 @@ msgstr "Adresse de courriel de laquelle les éléments du flux sembleront proven msgid "Save Settings" msgstr "Sauvegarder les paramètres" -#: mailstream.php:301 +#: mailstream.php:311 msgid "Re:" msgstr "Re :" -#: mailstream.php:314 mailstream.php:317 +#: mailstream.php:324 mailstream.php:327 msgid "Friendica post" msgstr "Message Friendica" -#: mailstream.php:320 +#: mailstream.php:330 msgid "Diaspora post" msgstr "Message Diaspora" -#: mailstream.php:330 +#: mailstream.php:340 msgid "Feed item" msgstr "Élément du flux" -#: mailstream.php:333 +#: mailstream.php:343 msgid "Email" msgstr "Courriel" -#: mailstream.php:335 +#: mailstream.php:345 msgid "Friendica Item" msgstr "Élément de Friendica" -#: mailstream.php:404 +#: mailstream.php:419 msgid "Upstream" msgstr "En amont" -#: mailstream.php:405 +#: mailstream.php:420 +msgid "URI" +msgstr "URI" + +#: mailstream.php:421 msgid "Local" msgstr "Local" -#: mailstream.php:481 +#: mailstream.php:499 msgid "Enabled" msgstr "Activer" -#: mailstream.php:486 +#: mailstream.php:504 msgid "Email Address" msgstr "Adresse de courriel" -#: mailstream.php:488 +#: mailstream.php:506 msgid "Leave blank to use your account email address" msgstr "Laissez vide pour utiliser l'adresse de courriel de votre compte" -#: mailstream.php:492 +#: mailstream.php:510 msgid "Exclude Likes" msgstr "Exclure les \"j'aime\"" -#: mailstream.php:494 +#: mailstream.php:512 msgid "Check this to omit mailing \"Like\" notifications" msgstr "Cochez ceci pour éviter d'envoyer les notifications des \"J'aime\"" -#: mailstream.php:498 +#: mailstream.php:516 msgid "Attach Images" msgstr "Attacher les images" -#: mailstream.php:500 +#: mailstream.php:518 msgid "" "Download images in posts and attach them to the email. Useful for reading " "email while offline." msgstr "Télécharger les images des messages et les attacher au courriel. Utile pour les les courriels hors-ligne." -#: mailstream.php:507 +#: mailstream.php:525 msgid "Mail Stream Settings" msgstr "Paramètres de Mail Stream" diff --git a/mailstream/lang/fr/strings.php b/mailstream/lang/fr/strings.php index bfaf4389..a21d80b8 100644 --- a/mailstream/lang/fr/strings.php +++ b/mailstream/lang/fr/strings.php @@ -15,6 +15,7 @@ $a->strings['Feed item'] = 'Élément du flux'; $a->strings['Email'] = 'Courriel'; $a->strings['Friendica Item'] = 'Élément de Friendica'; $a->strings['Upstream'] = 'En amont'; +$a->strings['URI'] = 'URI'; $a->strings['Local'] = 'Local'; $a->strings['Enabled'] = 'Activer'; $a->strings['Email Address'] = 'Adresse de courriel'; diff --git a/mailstream/lang/gd/messages.po b/mailstream/lang/gd/messages.po new file mode 100644 index 00000000..e86702a5 --- /dev/null +++ b/mailstream/lang/gd/messages.po @@ -0,0 +1,101 @@ +# ADDON mailstream +# Copyright (C) +# This file is distributed under the same license as the Friendica mailstream addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:15-0500\n" +"PO-Revision-Date: 2014-06-23 09:54+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: mailstream.php:77 +msgid "From Address" +msgstr "" + +#: mailstream.php:79 +msgid "Email address that stream items will appear to be from." +msgstr "" + +#: mailstream.php:82 +msgid "Save Settings" +msgstr "" + +#: mailstream.php:311 +msgid "Re:" +msgstr "" + +#: mailstream.php:324 mailstream.php:327 +msgid "Friendica post" +msgstr "" + +#: mailstream.php:330 +msgid "Diaspora post" +msgstr "" + +#: mailstream.php:340 +msgid "Feed item" +msgstr "" + +#: mailstream.php:343 +msgid "Email" +msgstr "" + +#: mailstream.php:345 +msgid "Friendica Item" +msgstr "" + +#: mailstream.php:419 +msgid "Upstream" +msgstr "" + +#: mailstream.php:420 +msgid "URI" +msgstr "" + +#: mailstream.php:421 +msgid "Local" +msgstr "" + +#: mailstream.php:499 +msgid "Enabled" +msgstr "" + +#: mailstream.php:504 +msgid "Email Address" +msgstr "" + +#: mailstream.php:506 +msgid "Leave blank to use your account email address" +msgstr "" + +#: mailstream.php:510 +msgid "Exclude Likes" +msgstr "" + +#: mailstream.php:512 +msgid "Check this to omit mailing \"Like\" notifications" +msgstr "" + +#: mailstream.php:516 +msgid "Attach Images" +msgstr "" + +#: mailstream.php:518 +msgid "" +"Download images in posts and attach them to the email. Useful for reading " +"email while offline." +msgstr "" + +#: mailstream.php:525 +msgid "Mail Stream Settings" +msgstr "" diff --git a/mailstream/lang/gd/strings.php b/mailstream/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/mailstream/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/mailstream/lang/hu/messages.po b/mailstream/lang/hu/messages.po index 3302564d..66d09299 100644 --- a/mailstream/lang/hu/messages.po +++ b/mailstream/lang/hu/messages.po @@ -4,15 +4,15 @@ # # # Translators: -# Balázs Úr, 2020-2021 +# Balázs Úr, 2020-2021,2023 msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-11-21 19:15-0500\n" "PO-Revision-Date: 2014-06-23 09:54+0000\n" -"Last-Translator: Balázs Úr, 2020-2021\n" -"Language-Team: Hungarian (http://www.transifex.com/Friendica/friendica/language/hu/)\n" +"Last-Translator: Balázs Úr, 2020-2021,2023\n" +"Language-Team: Hungarian (http://app.transifex.com/Friendica/friendica/language/hu/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -31,68 +31,72 @@ msgstr "E-mail-cím, ahonnan úgy tűnik, hogy a folyam elemei származnak." msgid "Save Settings" msgstr "Beállítások mentése" -#: mailstream.php:301 +#: mailstream.php:311 msgid "Re:" msgstr "Vá:" -#: mailstream.php:314 mailstream.php:317 +#: mailstream.php:324 mailstream.php:327 msgid "Friendica post" msgstr "Friendica-bejegyzés" -#: mailstream.php:320 +#: mailstream.php:330 msgid "Diaspora post" msgstr "Diaspora-bejegyzés" -#: mailstream.php:330 +#: mailstream.php:340 msgid "Feed item" msgstr "Hírforráselem" -#: mailstream.php:333 +#: mailstream.php:343 msgid "Email" msgstr "E-mail" -#: mailstream.php:335 +#: mailstream.php:345 msgid "Friendica Item" msgstr "Friendica-elem" -#: mailstream.php:404 +#: mailstream.php:419 msgid "Upstream" msgstr "Távoli" -#: mailstream.php:405 +#: mailstream.php:420 +msgid "URI" +msgstr "URI" + +#: mailstream.php:421 msgid "Local" msgstr "Helyi" -#: mailstream.php:481 +#: mailstream.php:499 msgid "Enabled" msgstr "Engedélyezve" -#: mailstream.php:486 +#: mailstream.php:504 msgid "Email Address" msgstr "E-mail-cím" -#: mailstream.php:488 +#: mailstream.php:506 msgid "Leave blank to use your account email address" msgstr "Hagyja üresen a fiókja e-mail-címének használatához" -#: mailstream.php:492 +#: mailstream.php:510 msgid "Exclude Likes" msgstr "Kedvelések kizárása" -#: mailstream.php:494 +#: mailstream.php:512 msgid "Check this to omit mailing \"Like\" notifications" msgstr "Jelölje be ezt a „Tetszik” értesítések elküldésének kihagyásához" -#: mailstream.php:498 +#: mailstream.php:516 msgid "Attach Images" msgstr "Képek csatolása" -#: mailstream.php:500 +#: mailstream.php:518 msgid "" "Download images in posts and attach them to the email. Useful for reading " "email while offline." msgstr "Képek letöltése a bejegyzésekből és csatolás az e-mailhez. Hasznos az e-mailek kapcsolat nélküli olvasásakor." -#: mailstream.php:507 +#: mailstream.php:525 msgid "Mail Stream Settings" msgstr "Levelezőfolyam beállításai" diff --git a/mailstream/lang/hu/strings.php b/mailstream/lang/hu/strings.php index 5a7383bd..5b1e5a51 100644 --- a/mailstream/lang/hu/strings.php +++ b/mailstream/lang/hu/strings.php @@ -15,6 +15,7 @@ $a->strings['Feed item'] = 'Hírforráselem'; $a->strings['Email'] = 'E-mail'; $a->strings['Friendica Item'] = 'Friendica-elem'; $a->strings['Upstream'] = 'Távoli'; +$a->strings['URI'] = 'URI'; $a->strings['Local'] = 'Helyi'; $a->strings['Enabled'] = 'Engedélyezve'; $a->strings['Email Address'] = 'E-mail-cím'; diff --git a/mailstream/lang/is/messages.po b/mailstream/lang/is/messages.po new file mode 100644 index 00000000..1efd940c --- /dev/null +++ b/mailstream/lang/is/messages.po @@ -0,0 +1,101 @@ +# ADDON mailstream +# Copyright (C) +# This file is distributed under the same license as the Friendica mailstream addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:15-0500\n" +"PO-Revision-Date: 2014-06-23 09:54+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: mailstream.php:77 +msgid "From Address" +msgstr "" + +#: mailstream.php:79 +msgid "Email address that stream items will appear to be from." +msgstr "" + +#: mailstream.php:82 +msgid "Save Settings" +msgstr "" + +#: mailstream.php:311 +msgid "Re:" +msgstr "" + +#: mailstream.php:324 mailstream.php:327 +msgid "Friendica post" +msgstr "" + +#: mailstream.php:330 +msgid "Diaspora post" +msgstr "" + +#: mailstream.php:340 +msgid "Feed item" +msgstr "" + +#: mailstream.php:343 +msgid "Email" +msgstr "" + +#: mailstream.php:345 +msgid "Friendica Item" +msgstr "" + +#: mailstream.php:419 +msgid "Upstream" +msgstr "" + +#: mailstream.php:420 +msgid "URI" +msgstr "" + +#: mailstream.php:421 +msgid "Local" +msgstr "" + +#: mailstream.php:499 +msgid "Enabled" +msgstr "" + +#: mailstream.php:504 +msgid "Email Address" +msgstr "" + +#: mailstream.php:506 +msgid "Leave blank to use your account email address" +msgstr "" + +#: mailstream.php:510 +msgid "Exclude Likes" +msgstr "" + +#: mailstream.php:512 +msgid "Check this to omit mailing \"Like\" notifications" +msgstr "" + +#: mailstream.php:516 +msgid "Attach Images" +msgstr "" + +#: mailstream.php:518 +msgid "" +"Download images in posts and attach them to the email. Useful for reading " +"email while offline." +msgstr "" + +#: mailstream.php:525 +msgid "Mail Stream Settings" +msgstr "" diff --git a/mailstream/lang/is/strings.php b/mailstream/lang/is/strings.php new file mode 100644 index 00000000..975c341e --- /dev/null +++ b/mailstream/lang/is/strings.php @@ -0,0 +1,7 @@ +strings['Feed item'] = 'Element kanału'; $a->strings['Email'] = 'E-mail'; $a->strings['Friendica Item'] = 'Pozycja Friendica'; $a->strings['Upstream'] = 'Nadrzędny'; +$a->strings['URI'] = 'URI'; $a->strings['Local'] = 'Lokalny'; $a->strings['Enabled'] = 'Włączone'; $a->strings['Email Address'] = 'Adres e-mail'; diff --git a/mailstream/lang/ru/messages.po b/mailstream/lang/ru/messages.po new file mode 100644 index 00000000..cabb4b45 --- /dev/null +++ b/mailstream/lang/ru/messages.po @@ -0,0 +1,101 @@ +# ADDON mailstream +# Copyright (C) +# This file is distributed under the same license as the Friendica mailstream addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:15-0500\n" +"PO-Revision-Date: 2014-06-23 09:54+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Russian (http://app.transifex.com/Friendica/friendica/language/ru/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ru\n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" + +#: mailstream.php:77 +msgid "From Address" +msgstr "" + +#: mailstream.php:79 +msgid "Email address that stream items will appear to be from." +msgstr "" + +#: mailstream.php:82 +msgid "Save Settings" +msgstr "" + +#: mailstream.php:311 +msgid "Re:" +msgstr "" + +#: mailstream.php:324 mailstream.php:327 +msgid "Friendica post" +msgstr "" + +#: mailstream.php:330 +msgid "Diaspora post" +msgstr "" + +#: mailstream.php:340 +msgid "Feed item" +msgstr "" + +#: mailstream.php:343 +msgid "Email" +msgstr "" + +#: mailstream.php:345 +msgid "Friendica Item" +msgstr "" + +#: mailstream.php:419 +msgid "Upstream" +msgstr "" + +#: mailstream.php:420 +msgid "URI" +msgstr "" + +#: mailstream.php:421 +msgid "Local" +msgstr "" + +#: mailstream.php:499 +msgid "Enabled" +msgstr "" + +#: mailstream.php:504 +msgid "Email Address" +msgstr "" + +#: mailstream.php:506 +msgid "Leave blank to use your account email address" +msgstr "" + +#: mailstream.php:510 +msgid "Exclude Likes" +msgstr "" + +#: mailstream.php:512 +msgid "Check this to omit mailing \"Like\" notifications" +msgstr "" + +#: mailstream.php:516 +msgid "Attach Images" +msgstr "" + +#: mailstream.php:518 +msgid "" +"Download images in posts and attach them to the email. Useful for reading " +"email while offline." +msgstr "" + +#: mailstream.php:525 +msgid "Mail Stream Settings" +msgstr "" diff --git a/mailstream/lang/ru/strings.php b/mailstream/lang/ru/strings.php new file mode 100644 index 00000000..0579fc21 --- /dev/null +++ b/mailstream/lang/ru/strings.php @@ -0,0 +1,7 @@ +=2 && $n%10<=4 && ($n%100<12 || $n%100>14)) { return 1; } else if ($n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)) { return 2; } else { return 3; } +}} diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index 542a1a42..a5aafdc7 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -6,22 +6,19 @@ * Author: Matthew Exon */ -use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; -use Friendica\Model\Item; use Friendica\Model\Post; use Friendica\Model\User; use Friendica\Network\HTTPClient\Client\HttpClientAccept; +use Friendica\Network\HTTPClient\Client\HttpClientOptions; use Friendica\Protocol\Activity; -use Friendica\Util\DateTimeFormat; /** * Sets up the addon hooks and the database table @@ -34,26 +31,7 @@ function mailstream_install() Hook::register('post_remote_end', 'addon/mailstream/mailstream.php', 'mailstream_post_hook'); Hook::register('mailstream_send_hook', 'addon/mailstream/mailstream.php', 'mailstream_send_hook'); - Logger::info("mailstream: installed"); -} - -/** - * Enforces that mailstream_install has set up the current version - */ -function mailstream_check_version() -{ - if (!is_null(DI::config()->get('mailstream', 'dbversion'))) { - DI::config()->delete('mailstream', 'dbversion'); - Logger::info("mailstream_check_version: old version detected, reinstalling"); - mailstream_install(); - Hook::loadHooks(); - Hook::add( - 'mailstream_convert_table_entries', - 'addon/mailstream/mailstream.php', - 'mailstream_convert_table_entries' - ); - Hook::fork(Worker::PRIORITY_LOW, 'mailstream_convert_table_entries'); - } + DI::logger()->info("installed mailstream"); } /** @@ -66,17 +44,18 @@ function mailstream_module() {} /** * Adds an item in "addon features" in the admin menu of the site * - * @param App $a App object (unused) * @param string $o HTML form data */ -function mailstream_addon_admin(App $a, string &$o) +function mailstream_addon_admin(string &$o) { $frommail = DI::config()->get('mailstream', 'frommail'); $template = Renderer::getMarkupTemplate('admin.tpl', 'addon/mailstream/'); - $config = ['frommail', + $config = [ + 'frommail', DI::l10n()->t('From Address'), $frommail, - DI::l10n()->t('Email address that stream items will appear to be from.')]; + DI::l10n()->t('Email address that stream items will appear to be from.') + ]; $o .= Renderer::replaceMacros($template, [ '$frommail' => $config, '$submit' => DI::l10n()->t('Save Settings') @@ -93,6 +72,68 @@ function mailstream_addon_admin_post() } } +/** + * Creates content for the "References" header. When the message is + * part of a thread, this contains a handful of message IDs of other + * messages in the thread. This should provide enough clues for mail + * agents to thread messages together, even if some messages or + * references are missing. See https://www.jwz.org/doc/threading.html + * + * According to RFC 1036, these references should be in forwards + * chronological order separated by spaces. That is, the first + * message ID is the top-level post, then the first-level reply, then + * the second-level reply, and so on, ending in the direct parent. + * The RFC allows for message IDs to be omitted for length. To save + * database queries we only include the three nearest replies in the + * chain, plus the top-level post. + * + * @param array $item content of the item + * + * @return string the set of references as a space-separated string + */ +function mailstream_generate_references(array $item): string +{ + $ancestor_message_ids = []; + + $top_level_post_uri = ""; + if (array_key_exists("parent-uri", $item)) { + $top_level_post_uri = $item["parent-uri"]; + } + + $ancestor_uri = ""; + if (array_key_exists("thr-parent", $item)) { + $ancestor_uri = $item["thr-parent"]; + } + while ($ancestor_uri && count($ancestor_message_ids) < 3) { + if ($ancestor_uri == $top_level_post_uri) { + break; + } + $ancestor_message_id = mailstream_generate_id($ancestor_uri); + array_unshift($ancestor_message_ids, $ancestor_message_id); + + $ancestor = Post::selectFirst([], array("uid" => $item["uid"], "uri" => $ancestor_uri)); + if (empty($ancestor)) { + DI::logger()->error("Could not retrieve ancestor post", ["uri" => $item["uri"], "uid" => $item["uid"], "ancestor-uri" => $ancestor_uri]); + break; + } + if (!array_key_exists("thr-parent", $ancestor)) { + break; + } + $ancestor_uri = $ancestor["thr-parent"]; + } + + if ($top_level_post_uri) { + $top_level_post_message_id = mailstream_generate_id($top_level_post_uri); + array_unshift($ancestor_message_ids, $top_level_post_message_id); + } + + if (empty($ancestor_message_ids)) { + DI::logger()->error('cannot generate references for item with no parent', ["uri" => $item['uri']]); + return ""; + } + return implode(" ", $ancestor_message_ids); +} + /** * Creates a message ID for a post URI in accordance with RFC 1036 * See also http://www.jwz.org/doc/mid.html @@ -103,32 +144,32 @@ function mailstream_addon_admin_post() */ function mailstream_generate_id(string $uri): string { - $host = DI::baseUrl()->getHostname(); + $host = DI::baseUrl()->getHost(); $resource = hash('md5', $uri); $message_id = "<" . $resource . "@" . $host . ">"; - Logger::debug('mailstream: Generated message ID ' . $message_id . ' for URI ' . $uri); + DI::logger()->debug('generated message ID', ['id' => $message_id, 'uri' => $uri]); return $message_id; } -function mailstream_send_hook(App $a, array $data) +function mailstream_send_hook(array $data) { $criteria = array('uid' => $data['uid'], 'contact-id' => $data['contact-id'], 'uri' => $data['uri']); $item = Post::selectFirst([], $criteria); if (empty($item)) { - Logger::error('mailstream_send_hook could not find item'); + DI::logger()->error('could not find item'); return; } $user = User::getById($item['uid']); if (empty($user)) { - Logger::error('mailstream_send_hook could not fund user', ['uid' => $item['uid']]); + DI::logger()->error('could not find user', ['uid' => $item['uid']]); return; } if (!mailstream_send($data['message_id'], $item, $user)) { - Logger::debug('mailstream_send_hook send failed, will retry', $data); + DI::logger()->debug('send failed, will retry', $data); if (!Worker::defer()) { - Logger::error('mailstream_send_hook failed and could not defer', $data); + DI::logger()->error('failed and could not defer', $data); } } } @@ -138,37 +179,38 @@ function mailstream_send_hook(App $a, array $data) * mailstream is enabled and the necessary data is available, forks a * workerqueue item to send the email. * - * @param App $a App object (unused) * @param array $item content of the item (may or may not already be stored in the item table) * @return void */ -function mailstream_post_hook(App $a, array &$item) +function mailstream_post_hook(array &$item) { - mailstream_check_version(); - - if (!DI::pConfig()->get($item['uid'], 'mailstream', 'enabled')) { - Logger::debug('mailstream: not enabled.', ['item' => $item['id'], ' uid ' => $item['uid']]); + if ($item['uid'] === 0) { + DI::logger()->debug('mailstream: root user, skipping item ' . $item['id']); return; } - if (!$item['uid']) { - Logger::debug('mailstream: no uid for item ' . $item['id']); + if (!DI::pConfig()->get($item['uid'], 'mailstream', 'enabled')) { + DI::logger()->debug('mailstream: not enabled.', ['item' => $item['id'], ' uid ' => $item['uid']]); return; } if (!$item['contact-id']) { - Logger::debug('mailstream: no contact-id for item ' . $item['id']); + DI::logger()->debug('no contact-id', ['item' => $item['id']]); return; } if (!$item['uri']) { - Logger::debug('mailstream: no uri for item ' . $item['id']); + DI::logger()->debug('no uri', ['item' => $item['id']]); return; } if ($item['verb'] == Activity::ANNOUNCE) { - Logger::debug('mailstream: announce item ', ['item' => $item['id']]); + DI::logger()->debug('ignoring announce', ['item' => $item['id']]); return; } if (DI::pConfig()->get($item['uid'], 'mailstream', 'nolikes')) { if ($item['verb'] == Activity::LIKE) { - Logger::debug('mailstream: like item ' . $item['id']); + DI::logger()->debug('ignoring like', ['item' => $item['id']]); + return; + } + if ($item['verb'] == Activity::DISLIKE) { + DI::logger()->debug('ignoring dislike', ['item' => $item['id']]); return; } } @@ -199,7 +241,7 @@ function mailstream_post_hook(App $a, array &$item) function mailstream_do_images(array &$item, array &$attachments) { if (!DI::pConfig()->get($item['uid'], 'mailstream', 'attachimg')) { - return; + return $attachments; } $attachments = []; @@ -216,9 +258,22 @@ function mailstream_do_images(array &$item, array &$attachments) } $cookiejar = tempnam(System::getTempPath(), 'cookiejar-mailstream-'); - $curlResult = DI::httpClient()->fetchFull($url, HttpClientAccept::DEFAULT, 0, $cookiejar); + try { + $curlResult = DI::httpClient()->get($url, HttpClientAccept::DEFAULT, [HttpClientOptions::COOKIEJAR => $cookiejar]); + if (!$curlResult->isSuccess()) { + DI::logger()->debug('mailstream: fetch image url failed', [ + 'url' => $url, + 'item_id' => $item['id'], + 'return_code' => $curlResult->getReturnCode() + ]); + continue; + } + } catch (InvalidArgumentException $e) { + DI::logger()->error('exception fetching url', ['url' => $url, 'item_id' => $item['id']]); + continue; + } $attachments[$url] = [ - 'data' => $curlResult->getBody(), + 'data' => $curlResult->getBodyString(), 'guid' => hash('crc32', $url), 'filename' => basename($components['path']), 'type' => $curlResult->getContentType() @@ -255,12 +310,13 @@ function mailstream_sender(array $item): string * Converts a bbcode-encoded subject line into a plaintext version suitable for the subject line of an email * * @param string $subject bbcode-encoded subject line + * @param int $uri_id * * @return string plaintext subject line */ -function mailstream_decode_subject(string $subject): string +function mailstream_decode_subject(string $subject, int $uri_id): string { - $html = BBCode::convert($subject); + $html = BBCode::convertForUriId($uri_id, $subject); if (!$html) { return $subject; } @@ -295,7 +351,7 @@ function mailstream_decode_subject(string $subject): string function mailstream_subject(array $item): string { if ($item['title']) { - return mailstream_decode_subject($item['title']); + return mailstream_decode_subject($item['title'], $item['uri-id']); } $parent = $item['thr-parent']; // Don't look more than 100 levels deep for a subject, in case of loops @@ -308,19 +364,18 @@ function mailstream_subject(array $item): string break; } if ($parent_item['title']) { - return DI::l10n()->t('Re:') . ' ' . mailstream_decode_subject($parent_item['title']); + return DI::l10n()->t('Re:') . ' ' . mailstream_decode_subject($parent_item['title'], $item['uri-id']); } $parent = $parent_item['thr-parent']; } $contact = Contact::selectFirst([], ['id' => $item['contact-id'], 'uid' => $item['uid']]); if (!DBA::isResult($contact)) { - Logger::error( - 'mailstream_subject no contact for item', - ['id' => $item['id'], - 'plink' => $item['plink'], - 'contact id' => $item['contact-id'], - 'uid' => $item['uid']] - ); + DI::logger()->error('no contact', [ + 'item' => $item['id'], + 'plink' => $item['plink'], + 'contact id' => $item['contact-id'], + 'uid' => $item['uid'] + ]); return DI::l10n()->t("Friendica post"); } if ($contact['network'] === 'dfrn') { @@ -330,7 +385,7 @@ function mailstream_subject(array $item): string return DI::l10n()->t("Diaspora post"); } if ($contact['network'] === 'face') { - $text = mailstream_decode_subject($item['body']); + $text = mailstream_decode_subject($item['body'], $item['uri-id']); // For some reason these do show up in Facebook $text = preg_replace('/\xA0$/', '', $text); $subject = (strlen($text) > 150) ? (substr($text, 0, 140) . '...') : $text; @@ -357,21 +412,20 @@ function mailstream_subject(array $item): string function mailstream_send(string $message_id, array $item, array $user): bool { if (!is_array($item)) { - Logger::error('mailstream_send item is empty', ['message_id' => $message_id]); + DI::logger()->error('item is empty', ['message_id' => $message_id]); return false; } if (!$item['visible']) { - Logger::debug('mailstream_send item not yet visible', ['item uri' => $item['uri']]); + DI::logger()->debug('item not yet visible', ['item uri' => $item['uri']]); return false; } if (!$message_id) { - Logger::error('mailstream_send no message ID supplied', ['item uri' => $item['uri'], - 'user email' => $user['email']]); + DI::logger()->error('no message ID supplied', ['item uri' => $item['uri'], 'user email' => $user['email']]); return true; } - require_once (dirname(__file__) . '/phpmailer/class.phpmailer.php'); + require_once(dirname(__file__) . '/phpmailer/class.phpmailer.php'); $item['body'] = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']); @@ -385,7 +439,7 @@ function mailstream_send(string $message_id, array $item, array $user): bool if (!$address) { $address = $user['email']; } - $mail = new PHPmailer(); + $mail = new PHPMailer(); try { $mail->XMailer = 'Friendica Mailstream Addon'; $mail->SetFrom($frommail, mailstream_sender($item)); @@ -394,6 +448,7 @@ function mailstream_send(string $message_id, array $item, array $user): bool $mail->Subject = mailstream_subject($item); if ($item['thr-parent'] != $item['uri']) { $mail->addCustomHeader('In-Reply-To: ' . mailstream_generate_id($item['thr-parent'])); + $mail->addCustomHeader('References: ' . mailstream_generate_references($item)); } $mail->addCustomHeader('X-Friendica-Mailstream-URI: ' . $item['uri']); if ($item['plink']) { @@ -414,23 +469,26 @@ function mailstream_send(string $message_id, array $item, array $user): bool $template = Renderer::getMarkupTemplate('mail.tpl', 'addon/mailstream/'); $mail->AltBody = BBCode::toPlaintext($item['body']); $item['body'] = BBCode::convertForUriId($item['uri-id'], $item['body'], BBCode::CONNECTORS); - $item['url'] = DI::baseUrl()->get() . '/display/' . $item['guid']; + $item['url'] = DI::baseUrl() . '/display/' . $item['guid']; $mail->Body = Renderer::replaceMacros($template, [ - '$upstream' => DI::l10n()->t('Upstream'), - '$uri' => DI::l10n()->t('URI'), - '$local' => DI::l10n()->t('Local'), - '$item' => $item]); + '$upstream' => DI::l10n()->t('Upstream'), + '$uri' => DI::l10n()->t('URI'), + '$local' => DI::l10n()->t('Local'), + '$item' => $item + ]); $mail->Body = mailstream_html_wrap($mail->Body); if (!$mail->Send()) { throw new Exception($mail->ErrorInfo); } - Logger::debug('mailstream_send sent message', ['message ID' => $mail->MessageID, - 'subject' => $mail->Subject, - 'address' => $address]); + DI::logger()->debug('sent message', [ + 'message ID' => $mail->MessageID, + 'subject' => $mail->Subject, + 'address' => $address + ]); } catch (phpmailerException $e) { - Logger::debug('mailstream_send PHPMailer exception sending message ' . $message_id . ': ' . $e->errorMessage()); + DI::logger()->debug('PHPMailer exception sending message', ['id' => $message_id, 'error' => $e->errorMessage()]); } catch (Exception $e) { - Logger::debug('mailstream_send exception sending message ' . $message_id . ': ' . $e->getMessage()); + DI::logger()->debug('exception sending message', ['id' => $message_id, 'error' => $e->getMessage()]); } return true; @@ -454,37 +512,13 @@ function mailstream_html_wrap(string &$text) return $text; } -/** - * Convert v1 mailstream table entries to v2 workerqueue items - */ -function mailstream_convert_table_entries() -{ - $ms_item_ids = DBA::selectToArray('mailstream_item', [], ['message-id', 'uri', 'uid', 'contact-id'], ["`mailstream_item`.`completed` IS NULL"]); - Logger::debug('mailstream_convert_table_entries processing ' . count($ms_item_ids) . ' items'); - foreach ($ms_item_ids as $ms_item_id) { - $send_hook_data = array('uid' => $ms_item_id['uid'], - 'contact-id' => $ms_item_id['contact-id'], - 'uri' => $ms_item_id['uri'], - 'message_id' => $ms_item_id['message-id'], - 'tries' => 0); - if (!$ms_item_id['message-id'] || !strlen($ms_item_id['message-id'])) { - Logger::info('mailstream_convert_table_entries: item has no message-id.', 'item' => $ms_item_id['id'], 'uri' => $ms_item_id['uri']]); - continue; - } - Logger::info('mailstream_convert_table_entries: convert item to workerqueue', $send_hook_data); - Hook::fork(Worker::PRIORITY_LOW, 'mailstream_send_hook', $send_hook_data); - } - DBA::e('DROP TABLE `mailstream_item`'); -} - /** * Form for configuring mailstream features for a user * - * @param App $a App object * @param array $data Hook data array * @throws \Friendica\Network\HTTPException\ServiceUnavailableException */ -function mailstream_addon_settings(App &$a, array &$data) +function mailstream_addon_settings(array &$data) { $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'enabled'); $address = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'address'); @@ -528,11 +562,10 @@ function mailstream_addon_settings(App &$a, array &$data) /** * Process data submitted to user's mailstream features form - * @param App $a * @param array $post POST data * @return void */ -function mailstream_addon_settings_post(App $a, array $post) +function mailstream_addon_settings_post(array $post) { if (!DI::userSession()->getLocalUserId() || empty($post['mailstream-submit'])) { return; diff --git a/mailstream/phpmailer/class.phpmailer.php b/mailstream/phpmailer/class.phpmailer.php index ab7fe030..8cd05a2c 100644 --- a/mailstream/phpmailer/class.phpmailer.php +++ b/mailstream/phpmailer/class.phpmailer.php @@ -2690,10 +2690,10 @@ class PHPMailer if (!is_readable($path)) { throw new phpmailerException($this->lang('file_open') . $path, self::STOP_CONTINUE); } - $magic_quotes = get_magic_quotes_runtime(); + $magic_quotes = false; if ($magic_quotes) { if (version_compare(PHP_VERSION, '5.3.0', '<')) { - set_magic_quotes_runtime(false); + //set_magic_quotes_runtime(false); } else { //Doesn't exist in PHP 5.4, but we don't need to check because //get_magic_quotes_runtime always returns false in 5.4+ @@ -2705,7 +2705,7 @@ class PHPMailer $file_buffer = $this->encodeString($file_buffer, $encoding); if ($magic_quotes) { if (version_compare(PHP_VERSION, '5.3.0', '<')) { - set_magic_quotes_runtime($magic_quotes); + //set_magic_quotes_runtime($magic_quotes); } else { ini_set('magic_quotes_runtime', $magic_quotes); } @@ -3286,7 +3286,7 @@ class PHPMailer $result = 'localhost.localdomain'; if (!empty($this->Hostname)) { $result = $this->Hostname; - } elseif (isset($_SERVER) and array_key_exists('SERVER_NAME', $_SERVER) and !empty($_SERVER['SERVER_NAME'])) { + } elseif (!empty($_SERVER['SERVER_NAME'])) { $result = $_SERVER['SERVER_NAME']; } elseif (function_exists('gethostname') && gethostname() !== false) { $result = gethostname(); diff --git a/markdown/lang/da-dk/messages.po b/markdown/lang/da-dk/messages.po new file mode 100644 index 00000000..51359983 --- /dev/null +++ b/markdown/lang/da-dk/messages.po @@ -0,0 +1,36 @@ +# ADDON markdown +# Copyright (C) +# This file is distributed under the same license as the Friendica markdown addon package. +# +# +# Translators: +# Jesper Stocholm, 2025 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:15-0500\n" +"PO-Revision-Date: 2019-12-27 06:41+0000\n" +"Last-Translator: Jesper Stocholm, 2025\n" +"Language-Team: Danish (Denmark) (https://app.transifex.com/Friendica/teams/12172/da_DK/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: da_DK\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: markdown.php:30 +msgid "Enable Markdown parsing" +msgstr "Aktivér Markdown-understøttelse" + +#: markdown.php:30 +msgid "If enabled, adds Markdown support to the Compose Post form." +msgstr "" +"Hvis aktiveret, tilføjes understøttelse for Markdown ved redigering af " +"opslag." + +#: markdown.php:35 +msgid "Markdown Settings" +msgstr "Markdown-indstillinger" diff --git a/markdown/lang/da-dk/strings.php b/markdown/lang/da-dk/strings.php new file mode 100644 index 00000000..468ac5f8 --- /dev/null +++ b/markdown/lang/da-dk/strings.php @@ -0,0 +1,10 @@ +strings['Enable Markdown parsing'] = 'Aktivér Markdown-understøttelse'; +$a->strings['If enabled, adds Markdown support to the Compose Post form.'] = 'Hvis aktiveret, tilføjes understøttelse for Markdown ved redigering af opslag.'; +$a->strings['Markdown Settings'] = 'Markdown-indstillinger'; diff --git a/markdown/markdown.php b/markdown/markdown.php index 236fb297..1ef6cd9a 100644 --- a/markdown/markdown.php +++ b/markdown/markdown.php @@ -5,7 +5,6 @@ * Version: 0.1 * Author: Michael Vogel */ -use Friendica\App; use Friendica\Core\Hook; use Friendica\Content\Text\Markdown; use Friendica\Core\Renderer; @@ -27,7 +26,7 @@ function markdown_addon_settings(array &$data) $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/markdown/'); $html = Renderer::replaceMacros($t, [ - '$enabled' => ['enabled', DI::l10n()->t('Enable Markdown parsing'), $enabled, DI::l10n()->t('If enabled, adds Markdown support to the Compose Post form.')], + '$enabled' => ['markdown-enabled', DI::l10n()->t('Enable Markdown parsing'), $enabled, DI::l10n()->t('If enabled, adds Markdown support to the Compose Post form.')], ]); $data = [ @@ -43,7 +42,7 @@ function markdown_addon_settings_post(array &$b) return; } - DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'markdown', 'enabled', intval($_POST['enabled'])); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'markdown', 'enabled', intval($_POST['markdown-enabled'])); } function markdown_post_local_start(&$request) { @@ -64,6 +63,7 @@ function markdown_post_local_start(&$request) { // (right chevrons are used for quoting in Markdown) // See https://github.com/friendica/friendica/issues/10634 $text = strtr($text, ['<' => '<']); + $text = str_replace('[*]', '[li]', $text); return Markdown::toBBCode($text); }); diff --git a/mastodoncustomemojis/mastodoncustomemojis.php b/mastodoncustomemojis/mastodoncustomemojis.php index c84f1a4f..fcb8feea 100644 --- a/mastodoncustomemojis/mastodoncustomemojis.php +++ b/mastodoncustomemojis/mastodoncustomemojis.php @@ -1,5 +1,4 @@ fetchFull($api_url); + $fetchResult = DI::httpClient()->get($api_url); if ($fetchResult->isSuccess()) { - $emojis_array = json_decode($fetchResult->getBody(), true); + $emojis_array = json_decode($fetchResult->getBodyString(), true); if (is_array($emojis_array) && count($emojis_array)) { foreach ($emojis_array as $emoji) { if (!empty($emoji['shortcode']) && !empty($emoji['static_url'])) { $return['texts'][] = ':' . $emoji['shortcode'] . ':'; - $return['icons'][] = ':' . $emoji['shortcode'] . ':'; + $return['icons'][] = ':' . $emoji['shortcode'] . ':'; } } } diff --git a/mathjax/lang/bg/messages.po b/mathjax/lang/bg/messages.po new file mode 100644 index 00000000..0693f595 --- /dev/null +++ b/mathjax/lang/bg/messages.po @@ -0,0 +1,30 @@ +# ADDON mathjax +# Copyright (C) +# This file is distributed under the same license as the Friendica mathjax addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:15-0500\n" +"PO-Revision-Date: 2014-06-23 09:55+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: mathjax.php:42 +msgid "" +"The MathJax addon renders mathematical formulae written using the LaTeX " +"syntax surrounded by the usual $$ or an eqnarray block in the postings of " +"your wall,network tab and private mail." +msgstr "" + +#: mathjax.php:43 +msgid "Use the MathJax renderer" +msgstr "" diff --git a/mathjax/lang/bg/strings.php b/mathjax/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/mathjax/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: mathjax.php:42 +msgid "" +"The MathJax addon renders mathematical formulae written using the LaTeX " +"syntax surrounded by the usual $$ or an eqnarray block in the postings of " +"your wall,network tab and private mail." +msgstr "" + +#: mathjax.php:43 +msgid "Use the MathJax renderer" +msgstr "" diff --git a/mathjax/lang/ca/strings.php b/mathjax/lang/ca/strings.php index a66618a1..d34874f6 100644 --- a/mathjax/lang/ca/strings.php +++ b/mathjax/lang/ca/strings.php @@ -1,9 +1,7 @@ -strings["Settings"] = "Ajustos"; -$a->strings["The MathJax addon renders mathematical formulae written using the LaTeX syntax surrounded by the usual $$ or an eqnarray block in the postings of your wall,network tab and private mail."] = "El complement MathJax processa les fórmules matemàtiques escrites utilitzant la sintaxi de LaTeX, envoltades per l'habitual $$ o un bloc de \"eqnarray\" en les publicacions del seu mur, a la fitxa de la xarxa i correu privat."; -$a->strings["Use the MathJax renderer"] = "Utilitzar el processador Mathjax"; -$a->strings["Submit"] = "Enviar"; -$a->strings["Settings updated."] = "Ajustos actualitzats."; -$a->strings["MathJax Base URL"] = "URL Base de Mathjax"; -$a->strings["The URL for the javascript file that should be included to use MathJax. Can be either the MathJax CDN or another installation of MathJax."] = "La URL del fitxer javascript que ha de ser inclòs per a usar Mathjax. Pot ser utilitzat per Mathjax CDN o un altre instal·lació de Mathjax."; +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: mathjax.php:42 +msgid "" +"The MathJax addon renders mathematical formulae written using the LaTeX " +"syntax surrounded by the usual $$ or an eqnarray block in the postings of " +"your wall,network tab and private mail." +msgstr "" + +#: mathjax.php:43 +msgid "Use the MathJax renderer" +msgstr "" diff --git a/mathjax/lang/eo/strings.php b/mathjax/lang/eo/strings.php index f0d88442..68e8a64c 100644 --- a/mathjax/lang/eo/strings.php +++ b/mathjax/lang/eo/strings.php @@ -1,9 +1,7 @@ -strings["Settings"] = "Agordoj"; -$a->strings["The MathJax addon renders mathematical formulae written using the LaTeX syntax surrounded by the usual $$ or an eqnarray block in the postings of your wall,network tab and private mail."] = "La Mathjax kromprogramo bildigas matematikajn formulojn skribitajn en la LaTeX sintakso, cirkaŭigita de la komuna $$ aŭ eqnarray bloko en afiŝoj ĉe via muro, Reto folio kaj privataj mesaĝoj."; -$a->strings["Use the MathJax renderer"] = "Ĉu uzi la Mathjax bildigilo"; -$a->strings["Submit"] = "Sendi"; -$a->strings["Settings updated."] = "Agordoj ĝisdatigita."; -$a->strings["MathJax Base URL"] = "Mathjax Baza URL Adreso"; -$a->strings["The URL for the javascript file that should be included to use MathJax. Can be either the MathJax CDN or another installation of MathJax."] = "La URL adreso por la javascript dosiero kiu estas inkluzivigonta por uzi Mathjaz. Eblas esti aŭ la Mathjax CDN aŭ alia Mathjax instalo."; +\n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: mathjax.php:42 +msgid "" +"The MathJax addon renders mathematical formulae written using the LaTeX " +"syntax surrounded by the usual $$ or an eqnarray block in the postings of " +"your wall,network tab and private mail." +msgstr "" + +#: mathjax.php:43 +msgid "Use the MathJax renderer" +msgstr "" diff --git a/mathjax/lang/gd/strings.php b/mathjax/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/mathjax/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/mathjax/lang/is/messages.po b/mathjax/lang/is/messages.po new file mode 100644 index 00000000..e8e75052 --- /dev/null +++ b/mathjax/lang/is/messages.po @@ -0,0 +1,30 @@ +# ADDON mathjax +# Copyright (C) +# This file is distributed under the same license as the Friendica mathjax addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:15-0500\n" +"PO-Revision-Date: 2014-06-23 09:55+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: mathjax.php:42 +msgid "" +"The MathJax addon renders mathematical formulae written using the LaTeX " +"syntax surrounded by the usual $$ or an eqnarray block in the postings of " +"your wall,network tab and private mail." +msgstr "" + +#: mathjax.php:43 +msgid "Use the MathJax renderer" +msgstr "" diff --git a/mathjax/lang/is/strings.php b/mathjax/lang/is/strings.php index a7263f30..975c341e 100644 --- a/mathjax/lang/is/strings.php +++ b/mathjax/lang/is/strings.php @@ -1,9 +1,7 @@ -strings["Settings"] = "Stillingar"; -$a->strings["The MathJax addon renders mathematical formulae written using the LaTeX syntax surrounded by the usual $$ or an eqnarray block in the postings of your wall,network tab and private mail."] = ""; -$a->strings["Use the MathJax renderer"] = ""; -$a->strings["Submit"] = "Senda inn"; -$a->strings["Settings updated."] = "Stillingar uppfærðar"; -$a->strings["MathJax Base URL"] = ""; -$a->strings["The URL for the javascript file that should be included to use MathJax. Can be either the MathJax CDN or another installation of MathJax."] = ""; +\n" +"Language-Team: Russian (http://app.transifex.com/Friendica/friendica/language/ru/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ru\n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" + +#: mathjax.php:42 +msgid "" +"The MathJax addon renders mathematical formulae written using the LaTeX " +"syntax surrounded by the usual $$ or an eqnarray block in the postings of " +"your wall,network tab and private mail." +msgstr "" + +#: mathjax.php:43 +msgid "Use the MathJax renderer" +msgstr "" diff --git a/mathjax/lang/ru/strings.php b/mathjax/lang/ru/strings.php index f0c2f4a1..0579fc21 100644 --- a/mathjax/lang/ru/strings.php +++ b/mathjax/lang/ru/strings.php @@ -1,9 +1,7 @@ -strings["Settings"] = "Настройки"; -$a->strings["The MathJax addon renders mathematical formulae written using the LaTeX syntax surrounded by the usual $$ or an eqnarray block in the postings of your wall,network tab and private mail."] = ""; -$a->strings["Use the MathJax renderer"] = ""; -$a->strings["Submit"] = "Подтвердить"; -$a->strings["Settings updated."] = "Настройки обновлены."; -$a->strings["MathJax Base URL"] = ""; -$a->strings["The URL for the javascript file that should be included to use MathJax. Can be either the MathJax CDN or another installation of MathJax."] = ""; +=2 && $n%10<=4 && ($n%100<12 || $n%100>14)) { return 1; } else if ($n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)) { return 2; } else { return 3; } +}} diff --git a/mathjax/mathjax.php b/mathjax/mathjax.php index d0046cf7..e96aaddf 100644 --- a/mathjax/mathjax.php +++ b/mathjax/mathjax.php @@ -8,7 +8,6 @@ * License: 3-clause BSD license */ -use Friendica\App; use Friendica\Core\Hook; use Friendica\Core\Renderer; use Friendica\DI; diff --git a/membersince/membersince.php b/membersince/membersince.php index f8128eb7..df6388c6 100644 --- a/membersince/membersince.php +++ b/membersince/membersince.php @@ -7,9 +7,9 @@ * Status: Unsupported */ -use Friendica\App; use Friendica\Core\Hook; use Friendica\DI; +use Friendica\Model\User; use Friendica\Util\DateTimeFormat; function membersince_install() @@ -17,9 +17,25 @@ function membersince_install() Hook::register('profile_advanced', 'addon/membersince/membersince.php', 'membersince_display'); } -function membersince_display(array &$b) +/** + * @param array|string|null $b + * @return void + */ +function membersince_display(&$b) { - if (DI::app()->getCurrentTheme() == 'frio') { + $uid = DI::userSession()->getLocalUserId(); + + if ($uid === false) { + return; + } + + $user = User::getById($uid, ['register_date']); + + if ($user === false || !array_key_exists('register_date', $user)) { + return; + } + + if (DI::appHelper()->getCurrentTheme() == 'frio') { // Works in Frio. $doc = new DOMDocument(); $doc->loadHTML(mb_convert_encoding($b, 'HTML-ENTITIES', 'UTF-8')); @@ -39,7 +55,7 @@ function membersince_display(array &$b) $label->setAttribute('class', 'col-lg-4 col-md-4 col-sm-4 col-xs-12 profile-label-name text-muted'); // The div for the register date of the profile owner. - $entry = $doc->createElement('div', DateTimeFormat::local(DI::app()->profile['register_date'])); + $entry = $doc->createElement('div', DateTimeFormat::local($user['register_date'])); $entry->setAttribute('class', 'col-lg-8 col-md-8 col-sm-8 col-xs-12 profile-entry'); $div->appendChild($hr); @@ -47,9 +63,9 @@ function membersince_display(array &$b) $div->appendChild($entry); $elm->parentNode->insertBefore($div, $elm->nextSibling); - $b = $doc->saveHTML(); + $b = (string) $doc->saveHTML(); } else { // Works in Vier. - $b = preg_replace('/<\/dl>/', "\n\n\n
\n
" . DI::l10n()->t('Member since:') . "
\n
" . DateTimeFormat::local(DI::app()->profile['register_date']) . "
\n
", $b, 1); + $b = preg_replace('/<\/dl>/', "\n\n\n
\n
" . DI::l10n()->t('Member since:') . "
\n
" . DateTimeFormat::local($user['register_date']) . "
\n
", $b, 1); } } diff --git a/monolog/README.md b/monolog/README.md new file mode 100644 index 00000000..efb7959a --- /dev/null +++ b/monolog/README.md @@ -0,0 +1,4 @@ +# Monolog Addon + +A Logging framework with lots of additions (see [Monolog](https://github.com/Seldaek/monolog/)). +There are just Friendica additions inside the src directory. diff --git a/monolog/composer.json b/monolog/composer.json index 9c7f32c3..9cf42dbe 100644 --- a/monolog/composer.json +++ b/monolog/composer.json @@ -1,23 +1,26 @@ { - "name": "friendica-addons/monolog", - "description": "Monolog can send your logs to files, sockets, inboxes, database, etc..", - "type": "friendica-addon", - "authors": [ - { - "name": "Philipp Holzer", - "email": "admin@philipp.info", - "homepage": "https://blog.philipp.info", - "role": "Developer" - } - ], - "require": { - "php": ">=7.0", - "monolog/monolog": "^3.2" - }, - "license": "3-clause BSD license", - "config": { - "optimize-autoloader": true, - "autoloader-suffix": "MonologAddon", - "preferred-install": "dist" - } + "name": "friendica-addons/monolog", + "description": "Monolog can send your logs to files, sockets, inboxes, database, etc..", + "type": "friendica-addon", + "authors": [ + { + "name": "Philipp Holzer", + "email": "admin@philipp.info", + "homepage": "https://blog.philipp.info", + "role": "Developer" + } + ], + "require": { + "php": ">=7.3", + "monolog/monolog": "^2.9" + }, + "license": "3-clause BSD license", + "config": { + "platform": { + "php": "7.4" + }, + "optimize-autoloader": true, + "autoloader-suffix": "MonologAddon", + "preferred-install": "dist" + } } diff --git a/monolog/composer.lock b/monolog/composer.lock index 0566f721..5d1da32f 100644 --- a/monolog/composer.lock +++ b/monolog/composer.lock @@ -4,45 +4,46 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e812bcd051a73d1c9b19c91ec88a6a21", + "content-hash": "037f2db47e77c9af2960dde65ebafa8d", "packages": [ { "name": "monolog/monolog", - "version": "3.2.0", + "version": "2.9.2", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "305444bc6fb6c89e490f4b34fa6e979584d7fa81" + "reference": "437cb3628f4cf6042cc10ae97fc2b8472e48ca1f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/305444bc6fb6c89e490f4b34fa6e979584d7fa81", - "reference": "305444bc6fb6c89e490f4b34fa6e979584d7fa81", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/437cb3628f4cf6042cc10ae97fc2b8472e48ca1f", + "reference": "437cb3628f4cf6042cc10ae97fc2b8472e48ca1f", "shasum": "" }, "require": { - "php": ">=8.1", - "psr/log": "^2.0 || ^3.0" + "php": ">=7.2", + "psr/log": "^1.0.1 || ^2.0 || ^3.0" }, "provide": { - "psr/log-implementation": "3.0.0" + "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" }, "require-dev": { - "aws/aws-sdk-php": "^3.0", + "aws/aws-sdk-php": "^2.4.9 || ^3.0", "doctrine/couchdb": "~1.0@dev", "elasticsearch/elasticsearch": "^7 || ^8", "ext-json": "*", - "graylog2/gelf-php": "^1.4.2", + "graylog2/gelf-php": "^1.4.2 || ^2@dev", "guzzlehttp/guzzle": "^7.4", "guzzlehttp/psr7": "^2.2", "mongodb/mongodb": "^1.8", "php-amqplib/php-amqplib": "~2.4 || ^3", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-strict-rules": "^1.1", - "phpunit/phpunit": "^9.5.16", - "predis/predis": "^1.1", + "phpspec/prophecy": "^1.15", + "phpstan/phpstan": "^0.12.91", + "phpunit/phpunit": "^8.5.14", + "predis/predis": "^1.1 || ^2.0", + "rollbar/rollbar": "^1.3 || ^2 || ^3", "ruflin/elastica": "^7", + "swiftmailer/swiftmailer": "^5.3|^6.0", "symfony/mailer": "^5.4 || ^6", "symfony/mime": "^5.4 || ^6" }, @@ -65,7 +66,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "3.x-dev" + "dev-main": "2.x-dev" } }, "autoload": { @@ -101,34 +102,34 @@ "type": "tidelift" } ], - "time": "2022-07-24T12:00:55+00:00" + "time": "2023-10-27T15:25:26+00:00" }, { "name": "psr/log", - "version": "3.0.0", + "version": "1.1.4", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, "require": { - "php": ">=8.0.0" + "php": ">=5.3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.x-dev" + "dev-master": "1.1.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "src" + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", @@ -148,7 +149,7 @@ "psr", "psr-3" ], - "time": "2021-07-14T16:46:02+00:00" + "time": "2021-05-03T11:20:27+00:00" } ], "packages-dev": [], @@ -158,8 +159,11 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.0" + "php": ">=7.3" }, "platform-dev": [], + "platform-overrides": { + "php": "7.4" + }, "plugin-api-version": "1.1.0" } diff --git a/monolog/monolog.php b/monolog/monolog.php index efdcb3fe..f194aac4 100644 --- a/monolog/monolog.php +++ b/monolog/monolog.php @@ -1,66 +1,7 @@ setTimezone($loggerTimeZone); - $logger->pushProcessor(new Monolog\Processor\PsrLogMessageProcessor()); - $logger->pushProcessor(new Monolog\Processor\ProcessIdProcessor()); - $logger->pushProcessor(new Monolog\Processor\UidProcessor()); - $logger->pushProcessor(new IntrospectionProcessor($data['introspection'], LogLevel::DEBUG)); - - $stream = DI::config()->get('system', 'logfile'); - - // just add a stream in case it's either writable or not file - if (!is_file($stream) || is_writable($stream)) { - try { - $loglevel = Monolog\Logger::toMonologLevel($data['loglevel']); - - // fallback to notice if an invalid loglevel is set - if (!is_int($loglevel)) { - $loglevel = LogLevel::NOTICE; - } - - $fileHandler = new Monolog\Handler\StreamHandler($stream, $loglevel); - - $formatter = new Monolog\Formatter\LineFormatter("%datetime% %channel% [%level_name%]: %message% %context% %extra%\n"); - $fileHandler->setFormatter($formatter); - - $logger->pushHandler($fileHandler); - } catch (\Throwable $e) { - return; - } - } - - $data['storage'] = $logger; -} diff --git a/monolog/src/Factory/MonologFactory.php b/monolog/src/Factory/MonologFactory.php new file mode 100644 index 00000000..e0c11e13 --- /dev/null +++ b/monolog/src/Factory/MonologFactory.php @@ -0,0 +1,72 @@ +introspection = $introspection; + $this->config = $config; + } + + /** + * Creates and returns a PSR-3 Logger instance. + * + * Calling this method multiple times with the same parameters SHOULD return the same object. + * + * @param \Psr\Log\LogLevel::* $logLevel The log level + * @param \Friendica\Core\Logger\Capability\LogChannel::* $logChannel The log channel + */ + public function createLogger(string $logLevel, string $logChannel): LoggerInterface + { + $loggerTimeZone = new \DateTimeZone('UTC'); + + $logger = new Logger($logChannel); + $logger->setTimezone($loggerTimeZone); + $logger->pushProcessor(new PsrLogMessageProcessor()); + $logger->pushProcessor(new ProcessIdProcessor()); + $logger->pushProcessor(new UidProcessor()); + $logger->pushProcessor(new IntrospectionProcessor($this->introspection, LogLevel::DEBUG)); + + $logfile = $this->config->get('system', 'logfile'); + + // just add a stream in case it's either writable or not file + if (is_writable($logfile)) { + $logLevel = Logger::toMonologLevel($logLevel); + + // fallback to notice if an invalid loglevel is set + if (!is_int($logLevel)) { + $logLevel = LogLevel::NOTICE; + } + + $fileHandler = new StreamHandler($logfile, $logLevel); + + $formatter = new LineFormatter("%datetime% %channel% [%level_name%]: %message% %context% %extra%\n"); + $fileHandler->setFormatter($formatter); + + $logger->pushHandler($fileHandler); + } + + return $logger; + } +} diff --git a/monolog/src/DevelopHandler.php b/monolog/src/Monolog/DevelopHandler.php similarity index 98% rename from monolog/src/DevelopHandler.php rename to monolog/src/Monolog/DevelopHandler.php index e3d31e64..735ebac7 100644 --- a/monolog/src/DevelopHandler.php +++ b/monolog/src/Monolog/DevelopHandler.php @@ -19,7 +19,7 @@ * */ -namespace Friendica\Addon\monolog\src; +namespace Friendica\Addon\monolog\src\Monolog; use Friendica\App\Request; use Monolog\Handler; diff --git a/monolog/src/IntrospectionProcessor.php b/monolog/src/Monolog/IntrospectionProcessor.php similarity index 86% rename from monolog/src/IntrospectionProcessor.php rename to monolog/src/Monolog/IntrospectionProcessor.php index 8ba6023e..2df0e21a 100644 --- a/monolog/src/IntrospectionProcessor.php +++ b/monolog/src/Monolog/IntrospectionProcessor.php @@ -19,11 +19,10 @@ * */ -namespace Friendica\Addon\monolog\src; +namespace Friendica\Addon\monolog\src\Monolog; use Friendica\Core\Logger\Util\Introspection; use Monolog\Logger; -use Monolog\LogRecord; use Monolog\Processor\ProcessorInterface; /** @@ -42,19 +41,19 @@ class IntrospectionProcessor implements ProcessorInterface public function __construct(Introspection $introspection, $level = Logger::DEBUG) { $this->level = Logger::toMonologLevel($level); - $introspection->addClasses(['Monolog\\']); + $introspection->addClasses(['Monolog\\', static::class]); $this->introspection = $introspection; } - public function __invoke(LogRecord $record): LogRecord + public function __invoke(array $record): array { // return if the level is not high enough - if ($record->level < $this->level) { + if ($record['level'] < $this->level) { return $record; } // we should have the call source now - $record->extra = array_merge( - $record->extra, + $record['extra'] = array_merge( + $record['extra'], $this->introspection->getRecord() ); diff --git a/advancedcontentfilter/src/routes.php b/monolog/static/dependencies.config.php similarity index 52% rename from advancedcontentfilter/src/routes.php rename to monolog/static/dependencies.config.php index 09077bda..f992d69c 100644 --- a/advancedcontentfilter/src/routes.php +++ b/monolog/static/dependencies.config.php @@ -1,6 +1,6 @@ group('/advancedcontentfilter/api', function () { - /* @var $this Slim\App */ - $this->group('/rules', function () { - /* @var $this Slim\App */ - $this->get('', 'advancedcontentfilter_get_rules'); - $this->post('', 'advancedcontentfilter_post_rules'); - - $this->get('/{id}', 'advancedcontentfilter_get_rules_id'); - $this->put('/{id}', 'advancedcontentfilter_put_rules_id'); - $this->delete('/{id}', 'advancedcontentfilter_delete_rules_id'); - }); - - $this->group('/variables', function () { - /* @var $this Slim\App */ - $this->get('/{guid}', 'advancedcontentfilter_get_variables_guid'); - }); -}); +return [ + \Friendica\Core\Logger\Factory\LoggerFactory::class => [ + 'instanceOf' => \Friendica\Addon\monolog\src\Factory\MonologFactory::class, + 'call' => null, + ], +]; diff --git a/monolog/vendor/composer/autoload_classmap.php b/monolog/vendor/composer/autoload_classmap.php index 70609203..c12d7340 100644 --- a/monolog/vendor/composer/autoload_classmap.php +++ b/monolog/vendor/composer/autoload_classmap.php @@ -26,7 +26,6 @@ return array( 'Monolog\\Formatter\\MongoDBFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php', 'Monolog\\Formatter\\NormalizerFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php', 'Monolog\\Formatter\\ScalarFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php', - 'Monolog\\Formatter\\SyslogFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/SyslogFormatter.php', 'Monolog\\Formatter\\WildfireFormatter' => $vendorDir . '/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php', 'Monolog\\Handler\\AbstractHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/AbstractHandler.php', 'Monolog\\Handler\\AbstractProcessingHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php', @@ -92,6 +91,7 @@ return array( 'Monolog\\Handler\\SocketHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SocketHandler.php', 'Monolog\\Handler\\SqsHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SqsHandler.php', 'Monolog\\Handler\\StreamHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/StreamHandler.php', + 'Monolog\\Handler\\SwiftMailerHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php', 'Monolog\\Handler\\SymfonyMailerHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SymfonyMailerHandler.php', 'Monolog\\Handler\\SyslogHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SyslogHandler.php', 'Monolog\\Handler\\SyslogUdpHandler' => $vendorDir . '/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php', @@ -121,12 +121,4 @@ return array( 'Monolog\\SignalHandler' => $vendorDir . '/monolog/monolog/src/Monolog/SignalHandler.php', 'Monolog\\Test\\TestCase' => $vendorDir . '/monolog/monolog/src/Monolog/Test/TestCase.php', 'Monolog\\Utils' => $vendorDir . '/monolog/monolog/src/Monolog/Utils.php', - 'Psr\\Log\\AbstractLogger' => $vendorDir . '/psr/log/src/AbstractLogger.php', - 'Psr\\Log\\InvalidArgumentException' => $vendorDir . '/psr/log/src/InvalidArgumentException.php', - 'Psr\\Log\\LogLevel' => $vendorDir . '/psr/log/src/LogLevel.php', - 'Psr\\Log\\LoggerAwareInterface' => $vendorDir . '/psr/log/src/LoggerAwareInterface.php', - 'Psr\\Log\\LoggerAwareTrait' => $vendorDir . '/psr/log/src/LoggerAwareTrait.php', - 'Psr\\Log\\LoggerInterface' => $vendorDir . '/psr/log/src/LoggerInterface.php', - 'Psr\\Log\\LoggerTrait' => $vendorDir . '/psr/log/src/LoggerTrait.php', - 'Psr\\Log\\NullLogger' => $vendorDir . '/psr/log/src/NullLogger.php', ); diff --git a/monolog/vendor/composer/autoload_psr4.php b/monolog/vendor/composer/autoload_psr4.php index afcfb31e..9cb5b63d 100644 --- a/monolog/vendor/composer/autoload_psr4.php +++ b/monolog/vendor/composer/autoload_psr4.php @@ -6,6 +6,6 @@ $vendorDir = dirname(dirname(__FILE__)); $baseDir = dirname($vendorDir); return array( - 'Psr\\Log\\' => array($vendorDir . '/psr/log/src'), + 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), 'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'), ); diff --git a/monolog/vendor/composer/autoload_static.php b/monolog/vendor/composer/autoload_static.php index 85bd86fd..a44984ec 100644 --- a/monolog/vendor/composer/autoload_static.php +++ b/monolog/vendor/composer/autoload_static.php @@ -20,7 +20,7 @@ class ComposerStaticInitMonologAddon public static $prefixDirsPsr4 = array ( 'Psr\\Log\\' => array ( - 0 => __DIR__ . '/..' . '/psr/log/src', + 0 => __DIR__ . '/..' . '/psr/log/Psr/Log', ), 'Monolog\\' => array ( @@ -49,7 +49,6 @@ class ComposerStaticInitMonologAddon 'Monolog\\Formatter\\MongoDBFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php', 'Monolog\\Formatter\\NormalizerFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php', 'Monolog\\Formatter\\ScalarFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php', - 'Monolog\\Formatter\\SyslogFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/SyslogFormatter.php', 'Monolog\\Formatter\\WildfireFormatter' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php', 'Monolog\\Handler\\AbstractHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/AbstractHandler.php', 'Monolog\\Handler\\AbstractProcessingHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php', @@ -115,6 +114,7 @@ class ComposerStaticInitMonologAddon 'Monolog\\Handler\\SocketHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SocketHandler.php', 'Monolog\\Handler\\SqsHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SqsHandler.php', 'Monolog\\Handler\\StreamHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/StreamHandler.php', + 'Monolog\\Handler\\SwiftMailerHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php', 'Monolog\\Handler\\SymfonyMailerHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SymfonyMailerHandler.php', 'Monolog\\Handler\\SyslogHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SyslogHandler.php', 'Monolog\\Handler\\SyslogUdpHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php', @@ -144,14 +144,6 @@ class ComposerStaticInitMonologAddon 'Monolog\\SignalHandler' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/SignalHandler.php', 'Monolog\\Test\\TestCase' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Test/TestCase.php', 'Monolog\\Utils' => __DIR__ . '/..' . '/monolog/monolog/src/Monolog/Utils.php', - 'Psr\\Log\\AbstractLogger' => __DIR__ . '/..' . '/psr/log/src/AbstractLogger.php', - 'Psr\\Log\\InvalidArgumentException' => __DIR__ . '/..' . '/psr/log/src/InvalidArgumentException.php', - 'Psr\\Log\\LogLevel' => __DIR__ . '/..' . '/psr/log/src/LogLevel.php', - 'Psr\\Log\\LoggerAwareInterface' => __DIR__ . '/..' . '/psr/log/src/LoggerAwareInterface.php', - 'Psr\\Log\\LoggerAwareTrait' => __DIR__ . '/..' . '/psr/log/src/LoggerAwareTrait.php', - 'Psr\\Log\\LoggerInterface' => __DIR__ . '/..' . '/psr/log/src/LoggerInterface.php', - 'Psr\\Log\\LoggerTrait' => __DIR__ . '/..' . '/psr/log/src/LoggerTrait.php', - 'Psr\\Log\\NullLogger' => __DIR__ . '/..' . '/psr/log/src/NullLogger.php', ); public static function getInitializer(ClassLoader $loader) diff --git a/monolog/vendor/composer/installed.json b/monolog/vendor/composer/installed.json index c01706ed..2b129417 100644 --- a/monolog/vendor/composer/installed.json +++ b/monolog/vendor/composer/installed.json @@ -1,42 +1,43 @@ [ { "name": "monolog/monolog", - "version": "3.2.0", - "version_normalized": "3.2.0.0", + "version": "2.9.2", + "version_normalized": "2.9.2.0", "source": { "type": "git", "url": "https://github.com/Seldaek/monolog.git", - "reference": "305444bc6fb6c89e490f4b34fa6e979584d7fa81" + "reference": "437cb3628f4cf6042cc10ae97fc2b8472e48ca1f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/monolog/zipball/305444bc6fb6c89e490f4b34fa6e979584d7fa81", - "reference": "305444bc6fb6c89e490f4b34fa6e979584d7fa81", + "url": "https://api.github.com/repos/Seldaek/monolog/zipball/437cb3628f4cf6042cc10ae97fc2b8472e48ca1f", + "reference": "437cb3628f4cf6042cc10ae97fc2b8472e48ca1f", "shasum": "" }, "require": { - "php": ">=8.1", - "psr/log": "^2.0 || ^3.0" + "php": ">=7.2", + "psr/log": "^1.0.1 || ^2.0 || ^3.0" }, "provide": { - "psr/log-implementation": "3.0.0" + "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" }, "require-dev": { - "aws/aws-sdk-php": "^3.0", + "aws/aws-sdk-php": "^2.4.9 || ^3.0", "doctrine/couchdb": "~1.0@dev", "elasticsearch/elasticsearch": "^7 || ^8", "ext-json": "*", - "graylog2/gelf-php": "^1.4.2", + "graylog2/gelf-php": "^1.4.2 || ^2@dev", "guzzlehttp/guzzle": "^7.4", "guzzlehttp/psr7": "^2.2", "mongodb/mongodb": "^1.8", "php-amqplib/php-amqplib": "~2.4 || ^3", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-strict-rules": "^1.1", - "phpunit/phpunit": "^9.5.16", - "predis/predis": "^1.1", + "phpspec/prophecy": "^1.15", + "phpstan/phpstan": "^0.12.91", + "phpunit/phpunit": "^8.5.14", + "predis/predis": "^1.1 || ^2.0", + "rollbar/rollbar": "^1.3 || ^2 || ^3", "ruflin/elastica": "^7", + "swiftmailer/swiftmailer": "^5.3|^6.0", "symfony/mailer": "^5.4 || ^6", "symfony/mime": "^5.4 || ^6" }, @@ -56,11 +57,11 @@ "rollbar/rollbar": "Allow sending log messages to Rollbar", "ruflin/elastica": "Allow sending log messages to an Elastic Search server" }, - "time": "2022-07-24T12:00:55+00:00", + "time": "2023-10-27T15:25:26+00:00", "type": "library", "extra": { "branch-alias": { - "dev-main": "3.x-dev" + "dev-main": "2.x-dev" } }, "installation-source": "dist", @@ -100,33 +101,33 @@ }, { "name": "psr/log", - "version": "3.0.0", - "version_normalized": "3.0.0.0", + "version": "1.1.4", + "version_normalized": "1.1.4.0", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + "reference": "d49695b909c3b7628b6289db5479a1c204601f11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", + "reference": "d49695b909c3b7628b6289db5479a1c204601f11", "shasum": "" }, "require": { - "php": ">=8.0.0" + "php": ">=5.3.0" }, - "time": "2021-07-14T16:46:02+00:00", + "time": "2021-05-03T11:20:27+00:00", "type": "library", "extra": { "branch-alias": { - "dev-master": "3.x-dev" + "dev-master": "1.1.x-dev" } }, "installation-source": "dist", "autoload": { "psr-4": { - "Psr\\Log\\": "src" + "Psr\\Log\\": "Psr/Log/" } }, "notification-url": "https://packagist.org/downloads/", diff --git a/monolog/vendor/monolog/monolog/CHANGELOG.md b/monolog/vendor/monolog/monolog/CHANGELOG.md index fa0acea3..aca1bdd0 100644 --- a/monolog/vendor/monolog/monolog/CHANGELOG.md +++ b/monolog/vendor/monolog/monolog/CHANGELOG.md @@ -1,70 +1,23 @@ -### 3.2.0 (2022-07-24) +### 2.9.2 (2023-10-27) - * Deprecated `CubeHandler` and `PHPConsoleHandler` as both projects are abandoned and those should not be used anymore (#1734) - * Marked `Logger` `@final` as it should not be extended, prefer composition or talk to us if you are missing something - * Added RFC 5424 level (`7` to `0`) support to `Logger::log` and `Logger::addRecord` to increase interoperability (#1723) - * Added `SyslogFormatter` to output syslog-like files which can be consumed by tools like [lnav](https://lnav.org/) (#1689) - * Added support for `__toString` for objects which are not json serializable in `JsonFormatter` (#1733) - * Added `GoogleCloudLoggingFormatter` (#1719) - * Added support for Predis 2.x (#1732) - * Added `AmqpHandler->setExtraAttributes` to allow configuring attributes when using an AMQPExchange (#1724) - * Fixed serialization/unserialization of handlers to make sure private properties are included (#1727) - * Fixed allowInlineLineBreaks in LineFormatter causing issues with windows paths containing `\n` or `\r` sequences (#1720) - * Fixed max normalization depth not being taken into account when formatting exceptions with a deep chain of previous exceptions (#1726) - * Fixed PHP 8.2 deprecation warnings (#1722) - * Fixed rare race condition or filesystem issue where StreamHandler is unable to create the directory the log should go into yet it exists already (#1678) + * Fixed display_errors parsing in ErrorHandler which did not support string values (#1804) + * Fixed bug where the previous error handler would not be restored in some cases where StreamHandler fails (#1815) + * Fixed normalization error when normalizing incomplete classes (#1833) -### 3.1.0 (2022-06-09) +### 2.9.1 (2023-02-06) - * Added `$datetime` parameter to `Logger::addRecord` as low level API to allow logging into the past or future (#1682) - * Added `Logger::useLoggingLoopDetection` to allow disabling cyclic logging detection in concurrent frameworks (#1681) - * Fixed handling of fatal errors if callPrevious is disabled in ErrorHandler (#1670) - * Fixed interop issue by removing the need for a return type in ProcessorInterface (#1680) - * Marked the reusable `Monolog\Test\TestCase` class as `@internal` to make sure PHPStorm does not show it above PHPUnit, you may still use it to test your own handlers/etc though (#1677) - * Fixed RotatingFileHandler issue when the date format contained slashes (#1671) + * Fixed Logger not being serializable anymore (#1792) -### 3.0.0 (2022-05-10) +### 2.9.0 (2023-02-05) -Changes from RC1 - -- The `Monolog\LevelName` enum does not exist anymore, use `Monolog\Level->getName()` instead. - -### 3.0.0-RC1 (2022-05-08) - -This is mostly a cleanup release offering stronger type guarantees for integrators with the -array->object/enum changes, but there is no big new feature for end users. - -See [UPGRADE notes](UPGRADE.md#300) for details on all breaking changes especially if you are extending/implementing Monolog classes/interfaces. - -Noteworthy BC Breaks: - -- The minimum supported PHP version is now `8.1.0`. -- Log records have been converted from an array to a [`Monolog\LogRecord` object](src/Monolog/LogRecord.php) - with public (and mostly readonly) properties. e.g. instead of doing - `$record['context']` use `$record->context`. - In formatters or handlers if you rather need an array to work with you can use `$record->toArray()` - to get back a Monolog 1/2 style record array. This will contain the enum values instead of enum cases - in the `level` and `level_name` keys to be more backwards compatible and use simpler data types. -- `FormatterInterface`, `HandlerInterface`, `ProcessorInterface`, etc. changed to contain `LogRecord $record` - instead of `array $record` parameter types. If you want to support multiple Monolog versions this should - be possible by type-hinting nothing, or `array|LogRecord` if you support PHP 8.0+. You can then code - against the $record using Monolog 2 style as LogRecord implements ArrayAccess for BC. - The interfaces do not require a `LogRecord` return type even where it would be applicable, but if you only - support Monolog 3 in integration code I would recommend you use `LogRecord` return types wherever fitting - to ensure forward compatibility as it may be added in Monolog 4. -- Log levels are now enums [`Monolog\Level`](src/Monolog/Level.php) and [`Monolog\LevelName`](src/Monolog/LevelName.php) -- Removed deprecated SwiftMailerHandler, migrate to SymfonyMailerHandler instead. -- `ResettableInterface::reset()` now requires a void return type. -- All properties have had types added, which may require you to do so as well if you extended - a Monolog class and declared the same property. - -New deprecations: - -- `Logger::DEBUG`, `Logger::ERROR`, etc. are now deprecated in favor of the `Monolog\Level` enum. - e.g. instead of `Logger::WARNING` use `Level::Warning` if you need to pass the enum case - to Monolog or one of its handlers, or `Level::Warning->value` if you need the integer - value equal to what `Logger::WARNING` was giving you. -- `Logger::getLevelName()` is now deprecated. + * Deprecated FlowdockHandler & Formatter as the flowdock service was shutdown (#1748) + * Added support for enum context values in PsrLogMessageProcessor (#1773) + * Added graylog2/gelf-php 2.x support (#1747) + * Improved `BrowserConsoleHandler` logging to use more appropriate methods than just console.log in the browser (#1739) + * Fixed `WhatFailureGroupHandler` not catching errors happening inside `close()` (#1791) + * Fixed datetime field in `GoogleCloudLoggingFormatter` (#1758) + * Fixed infinite loop detection within Fibers (#1753) + * Fixed `AmqpHandler->setExtraAttributes` not working with buffering handler wrappers (#1781) ### 2.8.0 (2022-07-24) diff --git a/monolog/vendor/monolog/monolog/README.md b/monolog/vendor/monolog/monolog/README.md index 87c7f664..bfcae0c0 100644 --- a/monolog/vendor/monolog/monolog/README.md +++ b/monolog/vendor/monolog/monolog/README.md @@ -3,8 +3,6 @@ [![Total Downloads](https://img.shields.io/packagist/dt/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog) [![Latest Stable Version](https://img.shields.io/packagist/v/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog) -> ⚠ This is the **documentation for Monolog 3.x**, if you are using older releases -> see the documentation for [Monolog 2.x](https://github.com/Seldaek/monolog/blob/2.x/README.md) or [Monolog 1.x](https://github.com/Seldaek/monolog/blob/1.x/README.md) ⚠ Monolog sends your logs to files, sockets, inboxes, databases and various web services. See the complete list of handlers below. Special handlers @@ -30,13 +28,12 @@ $ composer require monolog/monolog ```php pushHandler(new StreamHandler('path/to/your.log', Level::Warning)); +$log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING)); // add records to the log $log->warning('Foo'); @@ -53,7 +50,7 @@ $log->error('Bar'); ## Support Monolog Financially -Get supported Monolog and help fund the project with the [Tidelift Subscription](https://tidelift.com/subscription/pkg/packagist-monolog-monolog?utm_source=packagist-monolog-monolog&utm_medium=referral&utm_campaign=enterprise) or via [GitHub sponsorship](https://github.com/sponsors/Seldaek). +Get supported Monolog and help fund the project with the [Tidelift Subscription](https://tidelift.com/subscription/pkg/packagist-monolog-monolog?utm_source=packagist-monolog-monolog&utm_medium=referral&utm_campaign=enterprise) or via [GitHub sponsorship](https://github.com/sponsors/Seldaek). Tidelift delivers commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. @@ -67,13 +64,11 @@ can also add your own there if you publish one. ### Requirements -- Monolog `^3.0` works with PHP 8.1 or above. -- Monolog `^2.5` works with PHP 7.2 or above. -- Monolog `^1.25` works with PHP 5.3 up to 8.1, but is not very maintained anymore and will not receive PHP support fixes anymore. +- Monolog `^2.0` works with PHP 7.2 or above, use Monolog `^1.25` for PHP 5.3+ support. ### Support -Monolog 1.x support is somewhat limited at this point and only important fixes will be done. You should migrate to Monolog 2 or 3 where possible to benefit from all the latest features and fixes. +Monolog 1.x support is somewhat limited at this point and only important fixes will be done. You should migrate to Monolog 2 where possible to benefit from all the latest features and fixes. ### Submitting bugs and feature requests diff --git a/monolog/vendor/monolog/monolog/UPGRADE.md b/monolog/vendor/monolog/monolog/UPGRADE.md new file mode 100644 index 00000000..84e15e6b --- /dev/null +++ b/monolog/vendor/monolog/monolog/UPGRADE.md @@ -0,0 +1,72 @@ +### 2.0.0 + +- `Monolog\Logger::API` can be used to distinguish between a Monolog `1` and `2` + install of Monolog when writing integration code. + +- Removed non-PSR-3 methods to add records, all the `add*` (e.g. `addWarning`) + methods as well as `emerg`, `crit`, `err` and `warn`. + +- DateTime are now formatted with a timezone and microseconds (unless disabled). + Various formatters and log output might be affected, which may mess with log parsing + in some cases. + +- The `datetime` in every record array is now a DateTimeImmutable, not that you + should have been modifying these anyway. + +- The timezone is now set per Logger instance and not statically, either + via ->setTimezone or passed in the constructor. Calls to Logger::setTimezone + should be converted. + +- `HandlerInterface` has been split off and two new interfaces now exist for + more granular controls: `ProcessableHandlerInterface` and + `FormattableHandlerInterface`. Handlers not extending `AbstractHandler` + should make sure to implement the relevant interfaces. + +- `HandlerInterface` now requires the `close` method to be implemented. This + only impacts you if you implement the interface yourself, but you can extend + the new `Monolog\Handler\Handler` base class too. + +- There is no more default handler configured on empty Logger instances, if + you were relying on that you will not get any output anymore, make sure to + configure the handler you need. + +#### LogglyFormatter + +- The records' `datetime` is not sent anymore. Only `timestamp` is sent to Loggly. + +#### AmqpHandler + +- Log levels are not shortened to 4 characters anymore. e.g. a warning record + will be sent using the `warning.channel` routing key instead of `warn.channel` + as in 1.x. +- The exchange name does not default to 'log' anymore, and it is completely ignored + now for the AMQP extension users. Only PHPAmqpLib uses it if provided. + +#### RotatingFileHandler + +- The file name format must now contain `{date}` and the date format must be set + to one of the predefined FILE_PER_* constants to avoid issues with file rotation. + See `setFilenameFormat`. + +#### LogstashFormatter + +- Removed Logstash V0 support +- Context/extra prefix has been removed in favor of letting users configure the exact key being sent +- Context/extra data are now sent as an object instead of single keys + +#### HipChatHandler + +- Removed deprecated HipChat handler, migrate to Slack and use SlackWebhookHandler or SlackHandler instead + +#### SlackbotHandler + +- Removed deprecated SlackbotHandler handler, use SlackWebhookHandler or SlackHandler instead + +#### RavenHandler + +- Removed deprecated RavenHandler handler, use sentry/sentry 2.x and their Sentry\Monolog\Handler instead + +#### ElasticSearchHandler + +- As support for the official Elasticsearch library was added, the former ElasticSearchHandler has been + renamed to ElasticaHandler and the new one added as ElasticsearchHandler. diff --git a/monolog/vendor/monolog/monolog/composer.json b/monolog/vendor/monolog/monolog/composer.json index 3a48e6db..b9437d6d 100644 --- a/monolog/vendor/monolog/monolog/composer.json +++ b/monolog/vendor/monolog/monolog/composer.json @@ -13,25 +13,26 @@ } ], "require": { - "php": ">=8.1", - "psr/log": "^2.0 || ^3.0" + "php": ">=7.2", + "psr/log": "^1.0.1 || ^2.0 || ^3.0" }, "require-dev": { "ext-json": "*", - "aws/aws-sdk-php": "^3.0", + "aws/aws-sdk-php": "^2.4.9 || ^3.0", "doctrine/couchdb": "~1.0@dev", "elasticsearch/elasticsearch": "^7 || ^8", - "graylog2/gelf-php": "^1.4.2", + "graylog2/gelf-php": "^1.4.2 || ^2@dev", "guzzlehttp/guzzle": "^7.4", "guzzlehttp/psr7": "^2.2", "mongodb/mongodb": "^1.8", "php-amqplib/php-amqplib": "~2.4 || ^3", - "phpstan/phpstan": "^1.4", - "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-strict-rules": "^1.1", - "phpunit/phpunit": "^9.5.16", - "predis/predis": "^1.1", + "phpspec/prophecy": "^1.15", + "phpstan/phpstan": "^0.12.91", + "phpunit/phpunit": "^8.5.14", + "predis/predis": "^1.1 || ^2.0", + "rollbar/rollbar": "^1.3 || ^2 || ^3", "ruflin/elastica": "^7", + "swiftmailer/swiftmailer": "^5.3|^6.0", "symfony/mailer": "^5.4 || ^6", "symfony/mime": "^5.4 || ^6" }, @@ -58,11 +59,11 @@ "psr-4": {"Monolog\\": "tests/Monolog"} }, "provide": { - "psr/log-implementation": "3.0.0" + "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0" }, "extra": { "branch-alias": { - "dev-main": "3.x-dev" + "dev-main": "2.x-dev" } }, "scripts": { @@ -72,6 +73,9 @@ "config": { "lock": false, "sort-packages": true, - "platform-check": false + "platform-check": false, + "allow-plugins": { + "composer/package-versions-deprecated": true + } } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Attribute/AsMonologProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Attribute/AsMonologProcessor.php index f8b25021..188bbb0d 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Attribute/AsMonologProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Attribute/AsMonologProcessor.php @@ -13,24 +13,34 @@ namespace Monolog\Attribute; /** * A reusable attribute to help configure a class or a method as a processor. - * + * * Using it offers no guarantee: it needs to be leveraged by a Monolog third-party consumer. - * + * * Using it with the Monolog library only has no effect at all: processors should still be turned into a callable if * needed and manually pushed to the loggers and to the processable handlers. */ #[\Attribute(\Attribute::TARGET_CLASS | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)] class AsMonologProcessor { + /** @var string|null */ + public $channel = null; + /** @var string|null */ + public $handler = null; + /** @var string|null */ + public $method = null; + /** - * @param string|null $channel The logging channel the processor should be pushed to. - * @param string|null $handler The handler the processor should be pushed to. - * @param string|null $method The method that processes the records (if the attribute is used at the class level). + * @param string|null $channel The logging channel the processor should be pushed to. + * @param string|null $handler The handler the processor should be pushed to. + * @param string|null $method The method that processes the records (if the attribute is used at the class level). */ public function __construct( - public readonly ?string $channel = null, - public readonly ?string $handler = null, - public readonly ?string $method = null + ?string $channel = null, + ?string $handler = null, + ?string $method = null ) { + $this->channel = $channel; + $this->handler = $handler; + $this->method = $method; } -} +} diff --git a/monolog/vendor/monolog/monolog/src/Monolog/DateTimeImmutable.php b/monolog/vendor/monolog/monolog/src/Monolog/DateTimeImmutable.php index 274b73ea..6a1ba9b2 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/DateTimeImmutable.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/DateTimeImmutable.php @@ -21,7 +21,10 @@ use DateTimeZone; */ class DateTimeImmutable extends \DateTimeImmutable implements \JsonSerializable { - private bool $useMicroseconds; + /** + * @var bool + */ + private $useMicroseconds; public function __construct(bool $useMicroseconds, ?DateTimeZone $timezone = null) { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/ErrorHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/ErrorHandler.php index 2ed46035..1406d34e 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/ErrorHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/ErrorHandler.php @@ -11,7 +11,6 @@ namespace Monolog; -use Closure; use Psr\Log\LoggerInterface; use Psr\Log\LogLevel; @@ -26,33 +25,35 @@ use Psr\Log\LogLevel; */ class ErrorHandler { - private Closure|null $previousExceptionHandler = null; + /** @var LoggerInterface */ + private $logger; + /** @var ?callable */ + private $previousExceptionHandler = null; /** @var array an array of class name to LogLevel::* constant mapping */ - private array $uncaughtExceptionLevelMap = []; - - /** @var Closure|true|null */ - private Closure|bool|null $previousErrorHandler = null; + private $uncaughtExceptionLevelMap = []; + /** @var callable|true|null */ + private $previousErrorHandler = null; /** @var array an array of E_* constant to LogLevel::* constant mapping */ - private array $errorLevelMap = []; - - private bool $handleOnlyReportedErrors = true; - - private bool $hasFatalErrorHandler = false; - - private string $fatalLevel = LogLevel::ALERT; - - private string|null $reservedMemory = null; + private $errorLevelMap = []; + /** @var bool */ + private $handleOnlyReportedErrors = true; + /** @var bool */ + private $hasFatalErrorHandler = false; + /** @var LogLevel::* */ + private $fatalLevel = LogLevel::ALERT; + /** @var ?string */ + private $reservedMemory = null; /** @var ?array{type: int, message: string, file: string, line: int, trace: mixed} */ - private array|null $lastFatalData = null; + private $lastFatalData = null; + /** @var int[] */ + private static $fatalErrors = [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR]; - private const FATAL_ERRORS = [E_ERROR, E_PARSE, E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR]; - - public function __construct( - private LoggerInterface $logger - ) { + public function __construct(LoggerInterface $logger) + { + $this->logger = $logger; } /** @@ -60,6 +61,7 @@ class ErrorHandler * * By default it will handle errors, exceptions and fatal errors * + * @param LoggerInterface $logger * @param array|false $errorLevelMap an array of E_* constant to LogLevel::* constant mapping, or false to disable error handling * @param array|false $exceptionLevelMap an array of class name to LogLevel::* constant mapping, or false to disable exception handling * @param LogLevel::*|null|false $fatalLevel a LogLevel::* constant, null to use the default LogLevel::ALERT or false to disable fatal error handling @@ -97,8 +99,8 @@ class ErrorHandler $this->uncaughtExceptionLevelMap[$class] = $level; } } - if ($callPrevious && null !== $prev) { - $this->previousExceptionHandler = $prev(...); + if ($callPrevious && $prev) { + $this->previousExceptionHandler = $prev; } return $this; @@ -110,10 +112,10 @@ class ErrorHandler */ public function registerErrorHandler(array $levelMap = [], bool $callPrevious = true, int $errorTypes = -1, bool $handleOnlyReportedErrors = true): self { - $prev = set_error_handler($this->handleError(...), $errorTypes); + $prev = set_error_handler([$this, 'handleError'], $errorTypes); $this->errorLevelMap = array_replace($this->defaultErrorLevelMap(), $levelMap); if ($callPrevious) { - $this->previousErrorHandler = $prev !== null ? $prev(...) : true; + $this->previousErrorHandler = $prev ?: true; } else { $this->previousErrorHandler = null; } @@ -129,7 +131,7 @@ class ErrorHandler */ public function registerFatalHandler($level = null, int $reservedMemorySize = 20): self { - register_shutdown_function($this->handleFatalError(...)); + register_shutdown_function([$this, 'handleFatalError']); $this->reservedMemory = str_repeat(' ', 1024 * $reservedMemorySize); $this->fatalLevel = null === $level ? LogLevel::ALERT : $level; @@ -173,7 +175,10 @@ class ErrorHandler ]; } - private function handleException(\Throwable $e): never + /** + * @phpstan-return never + */ + private function handleException(\Throwable $e): void { $level = LogLevel::ERROR; foreach ($this->uncaughtExceptionLevelMap as $class => $candidate) { @@ -189,25 +194,30 @@ class ErrorHandler ['exception' => $e] ); - if (null !== $this->previousExceptionHandler) { + if ($this->previousExceptionHandler) { ($this->previousExceptionHandler)($e); } - if (!headers_sent() && !(bool) ini_get('display_errors')) { + if (!headers_sent() && in_array(strtolower((string) ini_get('display_errors')), ['0', '', 'false', 'off', 'none', 'no'], true)) { http_response_code(500); } exit(255); } - private function handleError(int $code, string $message, string $file = '', int $line = 0): bool + /** + * @private + * + * @param mixed[] $context + */ + public function handleError(int $code, string $message, string $file = '', int $line = 0, ?array $context = []): bool { - if ($this->handleOnlyReportedErrors && 0 === (error_reporting() & $code)) { + if ($this->handleOnlyReportedErrors && !(error_reporting() & $code)) { return false; } // fatal error codes are ignored if a fatal error handler is present as well to avoid duplicate log entries - if (!$this->hasFatalErrorHandler || !in_array($code, self::FATAL_ERRORS, true)) { + if (!$this->hasFatalErrorHandler || !in_array($code, self::$fatalErrors, true)) { $level = $this->errorLevelMap[$code] ?? LogLevel::CRITICAL; $this->logger->log($level, self::codeToString($code).': '.$message, ['code' => $code, 'message' => $message, 'file' => $file, 'line' => $line]); } else { @@ -218,9 +228,8 @@ class ErrorHandler if ($this->previousErrorHandler === true) { return false; - } - if ($this->previousErrorHandler instanceof Closure) { - return (bool) ($this->previousErrorHandler)($code, $message, $file, $line); + } elseif ($this->previousErrorHandler) { + return (bool) ($this->previousErrorHandler)($code, $message, $file, $line, $context); } return true; @@ -238,7 +247,8 @@ class ErrorHandler } else { $lastError = error_get_last(); } - if (is_array($lastError) && in_array($lastError['type'], self::FATAL_ERRORS, true)) { + + if ($lastError && in_array($lastError['type'], self::$fatalErrors, true)) { $trace = $lastError['trace'] ?? null; $this->logger->log( $this->fatalLevel, @@ -254,25 +264,44 @@ class ErrorHandler } } - private static function codeToString(int $code): string + /** + * @param int $code + */ + private static function codeToString($code): string { - return match ($code) { - E_ERROR => 'E_ERROR', - E_WARNING => 'E_WARNING', - E_PARSE => 'E_PARSE', - E_NOTICE => 'E_NOTICE', - E_CORE_ERROR => 'E_CORE_ERROR', - E_CORE_WARNING => 'E_CORE_WARNING', - E_COMPILE_ERROR => 'E_COMPILE_ERROR', - E_COMPILE_WARNING => 'E_COMPILE_WARNING', - E_USER_ERROR => 'E_USER_ERROR', - E_USER_WARNING => 'E_USER_WARNING', - E_USER_NOTICE => 'E_USER_NOTICE', - E_STRICT => 'E_STRICT', - E_RECOVERABLE_ERROR => 'E_RECOVERABLE_ERROR', - E_DEPRECATED => 'E_DEPRECATED', - E_USER_DEPRECATED => 'E_USER_DEPRECATED', - default => 'Unknown PHP error', - }; + switch ($code) { + case E_ERROR: + return 'E_ERROR'; + case E_WARNING: + return 'E_WARNING'; + case E_PARSE: + return 'E_PARSE'; + case E_NOTICE: + return 'E_NOTICE'; + case E_CORE_ERROR: + return 'E_CORE_ERROR'; + case E_CORE_WARNING: + return 'E_CORE_WARNING'; + case E_COMPILE_ERROR: + return 'E_COMPILE_ERROR'; + case E_COMPILE_WARNING: + return 'E_COMPILE_WARNING'; + case E_USER_ERROR: + return 'E_USER_ERROR'; + case E_USER_WARNING: + return 'E_USER_WARNING'; + case E_USER_NOTICE: + return 'E_USER_NOTICE'; + case E_STRICT: + return 'E_STRICT'; + case E_RECOVERABLE_ERROR: + return 'E_RECOVERABLE_ERROR'; + case E_DEPRECATED: + return 'E_DEPRECATED'; + case E_USER_DEPRECATED: + return 'E_USER_DEPRECATED'; + } + + return 'Unknown PHP error'; } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php index 3f1d4582..aa1884b9 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/ChromePHPFormatter.php @@ -11,8 +11,7 @@ namespace Monolog\Formatter; -use Monolog\Level; -use Monolog\LogRecord; +use Monolog\Logger; /** * Formats a log message according to the ChromePHP array format @@ -24,55 +23,52 @@ class ChromePHPFormatter implements FormatterInterface /** * Translates Monolog log levels to Wildfire levels. * - * @return 'log'|'info'|'warn'|'error' + * @var array */ - private function toWildfireLevel(Level $level): string - { - return match ($level) { - Level::Debug => 'log', - Level::Info => 'info', - Level::Notice => 'info', - Level::Warning => 'warn', - Level::Error => 'error', - Level::Critical => 'error', - Level::Alert => 'error', - Level::Emergency => 'error', - }; - } + private $logLevels = [ + Logger::DEBUG => 'log', + Logger::INFO => 'info', + Logger::NOTICE => 'info', + Logger::WARNING => 'warn', + Logger::ERROR => 'error', + Logger::CRITICAL => 'error', + Logger::ALERT => 'error', + Logger::EMERGENCY => 'error', + ]; /** - * @inheritDoc + * {@inheritDoc} */ - public function format(LogRecord $record) + public function format(array $record) { // Retrieve the line and file if set and remove them from the formatted extra $backtrace = 'unknown'; - if (isset($record->extra['file'], $record->extra['line'])) { - $backtrace = $record->extra['file'].' : '.$record->extra['line']; - unset($record->extra['file'], $record->extra['line']); + if (isset($record['extra']['file'], $record['extra']['line'])) { + $backtrace = $record['extra']['file'].' : '.$record['extra']['line']; + unset($record['extra']['file'], $record['extra']['line']); } - $message = ['message' => $record->message]; - if (\count($record->context) > 0) { - $message['context'] = $record->context; + $message = ['message' => $record['message']]; + if ($record['context']) { + $message['context'] = $record['context']; } - if (\count($record->extra) > 0) { - $message['extra'] = $record->extra; + if ($record['extra']) { + $message['extra'] = $record['extra']; } if (count($message) === 1) { $message = reset($message); } return [ - $record->channel, + $record['channel'], $message, $backtrace, - $this->toWildfireLevel($record->level), + $this->logLevels[$record['level']], ]; } /** - * @inheritDoc + * {@inheritDoc} */ public function formatBatch(array $records) { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php index 160510ad..6c8a9ab5 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/ElasticaFormatter.php @@ -12,24 +12,25 @@ namespace Monolog\Formatter; use Elastica\Document; -use Monolog\LogRecord; /** * Format a log message into an Elastica Document * * @author Jelle Vink + * + * @phpstan-import-type Record from \Monolog\Logger */ class ElasticaFormatter extends NormalizerFormatter { /** * @var string Elastic search index name */ - protected string $index; + protected $index; /** - * @var string|null Elastic search document type + * @var ?string Elastic search document type */ - protected string|null $type; + protected $type; /** * @param string $index Elastic Search index name @@ -45,9 +46,9 @@ class ElasticaFormatter extends NormalizerFormatter } /** - * @inheritDoc + * {@inheritDoc} */ - public function format(LogRecord $record) + public function format(array $record) { $record = parent::format($record); @@ -71,13 +72,14 @@ class ElasticaFormatter extends NormalizerFormatter /** * Convert a log message into an Elastica Document * - * @param mixed[] $record + * @phpstan-param Record $record */ protected function getDocument(array $record): Document { $document = new Document(); $document->setData($record); if (method_exists($document, 'setType')) { + /** @phpstan-ignore-next-line */ $document->setType($this->type); } $document->setIndex($this->index); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/ElasticsearchFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/ElasticsearchFormatter.php index 6c3eb9b2..b792b819 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/ElasticsearchFormatter.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/ElasticsearchFormatter.php @@ -12,7 +12,6 @@ namespace Monolog\Formatter; use DateTimeInterface; -use Monolog\LogRecord; /** * Format a log message into an Elasticsearch record @@ -24,12 +23,12 @@ class ElasticsearchFormatter extends NormalizerFormatter /** * @var string Elasticsearch index name */ - protected string $index; + protected $index; /** * @var string Elasticsearch record type */ - protected string $type; + protected $type; /** * @param string $index Elasticsearch index name @@ -45,9 +44,9 @@ class ElasticsearchFormatter extends NormalizerFormatter } /** - * @inheritDoc + * {@inheritDoc} */ - public function format(LogRecord $record) + public function format(array $record) { $record = parent::format($record); @@ -56,6 +55,8 @@ class ElasticsearchFormatter extends NormalizerFormatter /** * Getter index + * + * @return string */ public function getIndex(): string { @@ -64,6 +65,8 @@ class ElasticsearchFormatter extends NormalizerFormatter /** * Getter type + * + * @return string */ public function getType(): string { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php index b8f7be52..867ae586 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/FlowdockFormatter.php @@ -11,18 +11,23 @@ namespace Monolog\Formatter; -use Monolog\LogRecord; - /** * formats the record to be used in the FlowdockHandler * * @author Dominik Liebler + * @deprecated Since 2.9.0 and 3.3.0, Flowdock was shutdown we will thus drop this handler in Monolog 4 */ class FlowdockFormatter implements FormatterInterface { - private string $source; + /** + * @var string + */ + private $source; - private string $sourceEmail; + /** + * @var string + */ + private $sourceEmail; public function __construct(string $source, string $sourceEmail) { @@ -31,41 +36,43 @@ class FlowdockFormatter implements FormatterInterface } /** - * @inheritDoc + * {@inheritDoc} * * @return mixed[] */ - public function format(LogRecord $record): array + public function format(array $record): array { $tags = [ '#logs', - '#' . $record->level->toPsrLogLevel(), - '#' . $record->channel, + '#' . strtolower($record['level_name']), + '#' . $record['channel'], ]; - foreach ($record->extra as $value) { + foreach ($record['extra'] as $value) { $tags[] = '#' . $value; } $subject = sprintf( 'in %s: %s - %s', $this->source, - $record->level->getName(), - $this->getShortMessage($record->message) + $record['level_name'], + $this->getShortMessage($record['message']) ); - return [ + $record['flowdock'] = [ 'source' => $this->source, 'from_address' => $this->sourceEmail, 'subject' => $subject, - 'content' => $record->message, + 'content' => $record['message'], 'tags' => $tags, 'project' => $this->source, ]; + + return $record; } /** - * @inheritDoc + * {@inheritDoc} * * @return mixed[][] */ diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php index 9bd2c160..29b14d30 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/FluentdFormatter.php @@ -12,7 +12,6 @@ namespace Monolog\Formatter; use Monolog\Utils; -use Monolog\LogRecord; /** * Class FluentdFormatter @@ -40,7 +39,7 @@ class FluentdFormatter implements FormatterInterface /** * @var bool $levelTag should message level be a part of the fluentd tag */ - protected bool $levelTag = false; + protected $levelTag = false; public function __construct(bool $levelTag = false) { @@ -56,25 +55,25 @@ class FluentdFormatter implements FormatterInterface return $this->levelTag; } - public function format(LogRecord $record): string + public function format(array $record): string { - $tag = $record->channel; + $tag = $record['channel']; if ($this->levelTag) { - $tag .= '.' . $record->level->toPsrLogLevel(); + $tag .= '.' . strtolower($record['level_name']); } $message = [ - 'message' => $record->message, - 'context' => $record->context, - 'extra' => $record->extra, + 'message' => $record['message'], + 'context' => $record['context'], + 'extra' => $record['extra'], ]; if (!$this->levelTag) { - $message['level'] = $record->level->value; - $message['level_name'] = $record->level->getName(); + $message['level'] = $record['level']; + $message['level_name'] = $record['level_name']; } - return Utils::jsonEncode([$tag, $record->datetime->getTimestamp(), $message]); + return Utils::jsonEncode([$tag, $record['datetime']->getTimestamp(), $message]); } public function formatBatch(array $records): string diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php index 3413a4b0..19617ec5 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/FormatterInterface.php @@ -11,28 +11,32 @@ namespace Monolog\Formatter; -use Monolog\LogRecord; - /** * Interface for formatters * * @author Jordi Boggiano + * + * @phpstan-import-type Record from \Monolog\Logger */ interface FormatterInterface { /** * Formats a log record. * - * @param LogRecord $record A record to format - * @return mixed The formatted record + * @param array $record A record to format + * @return mixed The formatted record + * + * @phpstan-param Record $record */ - public function format(LogRecord $record); + public function format(array $record); /** * Formats a set of log records. * - * @param array $records A set of records to format - * @return mixed The formatted set of records + * @param array $records A set of records to format + * @return mixed The formatted set of records + * + * @phpstan-param Record[] $records */ public function formatBatch(array $records); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php index 33116a26..3b3e1e7f 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/GelfMessageFormatter.php @@ -11,16 +11,17 @@ namespace Monolog\Formatter; -use Monolog\Level; +use Monolog\Logger; use Gelf\Message; use Monolog\Utils; -use Monolog\LogRecord; /** * Serializes a log message to GELF * @see http://docs.graylog.org/en/latest/pages/gelf.html * * @author Matt Lehner + * + * @phpstan-import-type Level from \Monolog\Logger */ class GelfMessageFormatter extends NormalizerFormatter { @@ -29,39 +30,45 @@ class GelfMessageFormatter extends NormalizerFormatter /** * @var string the name of the system for the Gelf log message */ - protected string $systemName; + protected $systemName; /** * @var string a prefix for 'extra' fields from the Monolog record (optional) */ - protected string $extraPrefix; + protected $extraPrefix; /** * @var string a prefix for 'context' fields from the Monolog record (optional) */ - protected string $contextPrefix; + protected $contextPrefix; /** * @var int max length per field */ - protected int $maxLength; + protected $maxLength; + + /** + * @var int + */ + private $gelfVersion = 2; /** * Translates Monolog log levels to Graylog2 log priorities. + * + * @var array + * + * @phpstan-var array */ - private function getGraylog2Priority(Level $level): int - { - return match ($level) { - Level::Debug => 7, - Level::Info => 6, - Level::Notice => 5, - Level::Warning => 4, - Level::Error => 3, - Level::Critical => 2, - Level::Alert => 1, - Level::Emergency => 0, - }; - } + private $logLevels = [ + Logger::DEBUG => 7, + Logger::INFO => 6, + Logger::NOTICE => 5, + Logger::WARNING => 4, + Logger::ERROR => 3, + Logger::CRITICAL => 2, + Logger::ALERT => 1, + Logger::EMERGENCY => 0, + ]; public function __construct(?string $systemName = null, ?string $extraPrefix = null, string $contextPrefix = 'ctxt_', ?int $maxLength = null) { @@ -71,52 +78,64 @@ class GelfMessageFormatter extends NormalizerFormatter parent::__construct('U.u'); - $this->systemName = (null === $systemName || $systemName === '') ? (string) gethostname() : $systemName; + $this->systemName = (is_null($systemName) || $systemName === '') ? (string) gethostname() : $systemName; - $this->extraPrefix = null === $extraPrefix ? '' : $extraPrefix; + $this->extraPrefix = is_null($extraPrefix) ? '' : $extraPrefix; $this->contextPrefix = $contextPrefix; - $this->maxLength = null === $maxLength ? self::DEFAULT_MAX_LENGTH : $maxLength; + $this->maxLength = is_null($maxLength) ? self::DEFAULT_MAX_LENGTH : $maxLength; + + if (method_exists(Message::class, 'setFacility')) { + $this->gelfVersion = 1; + } } /** - * @inheritDoc + * {@inheritDoc} */ - public function format(LogRecord $record): Message + public function format(array $record): Message { $context = $extra = []; - if (isset($record->context)) { + if (isset($record['context'])) { /** @var mixed[] $context */ - $context = parent::normalize($record->context); + $context = parent::normalize($record['context']); } - if (isset($record->extra)) { + if (isset($record['extra'])) { /** @var mixed[] $extra */ - $extra = parent::normalize($record->extra); + $extra = parent::normalize($record['extra']); + } + + if (!isset($record['datetime'], $record['message'], $record['level'])) { + throw new \InvalidArgumentException('The record should at least contain datetime, message and level keys, '.var_export($record, true).' given'); } $message = new Message(); $message - ->setTimestamp($record->datetime) - ->setShortMessage($record->message) + ->setTimestamp($record['datetime']) + ->setShortMessage((string) $record['message']) ->setHost($this->systemName) - ->setLevel($this->getGraylog2Priority($record->level)); + ->setLevel($this->logLevels[$record['level']]); // message length + system name length + 200 for padding / metadata - $len = 200 + strlen($record->message) + strlen($this->systemName); + $len = 200 + strlen((string) $record['message']) + strlen($this->systemName); if ($len > $this->maxLength) { - $message->setShortMessage(Utils::substr($record->message, 0, $this->maxLength)); + $message->setShortMessage(Utils::substr($record['message'], 0, $this->maxLength)); } - if (isset($record->channel)) { - $message->setAdditional('facility', $record->channel); - } - if (isset($extra['line'])) { - $message->setAdditional('line', $extra['line']); - unset($extra['line']); - } - if (isset($extra['file'])) { - $message->setAdditional('file', $extra['file']); - unset($extra['file']); + if ($this->gelfVersion === 1) { + if (isset($record['channel'])) { + $message->setFacility($record['channel']); + } + if (isset($extra['line'])) { + $message->setLine($extra['line']); + unset($extra['line']); + } + if (isset($extra['file'])) { + $message->setFile($extra['file']); + unset($extra['file']); + } + } else { + $message->setAdditional('facility', $record['channel']); } foreach ($extra as $key => $val) { @@ -141,10 +160,13 @@ class GelfMessageFormatter extends NormalizerFormatter $message->setAdditional($this->contextPrefix . $key, $val); } - if (!$message->hasAdditional('file') && isset($context['exception']['file'])) { - if (1 === preg_match("/^(.+):([0-9]+)$/", $context['exception']['file'], $matches)) { - $message->setAdditional('file', $matches[1]); - $message->setAdditional('line', $matches[2]); + if ($this->gelfVersion === 1) { + /** @phpstan-ignore-next-line */ + if (null === $message->getFile() && isset($context['exception']['file'])) { + if (preg_match("/^(.+):([0-9]+)$/", $context['exception']['file'], $matches)) { + $message->setFile($matches[1]); + $message->setLine($matches[2]); + } } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/GoogleCloudLoggingFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/GoogleCloudLoggingFormatter.php index d37d1e0c..ca52ebf4 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/GoogleCloudLoggingFormatter.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/GoogleCloudLoggingFormatter.php @@ -17,23 +17,24 @@ use Monolog\LogRecord; /** * Encodes message information into JSON in a format compatible with Cloud logging. * + * @see https://cloud.google.com/logging/docs/structured-logging * @see https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry * * @author Luís Cobucci */ final class GoogleCloudLoggingFormatter extends JsonFormatter { - protected function normalizeRecord(LogRecord $record): array + /** {@inheritdoc} **/ + public function format(array $record): string { - $normalized = parent::normalizeRecord($record); - // Re-key level for GCP logging - $normalized['severity'] = $normalized['level_name']; - $normalized['timestamp'] = $record->datetime->format(DateTimeInterface::RFC3339_EXTENDED); + $record['severity'] = $record['level_name']; + $record['time'] = $record['datetime']->format(DateTimeInterface::RFC3339_EXTENDED); // Remove keys that are not used by GCP - unset($normalized['level'], $normalized['level_name'], $normalized['datetime']); + unset($record['level'], $record['level_name'], $record['datetime']); - return $normalized; + return parent::format($record); } } + diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php index bf1c61da..10a4311c 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/HtmlFormatter.php @@ -11,9 +11,8 @@ namespace Monolog\Formatter; -use Monolog\Level; +use Monolog\Logger; use Monolog\Utils; -use Monolog\LogRecord; /** * Formats incoming records into an HTML table @@ -26,20 +25,19 @@ class HtmlFormatter extends NormalizerFormatter { /** * Translates Monolog log levels to html color priorities. + * + * @var array */ - protected function getLevelColor(Level $level): string - { - return match ($level) { - Level::Debug => '#CCCCCC', - Level::Info => '#28A745', - Level::Notice => '#17A2B8', - Level::Warning => '#FFC107', - Level::Error => '#FD7E14', - Level::Critical => '#DC3545', - Level::Alert => '#821722', - Level::Emergency => '#000000', - }; - } + protected $logLevels = [ + Logger::DEBUG => '#CCCCCC', + Logger::INFO => '#28A745', + Logger::NOTICE => '#17A2B8', + Logger::WARNING => '#FFC107', + Logger::ERROR => '#FD7E14', + Logger::CRITICAL => '#DC3545', + Logger::ALERT => '#821722', + Logger::EMERGENCY => '#000000', + ]; /** * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format @@ -69,13 +67,15 @@ class HtmlFormatter extends NormalizerFormatter /** * Create a HTML h1 tag * - * @param string $title Text to be in the h1 + * @param string $title Text to be in the h1 + * @param int $level Error level + * @return string */ - protected function addTitle(string $title, Level $level): string + protected function addTitle(string $title, int $level): string { $title = htmlspecialchars($title, ENT_NOQUOTES, 'UTF-8'); - return '

'.$title.'

'; + return '

'.$title.'

'; } /** @@ -83,25 +83,25 @@ class HtmlFormatter extends NormalizerFormatter * * @return string The formatted record */ - public function format(LogRecord $record): string + public function format(array $record): string { - $output = $this->addTitle($record->level->getName(), $record->level); + $output = $this->addTitle($record['level_name'], $record['level']); $output .= '
@@ -323,7 +322,7 @@ $o .= <<< EOT - + @@ -345,13 +344,13 @@ $o .= <<< EOT - +
diff --git a/catavatar/catavatar.php b/catavatar/catavatar.php index 2116ac44..7b5f05c0 100644 --- a/catavatar/catavatar.php +++ b/catavatar/catavatar.php @@ -6,11 +6,8 @@ * Author: Fabio */ -use Friendica\App; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Renderer; -use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; @@ -29,7 +26,7 @@ function catavatar_install() Hook::register('addon_settings', __FILE__, 'catavatar_addon_settings'); Hook::register('addon_settings_post', __FILE__, 'catavatar_addon_settings_post'); - Logger::notice('registered catavatar'); + DI::logger()->notice('registered catavatar'); } /** diff --git a/catavatar/lang/bg/messages.po b/catavatar/lang/bg/messages.po new file mode 100644 index 00000000..027fc971 --- /dev/null +++ b/catavatar/lang/bg/messages.po @@ -0,0 +1,54 @@ +# ADDON catavatar +# Copyright (C) +# This file is distributed under the same license as the Friendica catavatar addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:14-0500\n" +"PO-Revision-Date: 2018-04-07 05:23+0000\n" +"Language-Team: Bulgarian (https://app.transifex.com/Friendica/teams/12172/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: catavatar.php:48 +msgid "Set default profile avatar or randomize the cat." +msgstr "" + +#: catavatar.php:53 +msgid "Cat Avatar Settings" +msgstr "" + +#: catavatar.php:56 +msgid "Use Cat as Avatar" +msgstr "" + +#: catavatar.php:57 +msgid "Another random Cat!" +msgstr "" + +#: catavatar.php:58 +msgid "Reset to email Cat" +msgstr "" + +#: catavatar.php:77 +msgid "The cat hadn't found itself." +msgstr "" + +#: catavatar.php:86 +msgid "There was an error, the cat ran away." +msgstr "" + +#: catavatar.php:92 +msgid "Profile Photos" +msgstr "" + +#: catavatar.php:102 +msgid "Meow!" +msgstr "" diff --git a/catavatar/lang/bg/strings.php b/catavatar/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/catavatar/lang/bg/strings.php @@ -0,0 +1,7 @@ +, 2019 -# Walter Bulbazor, 2021 -# Hypolite Petovan , 2022 +# Florent C., 2023 # #, fuzzy msgid "" @@ -15,8 +14,8 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-11-21 19:14-0500\n" "PO-Revision-Date: 2018-04-07 05:23+0000\n" -"Last-Translator: Hypolite Petovan , 2022\n" -"Language-Team: French (https://www.transifex.com/Friendica/teams/12172/fr/)\n" +"Last-Translator: Florent C., 2023\n" +"Language-Team: French (https://app.transifex.com/Friendica/teams/12172/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -25,7 +24,7 @@ msgstr "" #: catavatar.php:48 msgid "Set default profile avatar or randomize the cat." -msgstr "Mettre l'avatar par défaut ou tirer au sort le Chat." +msgstr "Mettre l'avatar par défaut ou tirer au sort le chat." #: catavatar.php:53 msgid "Cat Avatar Settings" @@ -33,15 +32,15 @@ msgstr "Paramètres de Chat avatar" #: catavatar.php:56 msgid "Use Cat as Avatar" -msgstr "Utiliser Chat comme avatar" +msgstr "Utiliser ce Chat" #: catavatar.php:57 msgid "Another random Cat!" -msgstr "Un autre chat aléatoire !" +msgstr "Un autre Chat aléatoire !" #: catavatar.php:58 msgid "Reset to email Cat" -msgstr "Réinitialiser à Chat courriel" +msgstr "Revenir au Chat par défaut" #: catavatar.php:77 msgid "The cat hadn't found itself." diff --git a/catavatar/lang/fr/strings.php b/catavatar/lang/fr/strings.php index 5d8a10a3..b68b9d45 100644 --- a/catavatar/lang/fr/strings.php +++ b/catavatar/lang/fr/strings.php @@ -5,11 +5,11 @@ function string_plural_select_fr($n){ $n = intval($n); if (($n == 0 || $n == 1)) { return 0; } else if ($n != 0 && $n % 1000000 == 0) { return 1; } else { return 2; } }} -$a->strings['Set default profile avatar or randomize the cat.'] = 'Mettre l\'avatar par défaut ou tirer au sort le Chat.'; +$a->strings['Set default profile avatar or randomize the cat.'] = 'Mettre l\'avatar par défaut ou tirer au sort le chat.'; $a->strings['Cat Avatar Settings'] = 'Paramètres de Chat avatar'; -$a->strings['Use Cat as Avatar'] = 'Utiliser Chat comme avatar'; -$a->strings['Another random Cat!'] = 'Un autre chat aléatoire !'; -$a->strings['Reset to email Cat'] = 'Réinitialiser à Chat courriel'; +$a->strings['Use Cat as Avatar'] = 'Utiliser ce Chat'; +$a->strings['Another random Cat!'] = 'Un autre Chat aléatoire !'; +$a->strings['Reset to email Cat'] = 'Revenir au Chat par défaut'; $a->strings['The cat hadn\'t found itself.'] = 'Le Chat ne s\'y est pas retrouvé'; $a->strings['There was an error, the cat ran away.'] = 'Il y a eu une erreur et le chat s\'est enfui'; $a->strings['Profile Photos'] = 'Photos de profil'; diff --git a/catavatar/lang/gd/messages.po b/catavatar/lang/gd/messages.po new file mode 100644 index 00000000..b86ca6f1 --- /dev/null +++ b/catavatar/lang/gd/messages.po @@ -0,0 +1,54 @@ +# ADDON catavatar +# Copyright (C) +# This file is distributed under the same license as the Friendica catavatar addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:14-0500\n" +"PO-Revision-Date: 2018-04-07 05:23+0000\n" +"Language-Team: Gaelic, Scottish (https://app.transifex.com/Friendica/teams/12172/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: catavatar.php:48 +msgid "Set default profile avatar or randomize the cat." +msgstr "" + +#: catavatar.php:53 +msgid "Cat Avatar Settings" +msgstr "" + +#: catavatar.php:56 +msgid "Use Cat as Avatar" +msgstr "" + +#: catavatar.php:57 +msgid "Another random Cat!" +msgstr "" + +#: catavatar.php:58 +msgid "Reset to email Cat" +msgstr "" + +#: catavatar.php:77 +msgid "The cat hadn't found itself." +msgstr "" + +#: catavatar.php:86 +msgid "There was an error, the cat ran away." +msgstr "" + +#: catavatar.php:92 +msgid "Profile Photos" +msgstr "" + +#: catavatar.php:102 +msgid "Meow!" +msgstr "" diff --git a/catavatar/lang/gd/strings.php b/catavatar/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/catavatar/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/catavatar/lang/it/messages.po b/catavatar/lang/it/messages.po index e05bd277..9155bb48 100644 --- a/catavatar/lang/it/messages.po +++ b/catavatar/lang/it/messages.po @@ -6,55 +6,55 @@ # Translators: # fabrixxm , 2018 # Davide Pesenti , 2018 -# Sylke Vicious , 2021 +# Sylke Vicious , 2023 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-12-29 00:53+0000\n" +"POT-Creation-Date: 2021-11-21 19:14-0500\n" "PO-Revision-Date: 2018-04-07 05:23+0000\n" -"Last-Translator: Sylke Vicious , 2021\n" -"Language-Team: Italian (https://www.transifex.com/Friendica/teams/12172/it/)\n" +"Last-Translator: Sylke Vicious , 2023\n" +"Language-Team: Italian (https://app.transifex.com/Friendica/teams/12172/it/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: it\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n" #: catavatar.php:48 -msgid "Use Cat as Avatar" -msgstr "Usa il Gatto come avatar" - -#: catavatar.php:49 -msgid "More Random Cat!" -msgstr "Altro Gatto a caso!" - -#: catavatar.php:50 -msgid "Reset to email Cat" -msgstr "Reimposta Gatto" - -#: catavatar.php:52 -msgid "Cat Avatar Settings" -msgstr "Impostazioni Avatar Gatto" - -#: catavatar.php:53 msgid "Set default profile avatar or randomize the cat." msgstr "Imposta l'immagine di profilo predefinita o crea un gatto casuale." -#: catavatar.php:78 +#: catavatar.php:53 +msgid "Cat Avatar Settings" +msgstr "Impostazioni Avatar Gatto" + +#: catavatar.php:56 +msgid "Use Cat as Avatar" +msgstr "Usa il Gatto come avatar" + +#: catavatar.php:57 +msgid "Another random Cat!" +msgstr "Un altro Gatto casuale!" + +#: catavatar.php:58 +msgid "Reset to email Cat" +msgstr "Reimposta Gatto" + +#: catavatar.php:77 msgid "The cat hadn't found itself." msgstr "Il gatto non ha trovato sé stesso." -#: catavatar.php:87 +#: catavatar.php:86 msgid "There was an error, the cat ran away." msgstr "Si è verificato un errore, il gatto è scappato." -#: catavatar.php:93 +#: catavatar.php:92 msgid "Profile Photos" msgstr "Foto del profilo" -#: catavatar.php:108 +#: catavatar.php:102 msgid "Meow!" msgstr "Miao!" diff --git a/catavatar/lang/it/strings.php b/catavatar/lang/it/strings.php index 3a33374a..8f78b3fe 100644 --- a/catavatar/lang/it/strings.php +++ b/catavatar/lang/it/strings.php @@ -3,13 +3,13 @@ if(! function_exists("string_plural_select_it")) { function string_plural_select_it($n){ $n = intval($n); - return intval($n != 1); + if ($n == 1) { return 0; } else if ($n != 0 && $n % 1000000 == 0) { return 1; } else { return 2; } }} -$a->strings['Use Cat as Avatar'] = 'Usa il Gatto come avatar'; -$a->strings['More Random Cat!'] = 'Altro Gatto a caso!'; -$a->strings['Reset to email Cat'] = 'Reimposta Gatto'; -$a->strings['Cat Avatar Settings'] = 'Impostazioni Avatar Gatto'; $a->strings['Set default profile avatar or randomize the cat.'] = 'Imposta l\'immagine di profilo predefinita o crea un gatto casuale.'; +$a->strings['Cat Avatar Settings'] = 'Impostazioni Avatar Gatto'; +$a->strings['Use Cat as Avatar'] = 'Usa il Gatto come avatar'; +$a->strings['Another random Cat!'] = 'Un altro Gatto casuale!'; +$a->strings['Reset to email Cat'] = 'Reimposta Gatto'; $a->strings['The cat hadn\'t found itself.'] = 'Il gatto non ha trovato sé stesso.'; $a->strings['There was an error, the cat ran away.'] = 'Si è verificato un errore, il gatto è scappato.'; $a->strings['Profile Photos'] = 'Foto del profilo'; diff --git a/circle_text/group_text.php b/circle_text/group_text.php new file mode 100644 index 00000000..b52cbc19 --- /dev/null +++ b/circle_text/group_text.php @@ -0,0 +1,64 @@ + + */ + +use Friendica\Core\Hook; +use Friendica\Core\Renderer; +use Friendica\DI; + +function circle_text_install() +{ + Hook::register('addon_settings', __FILE__, 'circle_text_settings'); + Hook::register('addon_settings_post', __FILE__, 'circle_text_settings_post'); +} + +/** + * + * Callback from the settings post function. + * $post contains the $_POST array. + * We will make sure we've got a valid user account + * and if so set our configuration setting for this person. + * + */ + +function circle_text_settings_post(array $post) +{ + if (!DI::userSession()->getLocalUserId() || empty($post['circle_text-submit'])) { + return; + } + + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'system', 'circle_edit_image_limit', intval($post['circle_text'])); +} + + +/** + * + * Called from the Addon Setting form. + * Add our own settings info to the page. + * + */ + +function circle_text_settings(array &$data) +{ + if (!DI::userSession()->getLocalUserId()) { + return; + } + + $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'circle_edit_image_limit') ?? + DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'groupedit_image_limit'); + + $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/circle_text/'); + $html = Renderer::replaceMacros($t, [ + '$enabled' => ['circle_text', DI::l10n()->t('Use a text only (non-image) circle selector in the "circle edit" menu'), $enabled], + ]); + + $data = [ + 'addon' => 'circle_text', + 'title' => DI::l10n()->t('Circle Text'), + 'html' => $html, + ]; +} diff --git a/circle_text/lang/C/messages.po b/circle_text/lang/C/messages.po new file mode 100644 index 00000000..27c0e60e --- /dev/null +++ b/circle_text/lang/C/messages.po @@ -0,0 +1,26 @@ +# ADDON circle_text +# Copyright (C) +# This file is distributed under the same license as the Friendica circle_text addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-06-03 15:48-0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: group_text.php:56 +msgid "Use a text only (non-image) circle selector in the \"circle edit\" menu" +msgstr "" + +#: group_text.php:61 +msgid "Circle Text" +msgstr "" diff --git a/circle_text/lang/ar/messages.po b/circle_text/lang/ar/messages.po new file mode 100644 index 00000000..cfe9bb63 --- /dev/null +++ b/circle_text/lang/ar/messages.po @@ -0,0 +1,32 @@ +# ADDON group_text +# Copyright (C) +# This file is distributed under the same license as the Friendica group_text addon package. +# +# +# Translators: +# Farida Khalaf , 2021 +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2021-02-21 02:59+0000\n" +"Last-Translator: Farida Khalaf \n" +"Language-Team: Arabic (http://www.transifex.com/Friendica/friendica/language/ar/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ar\n" +"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" + +#: group_text.php:62 +msgid "Group Text" +msgstr "نص المجموعة:" + +#: group_text.php:64 +msgid "Use a text only (non-image) group selector in the \"group edit\" menu" +msgstr "استخدم محدد نصي للمجموعة فقط (غير مصور) في قائمة \"تعديل المجموعة\"" + +#: group_text.php:70 +msgid "Save Settings" +msgstr "حفظ الإعدادات" diff --git a/circle_text/lang/ar/strings.php b/circle_text/lang/ar/strings.php new file mode 100644 index 00000000..20e8496a --- /dev/null +++ b/circle_text/lang/ar/strings.php @@ -0,0 +1,10 @@ +=3 && $n%100<=10) { return 3; } else if ($n%100>=11 && $n%100<=99) { return 4; } else { return 5; } +}} +$a->strings['Group Text'] = 'نص المجموعة:'; +$a->strings['Use a text only (non-image) group selector in the "group edit" menu'] = 'استخدم محدد نصي للمجموعة فقط (غير مصور) في قائمة "تعديل المجموعة"'; +$a->strings['Save Settings'] = 'حفظ الإعدادات'; diff --git a/circle_text/lang/ca/messages.po b/circle_text/lang/ca/messages.po new file mode 100644 index 00000000..7081c0d7 --- /dev/null +++ b/circle_text/lang/ca/messages.po @@ -0,0 +1,36 @@ +# ADDON group_text +# Copyright (C) +# This file is distributed under the same license as the Friendica group_text addon package. +# +# +# Translators: +# Joan Bar , 2019 +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-02-27 05:01-0500\n" +"PO-Revision-Date: 2019-10-14 00:45+0000\n" +"Last-Translator: Joan Bar \n" +"Language-Team: Catalan (http://www.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: group_text.php:46 +msgid "Group Text settings updated." +msgstr "La configuració del text del grup s'ha actualitzat." + +#: group_text.php:76 +msgid "Group Text" +msgstr "Missatge del grup" + +#: group_text.php:78 +msgid "Use a text only (non-image) group selector in the \"group edit\" menu" +msgstr "Utilitzeu un selector de grup de només text (que no sigui una imatge) al menú 'Edita grup'" + +#: group_text.php:84 +msgid "Submit" +msgstr "sotmetre's" diff --git a/circle_text/lang/ca/strings.php b/circle_text/lang/ca/strings.php new file mode 100644 index 00000000..b28db322 --- /dev/null +++ b/circle_text/lang/ca/strings.php @@ -0,0 +1,11 @@ +strings['Group Text settings updated.'] = 'La configuració del text del grup s\'ha actualitzat.'; +$a->strings['Group Text'] = 'Missatge del grup'; +$a->strings['Use a text only (non-image) group selector in the "group edit" menu'] = 'Utilitzeu un selector de grup de només text (que no sigui una imatge) al menú \'Edita grup\''; +$a->strings['Submit'] = 'sotmetre\'s'; diff --git a/circle_text/lang/cs/messages.po b/circle_text/lang/cs/messages.po new file mode 100644 index 00000000..8b56b630 --- /dev/null +++ b/circle_text/lang/cs/messages.po @@ -0,0 +1,37 @@ +# ADDON group_text +# Copyright (C) +# This file is distributed under the same license as the Friendica group_text addon package. +# +# +# Translators: +# Aditoo, 2018 +# michal_s , 2014-2015 +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-02-27 05:01-0500\n" +"PO-Revision-Date: 2018-09-12 09:47+0000\n" +"Last-Translator: Aditoo\n" +"Language-Team: Czech (http://www.transifex.com/Friendica/friendica/language/cs/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: cs\n" +"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\n" + +#: group_text.php:46 +msgid "Group Text settings updated." +msgstr "Nastavení Group Text aktualizována." + +#: group_text.php:76 +msgid "Group Text" +msgstr "Skupinový text" + +#: group_text.php:78 +msgid "Use a text only (non-image) group selector in the \"group edit\" menu" +msgstr "Použijte pouze textový (bezobrázkový) výběr skupiny v menu úpravy skupin." + +#: group_text.php:84 +msgid "Submit" +msgstr "Odeslat" diff --git a/circle_text/lang/cs/strings.php b/circle_text/lang/cs/strings.php new file mode 100644 index 00000000..510453af --- /dev/null +++ b/circle_text/lang/cs/strings.php @@ -0,0 +1,11 @@ += 2 && $n <= 4 && $n % 1 == 0)) { return 1; } else if (($n % 1 != 0 )) { return 2; } else { return 3; } +}} +$a->strings['Group Text settings updated.'] = 'Nastavení Group Text aktualizována.'; +$a->strings['Group Text'] = 'Skupinový text'; +$a->strings['Use a text only (non-image) group selector in the "group edit" menu'] = 'Použijte pouze textový (bezobrázkový) výběr skupiny v menu úpravy skupin.'; +$a->strings['Submit'] = 'Odeslat'; diff --git a/circle_text/lang/da-dk/messages.po b/circle_text/lang/da-dk/messages.po new file mode 100644 index 00000000..9f1fbefa --- /dev/null +++ b/circle_text/lang/da-dk/messages.po @@ -0,0 +1,28 @@ +# ADDON group_text +# Copyright (C) +# This file is distributed under the same license as the Friendica group_text addon package. +# +# +# Translators: +# Anton , 2022 +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:14-0500\n" +"PO-Revision-Date: 2014-06-23 08:35+0000\n" +"Last-Translator: Anton , 2022\n" +"Language-Team: Danish (Denmark) (http://www.transifex.com/Friendica/friendica/language/da_DK/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: da_DK\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: group_text.php:58 +msgid "Use a text only (non-image) group selector in the \"group edit\" menu" +msgstr "Brug en kun-tekst (intet billede) gruppevælger i grupperedigeringsmenuen" + +#: group_text.php:63 +msgid "Group Text" +msgstr "Gruppebesked" diff --git a/circle_text/lang/da-dk/strings.php b/circle_text/lang/da-dk/strings.php new file mode 100644 index 00000000..4306b769 --- /dev/null +++ b/circle_text/lang/da-dk/strings.php @@ -0,0 +1,9 @@ +strings['Use a text only (non-image) group selector in the "group edit" menu'] = 'Brug en kun-tekst (intet billede) gruppevælger i grupperedigeringsmenuen'; +$a->strings['Group Text'] = 'Gruppebesked'; diff --git a/circle_text/lang/de/messages.po b/circle_text/lang/de/messages.po new file mode 100644 index 00000000..e4e5d782 --- /dev/null +++ b/circle_text/lang/de/messages.po @@ -0,0 +1,31 @@ +# ADDON group_text +# Copyright (C) +# This file is distributed under the same license as the Friendica group_text addon package. +# +# +# Translators: +# Andreas H., 2014 +# Tobias Diekershoff , 2014 +# Tobias Diekershoff , 2021 +# Ulf Rompe , 2019 +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:14-0500\n" +"PO-Revision-Date: 2014-06-23 08:35+0000\n" +"Last-Translator: Tobias Diekershoff , 2021\n" +"Language-Team: German (http://app.transifex.com/Friendica/friendica/language/de/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: de\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: group_text.php:58 +msgid "Use a text only (non-image) group selector in the \"group edit\" menu" +msgstr "Beim Bearbeiten von Gruppen Text statt Bilder anzeigen" + +#: group_text.php:63 +msgid "Group Text" +msgstr "Gruppen als Text" diff --git a/circle_text/lang/de/strings.php b/circle_text/lang/de/strings.php new file mode 100644 index 00000000..7a75b54d --- /dev/null +++ b/circle_text/lang/de/strings.php @@ -0,0 +1,9 @@ +strings['Use a text only (non-image) group selector in the "group edit" menu'] = 'Beim Bearbeiten von Gruppen Text statt Bilder anzeigen'; +$a->strings['Group Text'] = 'Gruppen als Text'; diff --git a/circle_text/lang/eo/strings.php b/circle_text/lang/eo/strings.php new file mode 100644 index 00000000..4e220fb0 --- /dev/null +++ b/circle_text/lang/eo/strings.php @@ -0,0 +1,5 @@ +strings["Group Text"] = ""; +$a->strings["Use a text only (non-image) group selector in the \"group edit\" menu"] = ""; +$a->strings["Submit"] = "Sendi"; diff --git a/circle_text/lang/es/messages.po b/circle_text/lang/es/messages.po new file mode 100644 index 00000000..5d6d4107 --- /dev/null +++ b/circle_text/lang/es/messages.po @@ -0,0 +1,33 @@ +# ADDON group_text +# Copyright (C) +# This file is distributed under the same license as the Friendica group_text addon package. +# +# +# Translators: +# Albert, 2016 +# Senex Petrovic , 2021 +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2021-04-01 09:56+0000\n" +"Last-Translator: Senex Petrovic \n" +"Language-Team: Spanish (http://www.transifex.com/Friendica/friendica/language/es/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: es\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: group_text.php:62 +msgid "Group Text" +msgstr "Grupo de Texto" + +#: group_text.php:64 +msgid "Use a text only (non-image) group selector in the \"group edit\" menu" +msgstr "Utilice sólo el selector de grupo de texto (no imagen) en el menú \"edición de grupo\"" + +#: group_text.php:70 +msgid "Save Settings" +msgstr "Guardar Ajustes" diff --git a/circle_text/lang/es/strings.php b/circle_text/lang/es/strings.php new file mode 100644 index 00000000..632130fd --- /dev/null +++ b/circle_text/lang/es/strings.php @@ -0,0 +1,10 @@ +strings['Group Text'] = 'Grupo de Texto'; +$a->strings['Use a text only (non-image) group selector in the "group edit" menu'] = 'Utilice sólo el selector de grupo de texto (no imagen) en el menú "edición de grupo"'; +$a->strings['Save Settings'] = 'Guardar Ajustes'; diff --git a/circle_text/lang/fi-fi/messages.po b/circle_text/lang/fi-fi/messages.po new file mode 100644 index 00000000..2e3782fd --- /dev/null +++ b/circle_text/lang/fi-fi/messages.po @@ -0,0 +1,37 @@ +# ADDON group_text +# Copyright (C) +# This file is distributed under the same license as the Friendica group_text addon package. +# +# +# Translators: +# Kris, 2018 +# Kris, 2018 +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-02-27 05:01-0500\n" +"PO-Revision-Date: 2018-04-08 15:51+0000\n" +"Last-Translator: Kris\n" +"Language-Team: Finnish (Finland) (http://www.transifex.com/Friendica/friendica/language/fi_FI/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: fi_FI\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: group_text.php:46 +msgid "Group Text settings updated." +msgstr "Group Text -asetukset päivitetty." + +#: group_text.php:76 +msgid "Group Text" +msgstr "Group Text" + +#: group_text.php:78 +msgid "Use a text only (non-image) group selector in the \"group edit\" menu" +msgstr "" + +#: group_text.php:84 +msgid "Submit" +msgstr "Lähetä" diff --git a/circle_text/lang/fi-fi/strings.php b/circle_text/lang/fi-fi/strings.php new file mode 100644 index 00000000..5bcd0ddc --- /dev/null +++ b/circle_text/lang/fi-fi/strings.php @@ -0,0 +1,10 @@ +strings['Group Text settings updated.'] = 'Group Text -asetukset päivitetty.'; +$a->strings['Group Text'] = 'Group Text'; +$a->strings['Submit'] = 'Lähetä'; diff --git a/circle_text/lang/fr/messages.po b/circle_text/lang/fr/messages.po new file mode 100644 index 00000000..c076d697 --- /dev/null +++ b/circle_text/lang/fr/messages.po @@ -0,0 +1,29 @@ +# ADDON group_text +# Copyright (C) +# This file is distributed under the same license as the Friendica group_text addon package. +# +# +# Translators: +# bob lebonche , 2021 +# Hypolite Petovan , 2016 +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:14-0500\n" +"PO-Revision-Date: 2014-06-23 08:35+0000\n" +"Last-Translator: bob lebonche , 2021\n" +"Language-Team: French (http://www.transifex.com/Friendica/friendica/language/fr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: fr\n" +"Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n" + +#: group_text.php:58 +msgid "Use a text only (non-image) group selector in the \"group edit\" menu" +msgstr "Utiliser uniquement un groupe de texte (pas d'image) dans le menu \"groupedit\"" + +#: group_text.php:63 +msgid "Group Text" +msgstr "Groupe de texte" diff --git a/circle_text/lang/fr/strings.php b/circle_text/lang/fr/strings.php new file mode 100644 index 00000000..657d7657 --- /dev/null +++ b/circle_text/lang/fr/strings.php @@ -0,0 +1,9 @@ +strings['Use a text only (non-image) group selector in the "group edit" menu'] = 'Utiliser uniquement un groupe de texte (pas d\'image) dans le menu "groupedit"'; +$a->strings['Group Text'] = 'Groupe de texte'; diff --git a/circle_text/lang/hu/messages.po b/circle_text/lang/hu/messages.po new file mode 100644 index 00000000..2c4f19c9 --- /dev/null +++ b/circle_text/lang/hu/messages.po @@ -0,0 +1,28 @@ +# ADDON group_text +# Copyright (C) +# This file is distributed under the same license as the Friendica group_text addon package. +# +# +# Translators: +# Balázs Úr, 2020-2021 +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:14-0500\n" +"PO-Revision-Date: 2014-06-23 08:35+0000\n" +"Last-Translator: Balázs Úr, 2020-2021\n" +"Language-Team: Hungarian (http://www.transifex.com/Friendica/friendica/language/hu/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: hu\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: group_text.php:58 +msgid "Use a text only (non-image) group selector in the \"group edit\" menu" +msgstr "Csak szöveges (kép nélküli) csoportválasztó használata a „csoportszerkesztés” menüben" + +#: group_text.php:63 +msgid "Group Text" +msgstr "Csoportszöveg" diff --git a/circle_text/lang/hu/strings.php b/circle_text/lang/hu/strings.php new file mode 100644 index 00000000..ac72f9e0 --- /dev/null +++ b/circle_text/lang/hu/strings.php @@ -0,0 +1,9 @@ +strings['Use a text only (non-image) group selector in the "group edit" menu'] = 'Csak szöveges (kép nélküli) csoportválasztó használata a „csoportszerkesztés” menüben'; +$a->strings['Group Text'] = 'Csoportszöveg'; diff --git a/circle_text/lang/is/strings.php b/circle_text/lang/is/strings.php new file mode 100644 index 00000000..d331b2f9 --- /dev/null +++ b/circle_text/lang/is/strings.php @@ -0,0 +1,5 @@ +strings["Group Text"] = ""; +$a->strings["Use a text only (non-image) group selector in the \"group edit\" menu"] = ""; +$a->strings["Submit"] = "Senda inn"; diff --git a/circle_text/lang/it/messages.po b/circle_text/lang/it/messages.po new file mode 100644 index 00000000..daab3fb6 --- /dev/null +++ b/circle_text/lang/it/messages.po @@ -0,0 +1,33 @@ +# ADDON group_text +# Copyright (C) +# This file is distributed under the same license as the Friendica group_text addon package. +# +# +# Translators: +# fabrixxm , 2014-2015 +# Sylke Vicious , 2021 +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2021-02-16 12:48+0000\n" +"Last-Translator: Sylke Vicious \n" +"Language-Team: Italian (http://www.transifex.com/Friendica/friendica/language/it/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: it\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: group_text.php:62 +msgid "Group Text" +msgstr "Editor Gruppi Testuale" + +#: group_text.php:64 +msgid "Use a text only (non-image) group selector in the \"group edit\" menu" +msgstr "Usa un selettore testuale (senza immagini) nella pagina \"modifica gruppo\"" + +#: group_text.php:70 +msgid "Save Settings" +msgstr "Salva Impostazioni" diff --git a/circle_text/lang/it/strings.php b/circle_text/lang/it/strings.php new file mode 100644 index 00000000..e52683e9 --- /dev/null +++ b/circle_text/lang/it/strings.php @@ -0,0 +1,10 @@ +strings['Group Text'] = 'Editor Gruppi Testuale'; +$a->strings['Use a text only (non-image) group selector in the "group edit" menu'] = 'Usa un selettore testuale (senza immagini) nella pagina "modifica gruppo"'; +$a->strings['Save Settings'] = 'Salva Impostazioni'; diff --git a/circle_text/lang/nb-no/strings.php b/circle_text/lang/nb-no/strings.php new file mode 100644 index 00000000..cd9bebd4 --- /dev/null +++ b/circle_text/lang/nb-no/strings.php @@ -0,0 +1,5 @@ +strings["Group Text"] = ""; +$a->strings["Use a text only (non-image) group selector in the \"group edit\" menu"] = ""; +$a->strings["Submit"] = "Lagre"; diff --git a/circle_text/lang/nl/messages.po b/circle_text/lang/nl/messages.po new file mode 100644 index 00000000..56b5aae0 --- /dev/null +++ b/circle_text/lang/nl/messages.po @@ -0,0 +1,36 @@ +# ADDON group_text +# Copyright (C) +# This file is distributed under the same license as the Friendica group_text addon package. +# +# +# Translators: +# Jeroen De Meerleer , 2018 +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-02-27 05:01-0500\n" +"PO-Revision-Date: 2018-08-24 13:48+0000\n" +"Last-Translator: Jeroen De Meerleer \n" +"Language-Team: Dutch (http://www.transifex.com/Friendica/friendica/language/nl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: nl\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: group_text.php:46 +msgid "Group Text settings updated." +msgstr "Groupsberichten instellingen opgeslagen" + +#: group_text.php:76 +msgid "Group Text" +msgstr "Groepsbericht" + +#: group_text.php:78 +msgid "Use a text only (non-image) group selector in the \"group edit\" menu" +msgstr "" + +#: group_text.php:84 +msgid "Submit" +msgstr "" diff --git a/circle_text/lang/nl/strings.php b/circle_text/lang/nl/strings.php new file mode 100644 index 00000000..ba3cb3ec --- /dev/null +++ b/circle_text/lang/nl/strings.php @@ -0,0 +1,9 @@ +strings['Group Text settings updated.'] = 'Groupsberichten instellingen opgeslagen'; +$a->strings['Group Text'] = 'Groepsbericht'; diff --git a/circle_text/lang/pl/messages.po b/circle_text/lang/pl/messages.po new file mode 100644 index 00000000..a1d6a3c8 --- /dev/null +++ b/circle_text/lang/pl/messages.po @@ -0,0 +1,28 @@ +# ADDON group_text +# Copyright (C) +# This file is distributed under the same license as the Friendica group_text addon package. +# +# +# Translators: +# Waldemar Stoczkowski, 2018 +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:14-0500\n" +"PO-Revision-Date: 2014-06-23 08:35+0000\n" +"Last-Translator: Waldemar Stoczkowski, 2018\n" +"Language-Team: Polish (http://www.transifex.com/Friendica/friendica/language/pl/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: pl\n" +"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n" + +#: group_text.php:58 +msgid "Use a text only (non-image) group selector in the \"group edit\" menu" +msgstr "Użyj tylko tekst (bez obrazu) selektor grupy w menu \"Edycja grupy\"" + +#: group_text.php:63 +msgid "Group Text" +msgstr "Grupuj tekst" diff --git a/circle_text/lang/pl/strings.php b/circle_text/lang/pl/strings.php new file mode 100644 index 00000000..96157c99 --- /dev/null +++ b/circle_text/lang/pl/strings.php @@ -0,0 +1,9 @@ +=2 && $n%10<=4) && ($n%100<12 || $n%100>14)) { return 1; } else if ($n!=1 && ($n%10>=0 && $n%10<=1) || ($n%10>=5 && $n%10<=9) || ($n%100>=12 && $n%100<=14)) { return 2; } else { return 3; } +}} +$a->strings['Use a text only (non-image) group selector in the "group edit" menu'] = 'Użyj tylko tekst (bez obrazu) selektor grupy w menu "Edycja grupy"'; +$a->strings['Group Text'] = 'Grupuj tekst'; diff --git a/circle_text/lang/pt-br/strings.php b/circle_text/lang/pt-br/strings.php new file mode 100644 index 00000000..4579a5b1 --- /dev/null +++ b/circle_text/lang/pt-br/strings.php @@ -0,0 +1,5 @@ +strings["Group Text"] = ""; +$a->strings["Use a text only (non-image) group selector in the \"group edit\" menu"] = ""; +$a->strings["Submit"] = "Enviar"; diff --git a/circle_text/lang/ro/messages.po b/circle_text/lang/ro/messages.po new file mode 100644 index 00000000..c912f113 --- /dev/null +++ b/circle_text/lang/ro/messages.po @@ -0,0 +1,36 @@ +# ADDON group_text +# Copyright (C) +# This file is distributed under the same license as the Friendica group_text addon package. +# +# +# Translators: +# Doru DEACONU , 2014 +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-02-27 05:01-0500\n" +"PO-Revision-Date: 2014-11-27 14:15+0000\n" +"Last-Translator: Doru DEACONU \n" +"Language-Team: Romanian (Romania) (http://www.transifex.com/projects/p/friendica/language/ro_RO/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ro_RO\n" +"Plural-Forms: nplurals=3; plural=(n==1?0:(((n%100>19)||((n%100==0)&&(n!=0)))?2:1));\n" + +#: group_text.php:46 +msgid "Group Text settings updated." +msgstr "Configurările Text Grup, au fost actualizate." + +#: group_text.php:76 +msgid "Group Text" +msgstr "Text Grup" + +#: group_text.php:78 +msgid "Use a text only (non-image) group selector in the \"group edit\" menu" +msgstr "Folosiți în meniul \"editare grup\" un selector de grup strict textual (fără-imagine)" + +#: group_text.php:84 +msgid "Submit" +msgstr "Trimite" diff --git a/circle_text/lang/ro/strings.php b/circle_text/lang/ro/strings.php new file mode 100644 index 00000000..892ffc68 --- /dev/null +++ b/circle_text/lang/ro/strings.php @@ -0,0 +1,11 @@ +19)||(($n%100==0)&&($n!=0)))) { return 2; } else { return 1; } +}} +$a->strings['Group Text settings updated.'] = 'Configurările Text Grup, au fost actualizate.'; +$a->strings['Group Text'] = 'Text Grup'; +$a->strings['Use a text only (non-image) group selector in the "group edit" menu'] = 'Folosiți în meniul "editare grup" un selector de grup strict textual (fără-imagine)'; +$a->strings['Submit'] = 'Trimite'; diff --git a/circle_text/lang/ru/messages.po b/circle_text/lang/ru/messages.po new file mode 100644 index 00000000..05a25367 --- /dev/null +++ b/circle_text/lang/ru/messages.po @@ -0,0 +1,36 @@ +# ADDON group_text +# Copyright (C) +# This file is distributed under the same license as the Friendica group_text addon package. +# +# +# Translators: +# Stanislav N. , 2017 +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-02-27 05:01-0500\n" +"PO-Revision-Date: 2017-04-08 17:26+0000\n" +"Last-Translator: Stanislav N. \n" +"Language-Team: Russian (http://www.transifex.com/Friendica/friendica/language/ru/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ru\n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" + +#: group_text.php:46 +msgid "Group Text settings updated." +msgstr "Настройки Group Text обновлены." + +#: group_text.php:76 +msgid "Group Text" +msgstr "Group Text" + +#: group_text.php:78 +msgid "Use a text only (non-image) group selector in the \"group edit\" menu" +msgstr "Используйте текстовый (не изображение) селектор группы в режиме редактирования группы" + +#: group_text.php:84 +msgid "Submit" +msgstr "Добавить" diff --git a/circle_text/lang/ru/strings.php b/circle_text/lang/ru/strings.php new file mode 100644 index 00000000..0f74e7ca --- /dev/null +++ b/circle_text/lang/ru/strings.php @@ -0,0 +1,11 @@ +=2 && $n%10<=4 && ($n%100<12 || $n%100>14)) { return 1; } else if ($n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)) { return 2; } else { return 3; } +}} +$a->strings['Group Text settings updated.'] = 'Настройки Group Text обновлены.'; +$a->strings['Group Text'] = 'Group Text'; +$a->strings['Use a text only (non-image) group selector in the "group edit" menu'] = 'Используйте текстовый (не изображение) селектор группы в режиме редактирования группы'; +$a->strings['Submit'] = 'Добавить'; diff --git a/circle_text/lang/sv/messages.po b/circle_text/lang/sv/messages.po new file mode 100644 index 00000000..8ddc1806 --- /dev/null +++ b/circle_text/lang/sv/messages.po @@ -0,0 +1,28 @@ +# ADDON group_text +# Copyright (C) +# This file is distributed under the same license as the Friendica group_text addon package. +# +# +# Translators: +# Kristoffer Grundström , 2022 +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:14-0500\n" +"PO-Revision-Date: 2022-01-16 00:35+0000\n" +"Last-Translator: Kristoffer Grundström \n" +"Language-Team: Swedish (http://www.transifex.com/Friendica/friendica/language/sv/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: sv\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: group_text.php:58 +msgid "Use a text only (non-image) group selector in the \"group edit\" menu" +msgstr "" + +#: group_text.php:63 +msgid "Group Text" +msgstr "Grupptext" diff --git a/circle_text/lang/sv/strings.php b/circle_text/lang/sv/strings.php new file mode 100644 index 00000000..5d5e98db --- /dev/null +++ b/circle_text/lang/sv/strings.php @@ -0,0 +1,8 @@ +strings['Group Text'] = 'Grupptext'; diff --git a/circle_text/lang/zh-cn/strings.php b/circle_text/lang/zh-cn/strings.php new file mode 100644 index 00000000..a7b37bf2 --- /dev/null +++ b/circle_text/lang/zh-cn/strings.php @@ -0,0 +1,6 @@ +strings["Group Text settings updated."] = "组正文设置更新了。"; +$a->strings["Group Text"] = "组正文"; +$a->strings["Use a text only (non-image) group selector in the \"group edit\" menu"] = "用光正文(无图片)组选择器在「组编辑」单"; +$a->strings["Submit"] = "提交"; diff --git a/circle_text/templates/settings.tpl b/circle_text/templates/settings.tpl new file mode 100644 index 00000000..2f3f4ce7 --- /dev/null +++ b/circle_text/templates/settings.tpl @@ -0,0 +1 @@ +{{include file="field_checkbox.tpl" field=$enabled}} diff --git a/cld/README.md b/cld/README.md new file mode 100644 index 00000000..933dbcee --- /dev/null +++ b/cld/README.md @@ -0,0 +1,85 @@ +Compact Language Detector +=== +CLD2 is an advanced language dectection library with a high reliability. + +This addon depends on the CLD PHP module which is not included in any Linux distribution. +It needs to be built and installed by hand, which is not totally straightforward. + +Prerequisite +--- +To be able to build the extension, you need the CLD module and the files for the PHP module development. +On Debian you install the packages php-dev, libcld2-dev and libcld2-0. +Make sure to have installed the correct PHP version. +Means: When you have got both PHP 8.0 and 8.2 on your system, you have to install php8.0-dev as well. + +Installation +--- +The original PHP extension is https://github.com/fntlnz/cld2-php-ext. +However, it doesn't support PHP8. +So https://github.com/hiteule/cld2-php-ext/tree/support-php8 has to be used. + +Download the source code: +``` +wget https://github.com/hiteule/cld2-php-ext/archive/refs/heads/support-php8.zip +``` + +Unzip it: +``` +unzip support-php8.zip +``` + +Change into the folder: +``` +cd cld2-php-ext-support-php8/ +``` + +Configure for the PHP Api version: +``` +phpize +``` +(if you have got several PHP versions on your system, execute the command with the version that you run Friendica with, e.g. `phpize8.0`) + +Create the Makefile: +``` +./configure --with-cld2=/usr/include/cld2 +``` + +Have a look at the line `checking for PHP includes`. +When the output (for example `/usr/include/php/20220829` doesn't match the API version that you got from `phpize`, then you have to change all the version codes in your `Makefile` afterwards) + +Create the module: +``` +make -j +``` + +Install it: +``` +sudo make install +``` + +Change to the folder with the available modules. When you use PHP 8.2 on Debian it is: +``` +cd /etc/php/8.2/mods-available +``` + +Create the file `cld2.ini` with this content: +``` +; configuration for php cld2 module +; priority=20 +extension=cld2.so +``` + +Enable the module for all versions and all sapi: +``` +phpenmod -v ALL -s ALL cld2 +``` + +Then restart the apache or fpm (or whatever you use) to load the changed configuration. + +Call `/admin/phpinfo` on your webserver. +You then see the PHP Info. +Search for "cld2". +The module is installed, when you find it here. +**Only proceed when the module is installed** + +Now you can enable the addon. \ No newline at end of file diff --git a/cld/cld.php b/cld/cld.php new file mode 100644 index 00000000..d4fef6c5 --- /dev/null +++ b/cld/cld.php @@ -0,0 +1,80 @@ + + */ + +use Friendica\Core\Hook; +use Friendica\DI; + +function cld_install() +{ + Hook::register('detect_languages', __FILE__, 'cld_detect_languages'); +} + +function cld_detect_languages(array &$data) +{ + if (!in_array('cld2', get_loaded_extensions())) { + DI::logger()->warning('CLD2 is not installed.'); + return; + } + + if (!class_exists('CLD2Detector')) { + DI::logger()->warning('CLD2Detector class does not exist.'); + return; + } + + if (!class_exists('CLD2Encoding')) { + DI::logger()->warning('CLD2Encoding class does not exist.'); + return; + } + + $cld2 = new \CLD2Detector(); + + $cld2->setEncodingHint(CLD2Encoding::UTF8); // optional, hints about text encoding + $cld2->setPlainText(true); + + $result = $cld2->detect($data['text']); + + if ($data['detected']) { + $original = array_key_first($data['detected']); + } else { + $original = ''; + } + + $detected = DI::l10n()->toISO6391($result['language_code']); + + // languages that aren't supported via the base language detection or tend to false detections + if ((strlen($detected) == 3) || in_array($detected, ['ht', 'kk', 'ku', 'ky', 'lg', 'mg', 'mk', 'mt', 'ny', 'rw', 'st', 'su', 'tg', 'ts', 'xx'])) { + return; + } + + if (!$result['is_reliable']) { + DI::logger()->debug('Unreliable detection', ['uri-id' => $data['uri-id'], 'original' => $original, 'detected' => $detected, 'name' => $result['language_name'], 'probability' => $result['language_probability'], 'text' => $data['text']]); + if (($original == $detected) && ($data['detected'][$original] < $result['language_probability'] / 100)) { + $data['detected'][$original] = $result['language_probability'] / 100; + } + return; + } + + $available = array_keys(DI::l10n()->getLanguageCodes()); + + if (!in_array($detected, $available)) { + DI::logger()->debug('Unsupported language', ['uri-id' => $data['uri-id'], 'original' => $original, 'detected' => $detected, 'name' => $result['language_name'], 'probability' => $result['language_probability'], 'text' => $data['text']]); + return; + } + + if ($original != $detected) { + DI::logger()->debug('Detected different language', ['uri-id' => $data['uri-id'], 'original' => $original, 'detected' => $detected, 'name' => $result['language_name'], 'probability' => $result['language_probability'], 'text' => $data['text']]); + } + + $length = count($data['detected']); + if ($length > 0) { + unset($data['detected'][$detected]); + $data['detected'] = array_merge([$detected => $result['language_probability'] / 100], array_slice($data['detected'], 0, $length - 1)); + } else { + $data['detected'] = [$detected => $result['language_probability'] / 100]; + } +} diff --git a/convert/UnitConvertor.php b/convert/UnitConvertor.php index d7933a8f..a3650e9b 100644 --- a/convert/UnitConvertor.php +++ b/convert/UnitConvertor.php @@ -169,7 +169,6 @@ class UnitConvertor * @param string name of the source unit from which to convert * @param string name of the target unit to which we are converting * @param integer double precision of the end result - * @return void * @access public */ function convert($value, $from_unit, $to_unit, $precision) @@ -280,4 +279,4 @@ class UnitConvertor } // end func getConvSpecs } // end class UnitConvertor -?> \ No newline at end of file +?> diff --git a/convert/convert.php b/convert/convert.php index 57ce6ea8..2545974c 100644 --- a/convert/convert.php +++ b/convert/convert.php @@ -6,7 +6,6 @@ * Author: Mike Macgirvin */ -use Friendica\App; use Friendica\Core\Hook; function convert_install() { @@ -26,7 +25,7 @@ function convert_content() { // @TODO Let's one day rewrite this to a modern composer package include 'UnitConvertor.php'; - class TP_Converter extends UnitConvertor + $conv = new class('en') extends UnitConvertor { public function __construct(string $lang = 'en') { @@ -43,7 +42,7 @@ function convert_content() { private function findBaseUnit($from, $to) { - while (list($skey, $sval) = each($this->bases)) { + foreach ($this->bases as $skey => $sval) { if ($skey == $from || $to == $skey || in_array($to, $sval) || in_array($from, $sval)) { return $skey; } @@ -63,7 +62,7 @@ function convert_content() { $cells[] = $cell; // We now have the base unit and value now lets produce the table; - while (list($key, $val) = each($this->bases[$base_unit])) { + foreach ($this->bases[$base_unit] as $val) { $cell ['value'] = $this->convert($value, $from_unit, $val, $precision) . ' ' . $val; $cell ['class'] = ($val == $from_unit || $val == $to_unit) ? 'framedred' : ''; $cells[] = $cell; @@ -86,9 +85,7 @@ function convert_content() { return $string; } - } - - $conv = new TP_Converter('en'); + }; $conversions = [ 'Temperature' => ['base' => 'Celsius', @@ -176,15 +173,15 @@ function convert_content() { ] ]; - while (list($key, $val) = each($conversions)) { + foreach ($conversions as $key => $val) { $conv->addConversion($val['base'], $val['conv']); $list[$key][] = $val['base']; - while (list($ukey, $uval) = each($val['conv'])) { + foreach ($val['conv'] as $ukey => $uval) { $list[$key][] = $ukey; } } - $o .= '

Unit Conversions

'; + $o = '

Unit Conversions

'; if (isset($_POST['from_unit']) && isset($_POST['value'])) { $o .= ($conv->getTable(intval($_POST['value']), $_POST['from_unit'], $_POST['to_unit'], 5)) . '

'; @@ -202,10 +199,9 @@ function convert_content() { $o .= ''; $o .= ' diff --git a/invidious/templates/settings.tpl b/invidious/templates/settings.tpl new file mode 100644 index 00000000..387286ef --- /dev/null +++ b/invidious/templates/settings.tpl @@ -0,0 +1,2 @@ +{{include file="field_checkbox.tpl" field=$enabled}} +{{include file="field_input.tpl" field=$server}} diff --git a/irc/irc.php b/irc/irc.php index d4435851..db808a99 100644 --- a/irc/irc.php +++ b/irc/irc.php @@ -7,7 +7,6 @@ * Author: Tobias Diekershoff */ -use Friendica\App; use Friendica\Core\Hook; use Friendica\Core\Renderer; use Friendica\DI; diff --git a/irc/lang/bg/messages.po b/irc/lang/bg/messages.po new file mode 100644 index 00000000..6c227e4c --- /dev/null +++ b/irc/lang/bg/messages.po @@ -0,0 +1,62 @@ +# ADDON irc +# Copyright (C) +# This file is distributed under the same license as the Friendica irc addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:14-0500\n" +"PO-Revision-Date: 2014-06-23 08:41+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: irc.php:32 +msgid "" +"Here you can change the system wide settings for the channels to " +"automatically join and access via the side bar. Note the changes you do " +"here, only effect the channel selection if you are logged in." +msgstr "" + +#: irc.php:33 irc.php:133 +msgid "Channel(s) to auto connect (comma separated)" +msgstr "" + +#: irc.php:33 irc.php:133 +msgid "" +"List of channels that shall automatically connected to when the app is " +"launched." +msgstr "" + +#: irc.php:34 irc.php:134 +msgid "Popular Channels (comma separated)" +msgstr "" + +#: irc.php:34 irc.php:134 +msgid "" +"List of popular channels, will be displayed at the side and hotlinked for " +"easy joining." +msgstr "" + +#: irc.php:39 +msgid "IRC Settings" +msgstr "" + +#: irc.php:60 +msgid "IRC Chatroom" +msgstr "" + +#: irc.php:88 +msgid "Popular Channels" +msgstr "" + +#: irc.php:132 +msgid "Save Settings" +msgstr "" diff --git a/irc/lang/bg/strings.php b/irc/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/irc/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: irc.php:32 +msgid "" +"Here you can change the system wide settings for the channels to " +"automatically join and access via the side bar. Note the changes you do " +"here, only effect the channel selection if you are logged in." +msgstr "" + +#: irc.php:33 irc.php:133 +msgid "Channel(s) to auto connect (comma separated)" +msgstr "" + +#: irc.php:33 irc.php:133 +msgid "" +"List of channels that shall automatically connected to when the app is " +"launched." +msgstr "" + +#: irc.php:34 irc.php:134 +msgid "Popular Channels (comma separated)" +msgstr "" + +#: irc.php:34 irc.php:134 +msgid "" +"List of popular channels, will be displayed at the side and hotlinked for " +"easy joining." +msgstr "" + +#: irc.php:39 +msgid "IRC Settings" +msgstr "" + +#: irc.php:60 +msgid "IRC Chatroom" +msgstr "" + +#: irc.php:88 +msgid "Popular Channels" +msgstr "" + +#: irc.php:132 +msgid "Save Settings" +msgstr "" diff --git a/irc/lang/ca/strings.php b/irc/lang/ca/strings.php index 561e24c0..d34874f6 100644 --- a/irc/lang/ca/strings.php +++ b/irc/lang/ca/strings.php @@ -1,9 +1,7 @@ -strings["IRC Settings"] = "Ajustos de IRC"; -$a->strings["Channel(s) to auto connect (comma separated)"] = "Canal(s) per auto connectar (separats per comes)"; -$a->strings["Popular Channels (comma separated)"] = "Canals Populars (separats per comes)"; -$a->strings["Submit"] = "Enviar"; -$a->strings["IRC settings saved."] = "Ajustos del IRC guardats."; -$a->strings["IRC Chatroom"] = "IRC Chatroom"; -$a->strings["Popular Channels"] = "Canals Populars"; +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: irc.php:32 +msgid "" +"Here you can change the system wide settings for the channels to " +"automatically join and access via the side bar. Note the changes you do " +"here, only effect the channel selection if you are logged in." +msgstr "" + +#: irc.php:33 irc.php:133 +msgid "Channel(s) to auto connect (comma separated)" +msgstr "" + +#: irc.php:33 irc.php:133 +msgid "" +"List of channels that shall automatically connected to when the app is " +"launched." +msgstr "" + +#: irc.php:34 irc.php:134 +msgid "Popular Channels (comma separated)" +msgstr "" + +#: irc.php:34 irc.php:134 +msgid "" +"List of popular channels, will be displayed at the side and hotlinked for " +"easy joining." +msgstr "" + +#: irc.php:39 +msgid "IRC Settings" +msgstr "" + +#: irc.php:60 +msgid "IRC Chatroom" +msgstr "" + +#: irc.php:88 +msgid "Popular Channels" +msgstr "" + +#: irc.php:132 +msgid "Save Settings" +msgstr "" diff --git a/irc/lang/eo/strings.php b/irc/lang/eo/strings.php index 92dee9e1..68e8a64c 100644 --- a/irc/lang/eo/strings.php +++ b/irc/lang/eo/strings.php @@ -1,9 +1,7 @@ -strings["IRC Settings"] = "IRC Agordoj"; -$a->strings["Channel(s) to auto connect (comma separated)"] = "Aŭtomate konektiĝi al la kanalo(j) (disigita per komo)"; -$a->strings["Popular Channels (comma separated)"] = "Popularaj kanaloj (disigita per komo)"; -$a->strings["Submit"] = "Sendi"; -$a->strings["IRC settings saved."] = "IRC agordoj konservitaj."; -$a->strings["IRC Chatroom"] = "IRC babilejo"; -$a->strings["Popular Channels"] = "Popularaj Kanaloj"; +\n" +"Language-Team: Estonian (http://app.transifex.com/Friendica/friendica/language/et/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: et\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: irc.php:32 +msgid "" +"Here you can change the system wide settings for the channels to " +"automatically join and access via the side bar. Note the changes you do " +"here, only effect the channel selection if you are logged in." +msgstr "" + +#: irc.php:33 irc.php:133 +msgid "Channel(s) to auto connect (comma separated)" +msgstr "" + +#: irc.php:33 irc.php:133 +msgid "" +"List of channels that shall automatically connected to when the app is " +"launched." +msgstr "" + +#: irc.php:34 irc.php:134 +msgid "Popular Channels (comma separated)" +msgstr "" + +#: irc.php:34 irc.php:134 +msgid "" +"List of popular channels, will be displayed at the side and hotlinked for " +"easy joining." +msgstr "" + +#: irc.php:39 +msgid "IRC Settings" +msgstr "" + +#: irc.php:60 +msgid "IRC Chatroom" +msgstr "" + +#: irc.php:88 +msgid "Popular Channels" +msgstr "" + +#: irc.php:132 +msgid "Save Settings" +msgstr "" diff --git a/irc/lang/et/strings.php b/irc/lang/et/strings.php new file mode 100644 index 00000000..dfe78358 --- /dev/null +++ b/irc/lang/et/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: irc.php:32 +msgid "" +"Here you can change the system wide settings for the channels to " +"automatically join and access via the side bar. Note the changes you do " +"here, only effect the channel selection if you are logged in." +msgstr "" + +#: irc.php:33 irc.php:133 +msgid "Channel(s) to auto connect (comma separated)" +msgstr "" + +#: irc.php:33 irc.php:133 +msgid "" +"List of channels that shall automatically connected to when the app is " +"launched." +msgstr "" + +#: irc.php:34 irc.php:134 +msgid "Popular Channels (comma separated)" +msgstr "" + +#: irc.php:34 irc.php:134 +msgid "" +"List of popular channels, will be displayed at the side and hotlinked for " +"easy joining." +msgstr "" + +#: irc.php:39 +msgid "IRC Settings" +msgstr "" + +#: irc.php:60 +msgid "IRC Chatroom" +msgstr "" + +#: irc.php:88 +msgid "Popular Channels" +msgstr "" + +#: irc.php:132 +msgid "Save Settings" +msgstr "" diff --git a/irc/lang/gd/strings.php b/irc/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/irc/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/irc/lang/is/messages.po b/irc/lang/is/messages.po new file mode 100644 index 00000000..3b28f0d0 --- /dev/null +++ b/irc/lang/is/messages.po @@ -0,0 +1,62 @@ +# ADDON irc +# Copyright (C) +# This file is distributed under the same license as the Friendica irc addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:14-0500\n" +"PO-Revision-Date: 2014-06-23 08:41+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: irc.php:32 +msgid "" +"Here you can change the system wide settings for the channels to " +"automatically join and access via the side bar. Note the changes you do " +"here, only effect the channel selection if you are logged in." +msgstr "" + +#: irc.php:33 irc.php:133 +msgid "Channel(s) to auto connect (comma separated)" +msgstr "" + +#: irc.php:33 irc.php:133 +msgid "" +"List of channels that shall automatically connected to when the app is " +"launched." +msgstr "" + +#: irc.php:34 irc.php:134 +msgid "Popular Channels (comma separated)" +msgstr "" + +#: irc.php:34 irc.php:134 +msgid "" +"List of popular channels, will be displayed at the side and hotlinked for " +"easy joining." +msgstr "" + +#: irc.php:39 +msgid "IRC Settings" +msgstr "" + +#: irc.php:60 +msgid "IRC Chatroom" +msgstr "" + +#: irc.php:88 +msgid "Popular Channels" +msgstr "" + +#: irc.php:132 +msgid "Save Settings" +msgstr "" diff --git a/irc/lang/is/strings.php b/irc/lang/is/strings.php index d4fbd85d..975c341e 100644 --- a/irc/lang/is/strings.php +++ b/irc/lang/is/strings.php @@ -1,9 +1,7 @@ -strings["IRC Settings"] = "IRC stillingar"; -$a->strings["Channel(s) to auto connect (comma separated)"] = "Tengjast rásum sjálfkrafa (komma á milli)"; -$a->strings["Popular Channels (comma separated)"] = "Vinsælar rásir (komma á milli)"; -$a->strings["Submit"] = "Senda inn"; -$a->strings["IRC settings saved."] = "IRC stillingum vistað"; -$a->strings["IRC Chatroom"] = ""; -$a->strings["Popular Channels"] = ""; +\n" +"Language-Team: Russian (http://app.transifex.com/Friendica/friendica/language/ru/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ru\n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" + +#: irc.php:32 +msgid "" +"Here you can change the system wide settings for the channels to " +"automatically join and access via the side bar. Note the changes you do " +"here, only effect the channel selection if you are logged in." +msgstr "" + +#: irc.php:33 irc.php:133 +msgid "Channel(s) to auto connect (comma separated)" +msgstr "" + +#: irc.php:33 irc.php:133 +msgid "" +"List of channels that shall automatically connected to when the app is " +"launched." +msgstr "" + +#: irc.php:34 irc.php:134 +msgid "Popular Channels (comma separated)" +msgstr "" + +#: irc.php:34 irc.php:134 +msgid "" +"List of popular channels, will be displayed at the side and hotlinked for " +"easy joining." +msgstr "" + +#: irc.php:39 +msgid "IRC Settings" +msgstr "" + +#: irc.php:60 +msgid "IRC Chatroom" +msgstr "" + +#: irc.php:88 +msgid "Popular Channels" +msgstr "" + +#: irc.php:132 +msgid "Save Settings" +msgstr "" diff --git a/irc/lang/ru/strings.php b/irc/lang/ru/strings.php index 84131f0b..0579fc21 100644 --- a/irc/lang/ru/strings.php +++ b/irc/lang/ru/strings.php @@ -1,9 +1,7 @@ -strings["IRC Settings"] = ""; -$a->strings["Channel(s) to auto connect (comma separated)"] = ""; -$a->strings["Popular Channels (comma separated)"] = ""; -$a->strings["Submit"] = "Подтвердить"; -$a->strings["IRC settings saved."] = ""; -$a->strings["IRC Chatroom"] = ""; -$a->strings["Popular Channels"] = ""; +=2 && $n%10<=4 && ($n%100<12 || $n%100>14)) { return 1; } else if ($n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)) { return 2; } else { return 3; } +}} diff --git a/js_upload/file-uploader/server/php.php b/js_upload/file-uploader/server/php.php index 2248c8f0..ff485dec 100644 --- a/js_upload/file-uploader/server/php.php +++ b/js_upload/file-uploader/server/php.php @@ -77,10 +77,10 @@ class qqFileUploader { public function __construct(array $allowedExtensions = [], $sizeLimit = 10485760) { $allowedExtensions = array_map('strtolower', $allowedExtensions); - + $this->allowedExtensions = $allowedExtensions; $this->sizeLimit = $sizeLimit; - + $this->checkServerSettings(); if (isset($_GET['qqfile'])) { @@ -88,7 +88,7 @@ class qqFileUploader { } elseif (isset($_FILES['qqfile'])) { $this->file = new qqUploadedFileForm(); } else { - $this->file = false; + $this->file = false; } } @@ -105,7 +105,7 @@ class qqFileUploader { private function toBytes(string $str): int { - $val = trim($str); + $val = (int) trim($str); $last = strtolower($str[strlen($str) - 1]); switch($last) { diff --git a/js_upload/file-uploader/tests/action-acceptance.php b/js_upload/file-uploader/tests/action-acceptance.php index fc9583f2..172b8857 100644 --- a/js_upload/file-uploader/tests/action-acceptance.php +++ b/js_upload/file-uploader/tests/action-acceptance.php @@ -2,12 +2,12 @@ usleep(100000); -$fileName; -$fileSize; +$fileName = ''; +$fileSize = 0;; if (isset($_GET['qqfile'])){ $fileName = $_GET['qqfile']; - + // xhr request $headers = apache_request_headers(); $fileSize = (int)$headers['Content-Length']; @@ -34,13 +34,13 @@ if ($fileSize > 9 * 1024){ die ('{error: "server-error file size is bigger than 9kB"}'); } -if (count($_GET)){ +if (count($_GET)){ array_merge($_GET, array('fileName'=>$fileName)); - + $response = array_merge($_GET, array('success'=>true, 'fileName'=>$fileName)); - - // to pass data through iframe you will need to encode all html tags - echo htmlspecialchars(json_encode($response), ENT_NOQUOTES); + + // to pass data through iframe you will need to encode all html tags + echo htmlspecialchars(json_encode($response), ENT_NOQUOTES); } else { die ('{error: "server-error query params not passed"}'); } diff --git a/js_upload/file-uploader/tests/action-handler-queue-test.php b/js_upload/file-uploader/tests/action-handler-queue-test.php index ff13576d..78760d64 100644 --- a/js_upload/file-uploader/tests/action-handler-queue-test.php +++ b/js_upload/file-uploader/tests/action-handler-queue-test.php @@ -2,11 +2,11 @@ sleep(4); -$fileName; +$fileName = ''; if (isset($_GET['qqfile'])){ $fileName = $_GET['qqfile']; - + // xhr request $headers = apache_request_headers(); if ((int)$headers['Content-Length'] == 0){ @@ -14,7 +14,7 @@ if (isset($_GET['qqfile'])){ } } elseif (isset($_FILES['qqfile'])){ $fileName = basename($_FILES['qqfile']['name']); - + // form request if ($_FILES['qqfile']['size'] == 0){ die ('{error: "file size is zero"}'); @@ -25,7 +25,7 @@ if (isset($_GET['qqfile'])){ if (count($_GET)){ $_GET['success'] = true; - echo json_encode(array_merge($_GET)); + echo json_encode(array_merge($_GET)); } else { die ('{error: "query params not passed"}'); } diff --git a/js_upload/file-uploader/tests/action-handler-test.php b/js_upload/file-uploader/tests/action-handler-test.php index 24466b12..9fa72023 100644 --- a/js_upload/file-uploader/tests/action-handler-test.php +++ b/js_upload/file-uploader/tests/action-handler-test.php @@ -2,11 +2,11 @@ usleep(300); -$fileName; +$fileName = ''; if (isset($_GET['qqfile'])){ $fileName = $_GET['qqfile']; - + // xhr request $headers = apache_request_headers(); if ((int)$headers['Content-Length'] == 0){ @@ -14,7 +14,7 @@ if (isset($_GET['qqfile'])){ } } elseif (isset($_FILES['qqfile'])){ $fileName = basename($_FILES['qqfile']['name']); - + // form request if ($_FILES['qqfile']['size'] == 0){ die ('{error: "file size is zero"}'); @@ -25,7 +25,7 @@ if (isset($_GET['qqfile'])){ if (count($_GET)){ //return query params - echo json_encode(array_merge($_GET, array('fileName'=>$fileName))); + echo json_encode(array_merge($_GET, array('fileName'=>$fileName))); } else { die ('{error: "query params not passed"}'); } diff --git a/js_upload/js_upload.php b/js_upload/js_upload.php index 089cb7e2..4bf91de1 100644 --- a/js_upload/js_upload.php +++ b/js_upload/js_upload.php @@ -7,11 +7,10 @@ * Maintainer: Hypolite Petovan */ -use Friendica\App; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; +use Friendica\Util\Images; use Friendica\Util\Strings; global $js_upload_jsonresponse; @@ -20,9 +19,9 @@ global $js_upload_result; function js_upload_install() { Hook::register('photo_upload_form', __FILE__, 'js_upload_form'); - Hook::register('photo_post_init', __FILE__, 'js_upload_post_init'); - Hook::register('photo_post_file', __FILE__, 'js_upload_post_file'); - Hook::register('photo_post_end', __FILE__, 'js_upload_post_end'); + Hook::register('photo_post_init', __FILE__, 'js_upload_post_init'); + Hook::register('photo_post_file', __FILE__, 'js_upload_post_file'); + Hook::register('photo_post_end', __FILE__, 'js_upload_post_end'); } function js_upload_form(array &$b) @@ -34,11 +33,11 @@ function js_upload_form(array &$b) $tpl = Renderer::getMarkupTemplate('js_upload.tpl', 'addon/js_upload'); $b['addon_text'] .= Renderer::replaceMacros($tpl, [ - '$upload_msg' => DI::l10n()->t('Select files for upload'), - '$drop_msg' => DI::l10n()->t('Drop files here to upload'), - '$cancel' => DI::l10n()->t('Cancel'), - '$failed' => DI::l10n()->t('Failed'), - '$post_url' => $b['post_url'], + '$upload_msg' => DI::l10n()->t('Select files for upload'), + '$drop_msg' => DI::l10n()->t('Drop files here to upload'), + '$cancel' => DI::l10n()->t('Cancel'), + '$failed' => DI::l10n()->t('Failed'), + '$post_url' => $b['post_url'], '$maximagesize' => Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')), ]); } @@ -48,12 +47,19 @@ function js_upload_post_init(array &$b) global $js_upload_result, $js_upload_jsonresponse; // list of valid extensions - $allowedExtensions = ['jpeg', 'gif', 'png', 'jpg']; + $allowedExtensions = []; + foreach (Images::IMAGETYPES as $type) { + $extension = image_type_to_extension($type, false); + if ($extension == 'jpeg') { + $allowedExtensions[] = 'jpg'; + } + $allowedExtensions[] = $extension; + } // max file size in bytes $sizeLimit = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')); - $uploader = new qqFileUploader($allowedExtensions, $sizeLimit); + $uploader = new js_upload_qqFileUploader($allowedExtensions, $sizeLimit); $result = $uploader->handleUpload(); @@ -61,7 +67,7 @@ function js_upload_post_init(array &$b) $js_upload_jsonresponse = htmlspecialchars(json_encode($result), ENT_NOQUOTES); if (isset($result['error'])) { - Logger::info('mod/photos.php: photos_post(): error uploading photo: ' . $result['error']); + DI::logger()->info('mod/photos.php: photos_post(): error uploading photo: ' . $result['error']); echo json_encode($result); exit(); } @@ -75,17 +81,16 @@ function js_upload_post_file(array &$b) $result = $js_upload_result; - $b['src'] = $result['path']; + $b['src'] = $result['path']; $b['filename'] = $result['filename']; $b['filesize'] = filesize($b['src']); - } function js_upload_post_end(int &$b) { global $js_upload_jsonresponse; - Logger::notice('upload_post_end'); + DI::logger()->notice('upload_post_end'); if (!empty($js_upload_jsonresponse)) { echo $js_upload_jsonresponse; exit(); @@ -95,7 +100,7 @@ function js_upload_post_end(int &$b) /** * Handle file uploads via XMLHttpRequest */ -class qqUploadedFileXhr +class js_upload_qqUploadedFileXhr { private $pathnm = ''; @@ -149,7 +154,7 @@ class qqUploadedFileXhr /** * Handle file uploads via regular form post (uses the $_FILES array) */ -class qqUploadedFileForm +class js_upload_qqUploadedFileForm { /** * Save the file to the specified path @@ -177,13 +182,17 @@ class qqUploadedFileForm } } -class qqFileUploader +class js_upload_qqFileUploader { - private $allowedExtensions = []; - private $sizeLimit = 10485760; + private $allowedExtensions; + private $sizeLimit; + + /** + * @var js_upload_qqUploadedFileXhr|js_upload_qqUploadedFileForm|false + */ private $file; - function __construct(array $allowedExtensions = [], $sizeLimit = 10485760) + function __construct(array $allowedExtensions = [], $sizeLimit) { $allowedExtensions = array_map('strtolower', $allowedExtensions); @@ -191,13 +200,12 @@ class qqFileUploader $this->sizeLimit = $sizeLimit; if (isset($_GET['qqfile'])) { - $this->file = new qqUploadedFileXhr(); + $this->file = new js_upload_qqUploadedFileXhr(); } elseif (isset($_FILES['qqfile'])) { - $this->file = new qqUploadedFileForm(); + $this->file = new js_upload_qqUploadedFileForm(); } else { $this->file = false; } - } /** @@ -215,11 +223,9 @@ class qqFileUploader return ['error' => DI::l10n()->t('Uploaded file is empty')]; } -// if ($size > $this->sizeLimit) { - -// return array('error' => DI::l10n()->t('Uploaded file is too large')); -// } - + // if ($size > $this->sizeLimit) { + // return array('error' => DI::l10n()->t('Uploaded file is too large')); + // } $maximagesize = Strings::getBytesFromShorthand(DI::config()->get('system', 'maximagesize')); @@ -231,7 +237,7 @@ class qqFileUploader $filename = $pathinfo['filename']; if (!isset($pathinfo['extension'])) { - Logger::warning('extension isn\'t set.', ['filename' => $filename]); + DI::logger()->warning('extension isn\'t set.', ['filename' => $filename]); } $ext = $pathinfo['extension'] ?? ''; @@ -241,14 +247,14 @@ class qqFileUploader if ($this->file->save()) { return [ - 'success' => true, - 'path' => $this->file->getPath(), + 'success' => true, + 'path' => $this->file->getPath(), 'filename' => $filename . '.' . $ext ]; } else { return [ - 'error' => DI::l10n()->t('Upload was cancelled, or server error encountered'), - 'path' => $this->file->getPath(), + 'error' => DI::l10n()->t('Upload was cancelled, or server error encountered'), + 'path' => $this->file->getPath(), 'filename' => $filename . '.' . $ext ]; } diff --git a/js_upload/lang/C/messages.po b/js_upload/lang/C/messages.po index 4d16fe17..0d607bd5 100644 --- a/js_upload/lang/C/messages.po +++ b/js_upload/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-03-23 23:53-0400\n" +"POT-Creation-Date: 2023-06-03 15:49-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,40 +17,40 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: js_upload.php:34 +#: js_upload.php:37 msgid "Select files for upload" msgstr "" -#: js_upload.php:35 +#: js_upload.php:38 msgid "Drop files here to upload" msgstr "" -#: js_upload.php:36 +#: js_upload.php:39 msgid "Cancel" msgstr "" -#: js_upload.php:37 +#: js_upload.php:40 msgid "Failed" msgstr "" -#: js_upload.php:215 +#: js_upload.php:209 msgid "No files were uploaded." msgstr "" -#: js_upload.php:221 +#: js_upload.php:215 msgid "Uploaded file is empty" msgstr "" -#: js_upload.php:233 +#: js_upload.php:227 #, php-format msgid "Image exceeds size limit of %s" msgstr "" -#: js_upload.php:245 +#: js_upload.php:239 #, php-format msgid "File has an invalid extension, it should be one of %s." msgstr "" -#: js_upload.php:256 +#: js_upload.php:250 msgid "Upload was cancelled, or server error encountered" msgstr "" diff --git a/js_upload/lang/bg/messages.po b/js_upload/lang/bg/messages.po new file mode 100644 index 00000000..65274d18 --- /dev/null +++ b/js_upload/lang/bg/messages.po @@ -0,0 +1,57 @@ +# ADDON js_upload +# Copyright (C) +# This file is distributed under the same license as the Friendica js_upload addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-06-03 15:49-0400\n" +"PO-Revision-Date: 2014-06-23 08:46+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: js_upload.php:37 +msgid "Select files for upload" +msgstr "" + +#: js_upload.php:38 +msgid "Drop files here to upload" +msgstr "" + +#: js_upload.php:39 +msgid "Cancel" +msgstr "" + +#: js_upload.php:40 +msgid "Failed" +msgstr "" + +#: js_upload.php:209 +msgid "No files were uploaded." +msgstr "" + +#: js_upload.php:215 +msgid "Uploaded file is empty" +msgstr "" + +#: js_upload.php:227 +#, php-format +msgid "Image exceeds size limit of %s" +msgstr "" + +#: js_upload.php:239 +#, php-format +msgid "File has an invalid extension, it should be one of %s." +msgstr "" + +#: js_upload.php:250 +msgid "Upload was cancelled, or server error encountered" +msgstr "" diff --git a/js_upload/lang/bg/strings.php b/js_upload/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/js_upload/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: js_upload.php:37 +msgid "Select files for upload" +msgstr "" + +#: js_upload.php:38 +msgid "Drop files here to upload" +msgstr "" + +#: js_upload.php:39 +msgid "Cancel" +msgstr "" + +#: js_upload.php:40 +msgid "Failed" +msgstr "" + +#: js_upload.php:209 +msgid "No files were uploaded." +msgstr "" + +#: js_upload.php:215 +msgid "Uploaded file is empty" +msgstr "" + +#: js_upload.php:227 +#, php-format +msgid "Image exceeds size limit of %s" +msgstr "" + +#: js_upload.php:239 +#, php-format +msgid "File has an invalid extension, it should be one of %s." +msgstr "" + +#: js_upload.php:250 +msgid "Upload was cancelled, or server error encountered" +msgstr "" diff --git a/js_upload/lang/ca/strings.php b/js_upload/lang/ca/strings.php index 85b403f9..d34874f6 100644 --- a/js_upload/lang/ca/strings.php +++ b/js_upload/lang/ca/strings.php @@ -1,11 +1,7 @@ -strings["Upload a file"] = "Carrega un arxiu"; -$a->strings["Drop files here to upload"] = "Deixa aquí el arxiu a carregar"; -$a->strings["Cancel"] = "Cancel·lar"; -$a->strings["Failed"] = "Fracassar"; -$a->strings["No files were uploaded."] = "No hi ha arxius carregats."; -$a->strings["Uploaded file is empty"] = "L'arxiu carregat està buit"; -$a->strings["Image exceeds size limit of "] = "La imatge excedeix el límit de "; -$a->strings["File has an invalid extension, it should be one of "] = "Arxiu té una extensió no vàlida, ha de ser una de"; -$a->strings["Upload was cancelled, or server error encountered"] = "La pujada va ser cancel.lada, o es va trobar un error de servidor"; +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: js_upload.php:37 +msgid "Select files for upload" +msgstr "" + +#: js_upload.php:38 +msgid "Drop files here to upload" +msgstr "" + +#: js_upload.php:39 +msgid "Cancel" +msgstr "" + +#: js_upload.php:40 +msgid "Failed" +msgstr "" + +#: js_upload.php:209 +msgid "No files were uploaded." +msgstr "" + +#: js_upload.php:215 +msgid "Uploaded file is empty" +msgstr "" + +#: js_upload.php:227 +#, php-format +msgid "Image exceeds size limit of %s" +msgstr "" + +#: js_upload.php:239 +#, php-format +msgid "File has an invalid extension, it should be one of %s." +msgstr "" + +#: js_upload.php:250 +msgid "Upload was cancelled, or server error encountered" +msgstr "" diff --git a/js_upload/lang/eo/strings.php b/js_upload/lang/eo/strings.php index fd358ea8..68e8a64c 100644 --- a/js_upload/lang/eo/strings.php +++ b/js_upload/lang/eo/strings.php @@ -1,11 +1,7 @@ -strings["Upload a file"] = "Alŝuti dosieron"; -$a->strings["Drop files here to upload"] = "Ŝovmeti dosierojn ĉi tie por alŝuti ilin."; -$a->strings["Cancel"] = "Nuligi"; -$a->strings["Failed"] = "Malsukcesi"; -$a->strings["No files were uploaded."] = "Neniom da dosieroj alŝutita."; -$a->strings["Uploaded file is empty"] = "Alŝutita dosiero estas malplena."; -$a->strings["Image exceeds size limit of "] = "Bildo estas pli granda ol la limito de"; -$a->strings["File has an invalid extension, it should be one of "] = "Dosiero havas nevalidan sufikson. Ĝi estu unu de "; -$a->strings["Upload was cancelled, or server error encountered"] = "Alŝutado estas nuligita aŭ okazis eraro sur la servilo"; +\n" +"Language-Team: Estonian (http://app.transifex.com/Friendica/friendica/language/et/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: et\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: js_upload.php:37 +msgid "Select files for upload" +msgstr "" + +#: js_upload.php:38 +msgid "Drop files here to upload" +msgstr "" + +#: js_upload.php:39 +msgid "Cancel" +msgstr "" + +#: js_upload.php:40 +msgid "Failed" +msgstr "" + +#: js_upload.php:209 +msgid "No files were uploaded." +msgstr "" + +#: js_upload.php:215 +msgid "Uploaded file is empty" +msgstr "" + +#: js_upload.php:227 +#, php-format +msgid "Image exceeds size limit of %s" +msgstr "" + +#: js_upload.php:239 +#, php-format +msgid "File has an invalid extension, it should be one of %s." +msgstr "" + +#: js_upload.php:250 +msgid "Upload was cancelled, or server error encountered" +msgstr "" diff --git a/js_upload/lang/et/strings.php b/js_upload/lang/et/strings.php new file mode 100644 index 00000000..dfe78358 --- /dev/null +++ b/js_upload/lang/et/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: js_upload.php:37 +msgid "Select files for upload" +msgstr "" + +#: js_upload.php:38 +msgid "Drop files here to upload" +msgstr "" + +#: js_upload.php:39 +msgid "Cancel" +msgstr "" + +#: js_upload.php:40 +msgid "Failed" +msgstr "" + +#: js_upload.php:209 +msgid "No files were uploaded." +msgstr "" + +#: js_upload.php:215 +msgid "Uploaded file is empty" +msgstr "" + +#: js_upload.php:227 +#, php-format +msgid "Image exceeds size limit of %s" +msgstr "" + +#: js_upload.php:239 +#, php-format +msgid "File has an invalid extension, it should be one of %s." +msgstr "" + +#: js_upload.php:250 +msgid "Upload was cancelled, or server error encountered" +msgstr "" diff --git a/js_upload/lang/gd/strings.php b/js_upload/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/js_upload/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/js_upload/lang/is/messages.po b/js_upload/lang/is/messages.po new file mode 100644 index 00000000..39528f2d --- /dev/null +++ b/js_upload/lang/is/messages.po @@ -0,0 +1,57 @@ +# ADDON js_upload +# Copyright (C) +# This file is distributed under the same license as the Friendica js_upload addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-06-03 15:49-0400\n" +"PO-Revision-Date: 2014-06-23 08:46+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: js_upload.php:37 +msgid "Select files for upload" +msgstr "" + +#: js_upload.php:38 +msgid "Drop files here to upload" +msgstr "" + +#: js_upload.php:39 +msgid "Cancel" +msgstr "" + +#: js_upload.php:40 +msgid "Failed" +msgstr "" + +#: js_upload.php:209 +msgid "No files were uploaded." +msgstr "" + +#: js_upload.php:215 +msgid "Uploaded file is empty" +msgstr "" + +#: js_upload.php:227 +#, php-format +msgid "Image exceeds size limit of %s" +msgstr "" + +#: js_upload.php:239 +#, php-format +msgid "File has an invalid extension, it should be one of %s." +msgstr "" + +#: js_upload.php:250 +msgid "Upload was cancelled, or server error encountered" +msgstr "" diff --git a/js_upload/lang/is/strings.php b/js_upload/lang/is/strings.php index d09928c0..975c341e 100644 --- a/js_upload/lang/is/strings.php +++ b/js_upload/lang/is/strings.php @@ -1,11 +1,7 @@ -strings["Upload a file"] = "Hlaða upp skrá"; -$a->strings["Drop files here to upload"] = "Slepptu skrám hér til að hala upp"; -$a->strings["Cancel"] = "Hætta við"; -$a->strings["Failed"] = "Mistókst"; -$a->strings["No files were uploaded."] = "Engum skráð hlaðið upp."; -$a->strings["Uploaded file is empty"] = "Skrá sem var hlaðið upp er tóm"; -$a->strings["Image exceeds size limit of "] = "Mynd er yfir stærðamörkum"; -$a->strings["File has an invalid extension, it should be one of "] = "Skrá hefur ógilda skránafnsendingu, ætti að vera eitt af"; -$a->strings["Upload was cancelled, or server error encountered"] = "Hætt var við upphal eða kerfisvilla kom upp"; + */ -use Friendica\App; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\DI; @@ -38,7 +36,7 @@ function keycloakpassword_request($client_id, $secret, $url, $params = []) $res = curl_exec($ch); if (curl_errno($ch)) { - Logger::error(curl_error($ch)); + DI::logger()->error(curl_error($ch)); } curl_close($ch); @@ -92,7 +90,7 @@ function keycloakpassword_authenticate(array &$b) $client_id, $secret, $endpoint . '/logout', - [ 'refresh_token' => res['refresh_token'] ] + [ 'refresh_token' => $res['refresh_token'] ] ); } } diff --git a/krynn/krynn.php b/krynn/krynn.php index f7e77c26..b57d827e 100644 --- a/krynn/krynn.php +++ b/krynn/krynn.php @@ -10,9 +10,7 @@ *"My body was my sacrifice... for my magic. This damage is permanent." - Raistlin Majere */ -use Friendica\App; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; @@ -32,7 +30,7 @@ function krynn_install() Hook::register('addon_settings', 'addon/krynn/krynn.php', 'krynn_settings'); Hook::register('addon_settings_post', 'addon/krynn/krynn.php', 'krynn_settings_post'); - Logger::notice("installed krynn"); + DI::logger()->notice("installed krynn"); } function krynn_post_hook(&$item) diff --git a/krynn/lang/bg/messages.po b/krynn/lang/bg/messages.po new file mode 100644 index 00000000..608a0340 --- /dev/null +++ b/krynn/lang/bg/messages.po @@ -0,0 +1,27 @@ +# ADDON krynn +# Copyright (C) +# This file is distributed under the same license as the Friendica krynn addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:14-0500\n" +"PO-Revision-Date: 2015-07-07 15:14+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: krynn.php:127 +msgid "Enable Krynn Addon" +msgstr "" + +#: krynn.php:132 +msgid "Krynn Settings" +msgstr "" diff --git a/krynn/lang/bg/strings.php b/krynn/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/krynn/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: krynn.php:127 +msgid "Enable Krynn Addon" +msgstr "" + +#: krynn.php:132 +msgid "Krynn Settings" +msgstr "" diff --git a/krynn/lang/ca/strings.php b/krynn/lang/ca/strings.php index d5e09e7e..d34874f6 100644 --- a/krynn/lang/ca/strings.php +++ b/krynn/lang/ca/strings.php @@ -1,5 +1,7 @@ -strings["Krynn Settings"] = "Ajustos de Krynn"; -$a->strings["Enable Krynn Addon"] = "Activa Addon de Krynn"; -$a->strings["Submit"] = "Enviar"; +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: krynn.php:127 +msgid "Enable Krynn Addon" +msgstr "" + +#: krynn.php:132 +msgid "Krynn Settings" +msgstr "" diff --git a/krynn/lang/eo/strings.php b/krynn/lang/eo/strings.php index eae02345..68e8a64c 100644 --- a/krynn/lang/eo/strings.php +++ b/krynn/lang/eo/strings.php @@ -1,5 +1,7 @@ -strings["Krynn Settings"] = "Agordo pri Krynn"; -$a->strings["Enable Krynn Addon"] = "Ŝalti la Krynn kromprogamon"; -$a->strings["Submit"] = "Sendi"; +, 2021 +# cracrayol, 2024 msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-11-21 19:14-0500\n" "PO-Revision-Date: 2015-07-07 15:14+0000\n" -"Last-Translator: bob lebonche , 2021\n" -"Language-Team: French (http://www.transifex.com/Friendica/friendica/language/fr/)\n" +"Last-Translator: cracrayol, 2024\n" +"Language-Team: French (http://app.transifex.com/Friendica/friendica/language/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -21,7 +22,7 @@ msgstr "" #: krynn.php:127 msgid "Enable Krynn Addon" -msgstr "Activer l'application complémentaire Krynn" +msgstr "Activer l'extension Krynn" #: krynn.php:132 msgid "Krynn Settings" diff --git a/krynn/lang/fr/strings.php b/krynn/lang/fr/strings.php index 3c3574d0..84293f79 100644 --- a/krynn/lang/fr/strings.php +++ b/krynn/lang/fr/strings.php @@ -5,5 +5,5 @@ function string_plural_select_fr($n){ $n = intval($n); if (($n == 0 || $n == 1)) { return 0; } else if ($n != 0 && $n % 1000000 == 0) { return 1; } else { return 2; } }} -$a->strings['Enable Krynn Addon'] = 'Activer l\'application complémentaire Krynn'; +$a->strings['Enable Krynn Addon'] = 'Activer l\'extension Krynn'; $a->strings['Krynn Settings'] = 'Paramètres de Krynn'; diff --git a/krynn/lang/gd/messages.po b/krynn/lang/gd/messages.po new file mode 100644 index 00000000..23f81bf9 --- /dev/null +++ b/krynn/lang/gd/messages.po @@ -0,0 +1,27 @@ +# ADDON krynn +# Copyright (C) +# This file is distributed under the same license as the Friendica krynn addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:14-0500\n" +"PO-Revision-Date: 2015-07-07 15:14+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: krynn.php:127 +msgid "Enable Krynn Addon" +msgstr "" + +#: krynn.php:132 +msgid "Krynn Settings" +msgstr "" diff --git a/krynn/lang/gd/strings.php b/krynn/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/krynn/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/krynn/lang/is/messages.po b/krynn/lang/is/messages.po new file mode 100644 index 00000000..bab3ab42 --- /dev/null +++ b/krynn/lang/is/messages.po @@ -0,0 +1,27 @@ +# ADDON krynn +# Copyright (C) +# This file is distributed under the same license as the Friendica krynn addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:14-0500\n" +"PO-Revision-Date: 2015-07-07 15:14+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: krynn.php:127 +msgid "Enable Krynn Addon" +msgstr "" + +#: krynn.php:132 +msgid "Krynn Settings" +msgstr "" diff --git a/krynn/lang/is/strings.php b/krynn/lang/is/strings.php index 11fd5b57..975c341e 100644 --- a/krynn/lang/is/strings.php +++ b/krynn/lang/is/strings.php @@ -1,5 +1,7 @@ -strings["Krynn Settings"] = ""; -$a->strings["Enable Krynn Addon"] = ""; -$a->strings["Submit"] = "Senda inn"; +\n" +"Language-Team: Russian (http://app.transifex.com/Friendica/friendica/language/ru/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ru\n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" + +#: krynn.php:127 +msgid "Enable Krynn Addon" +msgstr "" + +#: krynn.php:132 +msgid "Krynn Settings" +msgstr "" diff --git a/krynn/lang/ru/strings.php b/krynn/lang/ru/strings.php index 88ba6719..0579fc21 100644 --- a/krynn/lang/ru/strings.php +++ b/krynn/lang/ru/strings.php @@ -1,5 +1,7 @@ -strings["Krynn Settings"] = ""; -$a->strings["Enable Krynn Addon"] = ""; -$a->strings["Submit"] = "Подтвердить"; +=2 && $n%10<=4 && ($n%100<12 || $n%100>14)) { return 1; } else if ($n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)) { return 2; } else { return 3; } +}} diff --git a/langfilter/lang/bg/messages.po b/langfilter/lang/bg/messages.po new file mode 100644 index 00000000..92c40191 --- /dev/null +++ b/langfilter/lang/bg/messages.po @@ -0,0 +1,75 @@ +# ADDON langfilter +# Copyright (C) +# This file is distributed under the same license as the Friendica langfilter addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:15-0500\n" +"PO-Revision-Date: 2015-07-25 08:05+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: langfilter.php:49 +msgid "" +"This addon tries to identify the language posts are written in. If it does " +"not match any language specified below, posts will be hidden by collapsing " +"them." +msgstr "" + +#: langfilter.php:50 +msgid "Use the language filter" +msgstr "" + +#: langfilter.php:51 +msgid "Able to read" +msgstr "" + +#: langfilter.php:51 +msgid "" +"List of abbreviations (ISO 639-1 codes) for languages you speak, comma " +"separated. For example \"de,it\"." +msgstr "" + +#: langfilter.php:52 +msgid "Minimum confidence in language detection" +msgstr "" + +#: langfilter.php:52 +msgid "" +"Minimum confidence in language detection being correct, from 0 to 100. Posts" +" will not be filtered when the confidence of language detection is below " +"this percent value." +msgstr "" + +#: langfilter.php:53 +msgid "Minimum length of message body" +msgstr "" + +#: langfilter.php:53 +msgid "" +"Minimum number of characters in message body for filter to be used. Posts " +"shorter than this will not be filtered. Note: Language detection is " +"unreliable for short content (<200 characters)." +msgstr "" + +#: langfilter.php:58 +msgid "Language Filter" +msgstr "" + +#: langfilter.php:60 +msgid "Save Settings" +msgstr "" + +#: langfilter.php:193 +#, php-format +msgid "Filtered language: %s" +msgstr "" diff --git a/langfilter/lang/bg/strings.php b/langfilter/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/langfilter/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: langfilter.php:49 +msgid "" +"This addon tries to identify the language posts are written in. If it does " +"not match any language specified below, posts will be hidden by collapsing " +"them." +msgstr "" + +#: langfilter.php:50 +msgid "Use the language filter" +msgstr "" + +#: langfilter.php:51 +msgid "Able to read" +msgstr "" + +#: langfilter.php:51 +msgid "" +"List of abbreviations (ISO 639-1 codes) for languages you speak, comma " +"separated. For example \"de,it\"." +msgstr "" + +#: langfilter.php:52 +msgid "Minimum confidence in language detection" +msgstr "" + +#: langfilter.php:52 +msgid "" +"Minimum confidence in language detection being correct, from 0 to 100. Posts" +" will not be filtered when the confidence of language detection is below " +"this percent value." +msgstr "" + +#: langfilter.php:53 +msgid "Minimum length of message body" +msgstr "" + +#: langfilter.php:53 +msgid "" +"Minimum number of characters in message body for filter to be used. Posts " +"shorter than this will not be filtered. Note: Language detection is " +"unreliable for short content (<200 characters)." +msgstr "" + +#: langfilter.php:58 +msgid "Language Filter" +msgstr "" + +#: langfilter.php:60 +msgid "Save Settings" +msgstr "" + +#: langfilter.php:193 +#, php-format +msgid "Filtered language: %s" +msgstr "" diff --git a/langfilter/lang/eo/strings.php b/langfilter/lang/eo/strings.php new file mode 100644 index 00000000..68e8a64c --- /dev/null +++ b/langfilter/lang/eo/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: langfilter.php:49 +msgid "" +"This addon tries to identify the language posts are written in. If it does " +"not match any language specified below, posts will be hidden by collapsing " +"them." +msgstr "" + +#: langfilter.php:50 +msgid "Use the language filter" +msgstr "" + +#: langfilter.php:51 +msgid "Able to read" +msgstr "" + +#: langfilter.php:51 +msgid "" +"List of abbreviations (ISO 639-1 codes) for languages you speak, comma " +"separated. For example \"de,it\"." +msgstr "" + +#: langfilter.php:52 +msgid "Minimum confidence in language detection" +msgstr "" + +#: langfilter.php:52 +msgid "" +"Minimum confidence in language detection being correct, from 0 to 100. Posts" +" will not be filtered when the confidence of language detection is below " +"this percent value." +msgstr "" + +#: langfilter.php:53 +msgid "Minimum length of message body" +msgstr "" + +#: langfilter.php:53 +msgid "" +"Minimum number of characters in message body for filter to be used. Posts " +"shorter than this will not be filtered. Note: Language detection is " +"unreliable for short content (<200 characters)." +msgstr "" + +#: langfilter.php:58 +msgid "Language Filter" +msgstr "" + +#: langfilter.php:60 +msgid "Save Settings" +msgstr "" + +#: langfilter.php:193 +#, php-format +msgid "Filtered language: %s" +msgstr "" diff --git a/langfilter/lang/gd/strings.php b/langfilter/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/langfilter/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/langfilter/lang/is/messages.po b/langfilter/lang/is/messages.po new file mode 100644 index 00000000..9734cfde --- /dev/null +++ b/langfilter/lang/is/messages.po @@ -0,0 +1,75 @@ +# ADDON langfilter +# Copyright (C) +# This file is distributed under the same license as the Friendica langfilter addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:15-0500\n" +"PO-Revision-Date: 2015-07-25 08:05+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: langfilter.php:49 +msgid "" +"This addon tries to identify the language posts are written in. If it does " +"not match any language specified below, posts will be hidden by collapsing " +"them." +msgstr "" + +#: langfilter.php:50 +msgid "Use the language filter" +msgstr "" + +#: langfilter.php:51 +msgid "Able to read" +msgstr "" + +#: langfilter.php:51 +msgid "" +"List of abbreviations (ISO 639-1 codes) for languages you speak, comma " +"separated. For example \"de,it\"." +msgstr "" + +#: langfilter.php:52 +msgid "Minimum confidence in language detection" +msgstr "" + +#: langfilter.php:52 +msgid "" +"Minimum confidence in language detection being correct, from 0 to 100. Posts" +" will not be filtered when the confidence of language detection is below " +"this percent value." +msgstr "" + +#: langfilter.php:53 +msgid "Minimum length of message body" +msgstr "" + +#: langfilter.php:53 +msgid "" +"Minimum number of characters in message body for filter to be used. Posts " +"shorter than this will not be filtered. Note: Language detection is " +"unreliable for short content (<200 characters)." +msgstr "" + +#: langfilter.php:58 +msgid "Language Filter" +msgstr "" + +#: langfilter.php:60 +msgid "Save Settings" +msgstr "" + +#: langfilter.php:193 +#, php-format +msgid "Filtered language: %s" +msgstr "" diff --git a/langfilter/lang/is/strings.php b/langfilter/lang/is/strings.php new file mode 100644 index 00000000..975c341e --- /dev/null +++ b/langfilter/lang/is/strings.php @@ -0,0 +1,7 @@ +, 2025 # fabrixxm , 2015,2018 # Sandro Santilli , 2015 # SickShark X, 2021 @@ -14,7 +15,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-11-21 19:15-0500\n" "PO-Revision-Date: 2015-07-25 08:05+0000\n" -"Last-Translator: SickShark X, 2021\n" +"Last-Translator: Diego Beraldin , 2025\n" "Language-Team: Italian (http://app.transifex.com/Friendica/friendica/language/it/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -27,7 +28,7 @@ msgid "" "This addon tries to identify the language posts are written in. If it does " "not match any language specified below, posts will be hidden by collapsing " "them." -msgstr "Questo plug-in prova a identificare la lingua con cui sono stati scritti i posts. Se non corrisponde a nessuna delle lingue specificate qui sotto, i post verranno nascosti." +msgstr "Questo componente aggiuntivo prova a identificare la lingua con cui sono stati scritti i messaggi. Se non corrisponde a nessuna delle lingue specificate qui sotto, i messaggi verranno nascosti." #: langfilter.php:50 msgid "Use the language filter" diff --git a/langfilter/lang/it/strings.php b/langfilter/lang/it/strings.php index 8cae0b57..cbce2841 100644 --- a/langfilter/lang/it/strings.php +++ b/langfilter/lang/it/strings.php @@ -5,7 +5,7 @@ function string_plural_select_it($n){ $n = intval($n); if ($n == 1) { return 0; } else if ($n != 0 && $n % 1000000 == 0) { return 1; } else { return 2; } }} -$a->strings['This addon tries to identify the language posts are written in. If it does not match any language specified below, posts will be hidden by collapsing them.'] = 'Questo plug-in prova a identificare la lingua con cui sono stati scritti i posts. Se non corrisponde a nessuna delle lingue specificate qui sotto, i post verranno nascosti.'; +$a->strings['This addon tries to identify the language posts are written in. If it does not match any language specified below, posts will be hidden by collapsing them.'] = 'Questo componente aggiuntivo prova a identificare la lingua con cui sono stati scritti i messaggi. Se non corrisponde a nessuna delle lingue specificate qui sotto, i messaggi verranno nascosti.'; $a->strings['Use the language filter'] = 'Usa il filtro lingua'; $a->strings['Able to read'] = 'In grado di leggere'; $a->strings['List of abbreviations (ISO 639-1 codes) for languages you speak, comma separated. For example "de,it".'] = 'Lista di abbreviazioni (codici ISO 639-1) per le lingue che parli, separate da virgola. Per esempio "it,de".'; diff --git a/langfilter/lang/ru/messages.po b/langfilter/lang/ru/messages.po index e1fbc9e8..45ad7b3d 100644 --- a/langfilter/lang/ru/messages.po +++ b/langfilter/lang/ru/messages.po @@ -4,63 +4,59 @@ # # # Translators: -# Alexander An , 2020 +# Alexander An , 2020,2023 # Stanislav N. , 2018 msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2020-10-03 22:02-0400\n" -"PO-Revision-Date: 2020-10-09 17:48+0000\n" -"Last-Translator: Alexander An \n" -"Language-Team: Russian (http://www.transifex.com/Friendica/friendica/language/ru/)\n" +"POT-Creation-Date: 2021-11-21 19:15-0500\n" +"PO-Revision-Date: 2015-07-25 08:05+0000\n" +"Last-Translator: Alexander An , 2020,2023\n" +"Language-Team: Russian (http://app.transifex.com/Friendica/friendica/language/ru/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ru\n" "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" -#: langfilter.php:52 -msgid "Language Filter" -msgstr "Языковой фильтр" - -#: langfilter.php:53 +#: langfilter.php:49 msgid "" "This addon tries to identify the language posts are written in. If it does " "not match any language specified below, posts will be hidden by collapsing " "them." -msgstr "Это дополнение пытается идентифицировать язык, на котором написаны посты. Если язык не соответствует ни одному, указанному ниже, то такие посты будут скрыты." +msgstr "Это дополнение пытается идентифицировать язык, на котором сделаны записи. Если язык не соответствует ни одному, указанному ниже, то такие посты будут свёрнуты." -#: langfilter.php:54 +#: langfilter.php:50 msgid "Use the language filter" msgstr "Использовать языковой фильтр" -#: langfilter.php:55 +#: langfilter.php:51 msgid "Able to read" msgstr "Возможность читать" -#: langfilter.php:55 +#: langfilter.php:51 msgid "" "List of abbreviations (ISO 639-1 codes) for languages you speak, comma " "separated. For example \"de,it\"." msgstr "Список аббревиатур (кодов по ISO 639-1 ) для языков, на которых вы говорите. Например, \"ru,en\"." -#: langfilter.php:56 +#: langfilter.php:52 msgid "Minimum confidence in language detection" msgstr "Минимальная уверенность в определении языка" -#: langfilter.php:56 +#: langfilter.php:52 msgid "" "Minimum confidence in language detection being correct, from 0 to 100. Posts" " will not be filtered when the confidence of language detection is below " "this percent value." msgstr "Минимальная уверенность в правильном определении языка, от 0 до 100. Посты не будут скрыты, если уверенность в правильном определении языка в процентах ниже этого значения." -#: langfilter.php:57 +#: langfilter.php:53 msgid "Minimum length of message body" msgstr "Минимальная длина тела сообщения" -#: langfilter.php:57 +#: langfilter.php:53 msgid "" "Minimum number of characters in message body for filter to be used. Posts " "shorter than this will not be filtered. Note: Language detection is " @@ -68,10 +64,14 @@ msgid "" msgstr "Минимальное количество знаков в теле сообщения для применения фильтрации. Посты, длина которых меньше указанного значения, не будут отфильтрованы. Обратите внимание, что определение языка работает ненадежно для небольших постов (<200 символов)." #: langfilter.php:58 +msgid "Language Filter" +msgstr "Языковой фильтр" + +#: langfilter.php:60 msgid "Save Settings" msgstr "Сохранить настройки" -#: langfilter.php:189 +#: langfilter.php:193 #, php-format msgid "Filtered language: %s" msgstr "Отфильтрованный язык: %s" diff --git a/langfilter/lang/ru/strings.php b/langfilter/lang/ru/strings.php index 0489bd4f..1f5619f7 100644 --- a/langfilter/lang/ru/strings.php +++ b/langfilter/lang/ru/strings.php @@ -5,8 +5,7 @@ function string_plural_select_ru($n){ $n = intval($n); if ($n%10==1 && $n%100!=11) { return 0; } else if ($n%10>=2 && $n%10<=4 && ($n%100<12 || $n%100>14)) { return 1; } else if ($n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)) { return 2; } else { return 3; } }} -$a->strings['Language Filter'] = 'Языковой фильтр'; -$a->strings['This addon tries to identify the language posts are written in. If it does not match any language specified below, posts will be hidden by collapsing them.'] = 'Это дополнение пытается идентифицировать язык, на котором написаны посты. Если язык не соответствует ни одному, указанному ниже, то такие посты будут скрыты.'; +$a->strings['This addon tries to identify the language posts are written in. If it does not match any language specified below, posts will be hidden by collapsing them.'] = 'Это дополнение пытается идентифицировать язык, на котором сделаны записи. Если язык не соответствует ни одному, указанному ниже, то такие посты будут свёрнуты.'; $a->strings['Use the language filter'] = 'Использовать языковой фильтр'; $a->strings['Able to read'] = 'Возможность читать'; $a->strings['List of abbreviations (ISO 639-1 codes) for languages you speak, comma separated. For example "de,it".'] = 'Список аббревиатур (кодов по ISO 639-1 ) для языков, на которых вы говорите. Например, "ru,en".'; @@ -14,5 +13,6 @@ $a->strings['Minimum confidence in language detection'] = 'Минимальна $a->strings['Minimum confidence in language detection being correct, from 0 to 100. Posts will not be filtered when the confidence of language detection is below this percent value.'] = 'Минимальная уверенность в правильном определении языка, от 0 до 100. Посты не будут скрыты, если уверенность в правильном определении языка в процентах ниже этого значения.'; $a->strings['Minimum length of message body'] = 'Минимальная длина тела сообщения'; $a->strings['Minimum number of characters in message body for filter to be used. Posts shorter than this will not be filtered. Note: Language detection is unreliable for short content (<200 characters).'] = 'Минимальное количество знаков в теле сообщения для применения фильтрации. Посты, длина которых меньше указанного значения, не будут отфильтрованы. Обратите внимание, что определение языка работает ненадежно для небольших постов (<200 символов).'; +$a->strings['Language Filter'] = 'Языковой фильтр'; $a->strings['Save Settings'] = 'Сохранить настройки'; $a->strings['Filtered language: %s'] = 'Отфильтрованный язык: %s'; diff --git a/langfilter/langfilter.php b/langfilter/langfilter.php index 61b357f6..3a202fcd 100644 --- a/langfilter/langfilter.php +++ b/langfilter/langfilter.php @@ -7,7 +7,6 @@ * License: MIT */ -use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Hook; use Friendica\Core\Renderer; @@ -100,8 +99,8 @@ function langfilter_addon_settings_post(array &$b) function langfilter_prepare_body_content_filter(&$hook_data) { - $logged_user = DI::userSession()->getLocalUserId(); - if (!$logged_user) { + $uid = $hook_data['uid'] ?? DI::userSession()->getLocalUserId(); + if (!$uid) { return; } @@ -113,8 +112,8 @@ function langfilter_prepare_body_content_filter(&$hook_data) } // Don't filter if language filter is disabled - if (!DI::pConfig()->get($logged_user, 'langfilter', 'enable', - !DI::pConfig()->get($logged_user, 'langfilter', 'disable')) + if (!DI::pConfig()->get($uid, 'langfilter', 'enable', + !DI::pConfig()->get($uid, 'langfilter', 'disable')) ) { return; } @@ -122,13 +121,13 @@ function langfilter_prepare_body_content_filter(&$hook_data) $naked_body = strip_tags( $hook_data['item']['rendered-html'] ??''?: // Equivalent of !empty() - BBCode::convert($hook_data['item']['body'], false, BBCode::ACTIVITYPUB, true) + BBCode::convertForUriId($hook_data['item']['uri-id'], $hook_data['item']['body'], BBCode::ACTIVITYPUB) ); $naked_body = preg_replace('#\s+#', ' ', trim($naked_body)); // Don't filter if body lenght is below minimum - $minlen = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'langfilter', 'minlength', 32); + $minlen = DI::pConfig()->get($uid, 'langfilter', 'minlength', 32); if (!$minlen) { $minlen = 32; } @@ -137,8 +136,8 @@ function langfilter_prepare_body_content_filter(&$hook_data) return; } - $read_languages_string = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'langfilter', 'languages'); - $minconfidence = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'langfilter', 'minconfidence'); + $read_languages_string = DI::pConfig()->get($uid, 'langfilter', 'languages'); + $minconfidence = DI::pConfig()->get($uid, 'langfilter', 'minconfidence'); // Don't filter if no spoken languages are configured if (!$read_languages_string) { @@ -148,6 +147,8 @@ function langfilter_prepare_body_content_filter(&$hook_data) $iso639 = new Matriphe\ISO639\ISO639; + $confidence = null; + // Extract the language of the post if (!empty($hook_data['item']['language'])) { $languages = json_decode($hook_data['item']['language'], true); @@ -163,7 +164,7 @@ function langfilter_prepare_body_content_filter(&$hook_data) return; } - $lang = $iso639->languageByCode1($iso2); + $lang = $iso639->languageByCode1(substr($iso2, 0, 2)); } else { $opts = $hook_data['item']['postopts']; if (!$opts) { diff --git a/ldapauth/ldapauth.php b/ldapauth/ldapauth.php index 38e2d6a1..b80c5226 100644 --- a/ldapauth/ldapauth.php +++ b/ldapauth/ldapauth.php @@ -29,9 +29,7 @@ * The configuration options for this module are described in the config/ldapauth.config.php file */ -use Friendica\App; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\User; @@ -45,7 +43,7 @@ function ldapauth_install() function ldapauth_load_config(ConfigFileManager $loader) { - DI::app()->getConfigCache()->load($loader->loadAddonConfig('ldapauth'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); + DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('ldapauth'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); } function ldapauth_hook_authenticate(array &$b) @@ -70,54 +68,54 @@ function ldapauth_authenticate($username, $password) $ldap_autocreateaccount_nameattribute = DI::config()->get('ldapauth', 'ldap_autocreateaccount_nameattribute'); if (!extension_loaded('ldap') || !strlen($ldap_server)) { - Logger::error('Addon not configured or missing php-ldap extension', ['extension_loaded' => extension_loaded('ldap'), 'server' => $ldap_server]); + DI::logger()->error('Addon not configured or missing php-ldap extension', ['extension_loaded' => extension_loaded('ldap'), 'server' => $ldap_server]); return false; } if (!strlen($password)) { - Logger::error('Empty password disallowed', ['provided_password_length' => strlen($password)]); + DI::logger()->error('Empty password disallowed', ['provided_password_length' => strlen($password)]); return false; } $connect = @ldap_connect($ldap_server); if ($connect === false) { - Logger::warning('Could not connect to LDAP server', ['server' => $ldap_server]); + DI::logger()->warning('Could not connect to LDAP server', ['server' => $ldap_server]); return false; } @ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3); @ldap_set_option($connect, LDAP_OPT_REFERRALS, 0); if ((@ldap_bind($connect, $ldap_binddn, $ldap_bindpw)) === false) { - Logger::warning('Could not bind to LDAP server', ['server' => $ldap_server, 'binddn' => $ldap_binddn, 'errno' => ldap_errno($connect), 'error' => ldap_error($connect)]); + DI::logger()->warning('Could not bind to LDAP server', ['server' => $ldap_server, 'binddn' => $ldap_binddn, 'errno' => ldap_errno($connect), 'error' => ldap_error($connect)]); return false; } $res = @ldap_search($connect, $ldap_searchdn, $ldap_userattr . '=' . $username); if (!$res) { - Logger::notice('LDAP user not found.', ['searchdn' => $ldap_searchdn, 'userattr' => $ldap_userattr, 'username' => $username, 'errno' => ldap_errno($connect), 'error' => ldap_error($connect)]); + DI::logger()->notice('LDAP user not found.', ['searchdn' => $ldap_searchdn, 'userattr' => $ldap_userattr, 'username' => $username, 'errno' => ldap_errno($connect), 'error' => ldap_error($connect)]); return false; } $id = @ldap_first_entry($connect, $res); if (!$id) { - Logger::notice('Could not retrieve first LDAP entry.', ['searchdn' => $ldap_searchdn, 'userattr' => $ldap_userattr, 'username' => $username, 'errno' => ldap_errno($connect), 'error' => ldap_error($connect)]); + DI::logger()->notice('Could not retrieve first LDAP entry.', ['searchdn' => $ldap_searchdn, 'userattr' => $ldap_userattr, 'username' => $username, 'errno' => ldap_errno($connect), 'error' => ldap_error($connect)]); return false; } $dn = @ldap_get_dn($connect, $id); if (!@ldap_bind($connect, $dn, $password)) { - Logger::notice('Could not authenticate LDAP user with provided password', ['errno' => ldap_errno($connect), 'error' => ldap_error($connect)]); + DI::logger()->notice('Could not authenticate LDAP user with provided password', ['errno' => ldap_errno($connect), 'error' => ldap_error($connect)]); return false; } if (strlen($ldap_group) && @ldap_compare($connect, $ldap_group, 'member', $dn) !== true) { $errno = @ldap_errno($connect); if ($errno === 32) { - Logger::notice('LDAP Access Control Group does not exist', ['errno' => $errno, 'error' => ldap_error($connect)]); + DI::logger()->notice('LDAP Access Control Group does not exist', ['errno' => $errno, 'error' => ldap_error($connect)]); } elseif ($errno === 16) { - Logger::notice('LDAP membership attribute does not exist in access control group', ['errno' => $errno, 'error' => ldap_error($connect)]); + DI::logger()->notice('LDAP membership attribute does not exist in access control group', ['errno' => $errno, 'error' => ldap_error($connect)]); } else { - Logger::notice('LDAP user isn\'t part of the authorized group', ['dn' => $dn]); + DI::logger()->notice('LDAP user isn\'t part of the authorized group', ['dn' => $dn]); } @ldap_close($connect); @@ -141,7 +139,7 @@ function ldapauth_authenticate($username, $password) $authentication = User::getAuthenticationInfo($username); return User::getById($authentication['uid']); } catch (Exception $e) { - Logger::notice('LDAP authentication error: ' . $e->getMessage()); + DI::logger()->notice('LDAP authentication error: ' . $e->getMessage()); return false; } } @@ -149,7 +147,7 @@ function ldapauth_authenticate($username, $password) function ldap_createaccount($username, $password, $email, $name) { if (!strlen($email) || !strlen($name)) { - Logger::notice('Could not create local user from LDAP data, no email or nickname provided'); + DI::logger()->notice('Could not create local user from LDAP data, no email or nickname provided'); return false; } @@ -161,10 +159,10 @@ function ldap_createaccount($username, $password, $email, $name) 'password' => $password, 'verified' => 1 ]); - Logger::info('Local user created from LDAP data', ['username' => $username, 'name' => $name]); + DI::logger()->info('Local user created from LDAP data', ['username' => $username, 'name' => $name]); return $user; } catch (Exception $ex) { - Logger::error('Could not create local user from LDAP data', ['username' => $username, 'exception' => $ex->getMessage()]); + DI::logger()->error('Could not create local user from LDAP data', ['username' => $username, 'exception' => $ex->getMessage()]); } return false; diff --git a/leistungsschutzrecht/leistungsschutzrecht.php b/leistungsschutzrecht/leistungsschutzrecht.php index f6c65399..891cb6ca 100644 --- a/leistungsschutzrecht/leistungsschutzrecht.php +++ b/leistungsschutzrecht/leistungsschutzrecht.php @@ -6,9 +6,7 @@ * Author: Michael Vogel */ -use Friendica\App; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\DI; function leistungsschutzrecht_install() @@ -149,7 +147,7 @@ function leistungsschutzrecht_is_member_site(string $url): bool $cleanedurlpart = explode('%', $urldata['host']); $hostname = explode('.', $cleanedurlpart[0]); - if (empty($hostname)) { + if ($hostname === false || $hostname === '') { return false; } @@ -169,7 +167,7 @@ function leistungsschutzrecht_cron($b) if ($last) { $next = $last + 86400; if ($next > time()) { - Logger::notice('poll intervall not reached'); + DI::logger()->notice('poll intervall not reached'); return; } } diff --git a/libertree/lang/C/messages.po b/libertree/lang/C/messages.po index 6feeef8d..3162b6a7 100644 --- a/libertree/lang/C/messages.po +++ b/libertree/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-21 19:17-0500\n" +"POT-Creation-Date: 2023-06-03 15:49-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -21,22 +21,22 @@ msgstr "" msgid "Post to libertree" msgstr "" -#: libertree.php:60 +#: libertree.php:59 msgid "Enable Libertree Post Addon" msgstr "" -#: libertree.php:61 +#: libertree.php:60 msgid "Libertree site URL" msgstr "" -#: libertree.php:62 +#: libertree.php:61 msgid "Libertree API token" msgstr "" -#: libertree.php:63 +#: libertree.php:62 msgid "Post to Libertree by default" msgstr "" -#: libertree.php:68 +#: libertree.php:67 msgid "Libertree Export" msgstr "" diff --git a/libertree/lang/bg/messages.po b/libertree/lang/bg/messages.po new file mode 100644 index 00000000..c92eb2fc --- /dev/null +++ b/libertree/lang/bg/messages.po @@ -0,0 +1,43 @@ +# ADDON libertree +# Copyright (C) +# This file is distributed under the same license as the Friendica libertree addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-06-03 15:49-0400\n" +"PO-Revision-Date: 2014-06-23 09:44+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: libertree.php:39 +msgid "Post to libertree" +msgstr "" + +#: libertree.php:59 +msgid "Enable Libertree Post Addon" +msgstr "" + +#: libertree.php:60 +msgid "Libertree site URL" +msgstr "" + +#: libertree.php:61 +msgid "Libertree API token" +msgstr "" + +#: libertree.php:62 +msgid "Post to Libertree by default" +msgstr "" + +#: libertree.php:67 +msgid "Libertree Export" +msgstr "" diff --git a/libertree/lang/bg/strings.php b/libertree/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/libertree/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: libertree.php:39 +msgid "Post to libertree" +msgstr "" + +#: libertree.php:59 +msgid "Enable Libertree Post Addon" +msgstr "" + +#: libertree.php:60 +msgid "Libertree site URL" +msgstr "" + +#: libertree.php:61 +msgid "Libertree API token" +msgstr "" + +#: libertree.php:62 +msgid "Post to Libertree by default" +msgstr "" + +#: libertree.php:67 +msgid "Libertree Export" +msgstr "" diff --git a/libertree/lang/ca/strings.php b/libertree/lang/ca/strings.php index 02c7d22c..d34874f6 100644 --- a/libertree/lang/ca/strings.php +++ b/libertree/lang/ca/strings.php @@ -1,9 +1,7 @@ -strings["Post to libertree"] = "Enviament a libertree"; -$a->strings["libertree Post Settings"] = "Ajustos d'enviaments a libertree"; -$a->strings["Enable Libertree Post Addon"] = "Activa el addon d'enviaments a libertree"; -$a->strings["Libertree API token"] = "Libertree API token"; -$a->strings["Libertree site URL"] = "lloc URL libertree"; -$a->strings["Post to Libertree by default"] = "Enviar a libertree per defecte"; -$a->strings["Submit"] = "Enviar"; +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: libertree.php:39 +msgid "Post to libertree" +msgstr "" + +#: libertree.php:59 +msgid "Enable Libertree Post Addon" +msgstr "" + +#: libertree.php:60 +msgid "Libertree site URL" +msgstr "" + +#: libertree.php:61 +msgid "Libertree API token" +msgstr "" + +#: libertree.php:62 +msgid "Post to Libertree by default" +msgstr "" + +#: libertree.php:67 +msgid "Libertree Export" +msgstr "" diff --git a/libertree/lang/eo/strings.php b/libertree/lang/eo/strings.php index 674972d0..68e8a64c 100644 --- a/libertree/lang/eo/strings.php +++ b/libertree/lang/eo/strings.php @@ -1,9 +1,7 @@ -strings["Post to libertree"] = "Afiŝi al libertree"; -$a->strings["libertree Post Settings"] = "Agordoj por Afiŝoj ĉe libertree"; -$a->strings["Enable Libertree Post Addon"] = "Aktivigi Kromprogramon por Afiŝoj ĉe libertree"; -$a->strings["Libertree API token"] = "Libertree API ĵetono"; -$a->strings["Libertree site URL"] = "URL adreso de libertree retejo:"; -$a->strings["Post to Libertree by default"] = "Defaŭlte afiŝi ĉe Libertree"; -$a->strings["Submit"] = "Sendi"; +\n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: libertree.php:39 +msgid "Post to libertree" +msgstr "" + +#: libertree.php:59 +msgid "Enable Libertree Post Addon" +msgstr "" + +#: libertree.php:60 +msgid "Libertree site URL" +msgstr "" + +#: libertree.php:61 +msgid "Libertree API token" +msgstr "" + +#: libertree.php:62 +msgid "Post to Libertree by default" +msgstr "" + +#: libertree.php:67 +msgid "Libertree Export" +msgstr "" diff --git a/libertree/lang/gd/strings.php b/libertree/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/libertree/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/libertree/lang/is/messages.po b/libertree/lang/is/messages.po new file mode 100644 index 00000000..bede59ec --- /dev/null +++ b/libertree/lang/is/messages.po @@ -0,0 +1,43 @@ +# ADDON libertree +# Copyright (C) +# This file is distributed under the same license as the Friendica libertree addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-06-03 15:49-0400\n" +"PO-Revision-Date: 2014-06-23 09:44+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: libertree.php:39 +msgid "Post to libertree" +msgstr "" + +#: libertree.php:59 +msgid "Enable Libertree Post Addon" +msgstr "" + +#: libertree.php:60 +msgid "Libertree site URL" +msgstr "" + +#: libertree.php:61 +msgid "Libertree API token" +msgstr "" + +#: libertree.php:62 +msgid "Post to Libertree by default" +msgstr "" + +#: libertree.php:67 +msgid "Libertree Export" +msgstr "" diff --git a/libertree/lang/is/strings.php b/libertree/lang/is/strings.php index 6256e21c..975c341e 100644 --- a/libertree/lang/is/strings.php +++ b/libertree/lang/is/strings.php @@ -1,9 +1,7 @@ -strings["Post to libertree"] = ""; -$a->strings["libertree Post Settings"] = ""; -$a->strings["Enable Libertree Post Addon"] = ""; -$a->strings["Libertree API token"] = ""; -$a->strings["Libertree site URL"] = ""; -$a->strings["Post to Libertree by default"] = ""; -$a->strings["Submit"] = "Senda inn"; +, 2014-2015,2018 -# Sylke Vicious , 2021 +# Sylke Vicious , 2021,2023 msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-01 18:15+0100\n" -"PO-Revision-Date: 2021-02-16 12:47+0000\n" -"Last-Translator: Sylke Vicious \n" -"Language-Team: Italian (http://www.transifex.com/Friendica/friendica/language/it/)\n" +"POT-Creation-Date: 2023-06-03 15:49-0400\n" +"PO-Revision-Date: 2014-06-23 09:44+0000\n" +"Last-Translator: Sylke Vicious , 2021,2023\n" +"Language-Team: Italian (http://app.transifex.com/Friendica/friendica/language/it/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: it\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n" -#: libertree.php:37 +#: libertree.php:39 msgid "Post to libertree" msgstr "Invia a Libertree" -#: libertree.php:71 libertree.php:75 -msgid "libertree Export" -msgstr "Esporta libertree" - -#: libertree.php:79 +#: libertree.php:59 msgid "Enable Libertree Post Addon" msgstr "Abilita il componente aggiuntivo di invio a Libertree" -#: libertree.php:84 -msgid "Libertree API token" -msgstr "Token API Libertree" - -#: libertree.php:89 +#: libertree.php:60 msgid "Libertree site URL" msgstr "Indirizzo sito Libertree" -#: libertree.php:94 +#: libertree.php:61 +msgid "Libertree API token" +msgstr "Token API Libertree" + +#: libertree.php:62 msgid "Post to Libertree by default" msgstr "Invia sempre a Libertree" -#: libertree.php:100 -msgid "Save Settings" -msgstr "Salva Impostazioni" +#: libertree.php:67 +msgid "Libertree Export" +msgstr "Esporta Libertree" diff --git a/libertree/lang/it/strings.php b/libertree/lang/it/strings.php index 02d26542..8abcfa2d 100644 --- a/libertree/lang/it/strings.php +++ b/libertree/lang/it/strings.php @@ -3,12 +3,11 @@ if(! function_exists("string_plural_select_it")) { function string_plural_select_it($n){ $n = intval($n); - return intval($n != 1); + if ($n == 1) { return 0; } else if ($n != 0 && $n % 1000000 == 0) { return 1; } else { return 2; } }} $a->strings['Post to libertree'] = 'Invia a Libertree'; -$a->strings['libertree Export'] = 'Esporta libertree'; $a->strings['Enable Libertree Post Addon'] = 'Abilita il componente aggiuntivo di invio a Libertree'; -$a->strings['Libertree API token'] = 'Token API Libertree'; $a->strings['Libertree site URL'] = 'Indirizzo sito Libertree'; +$a->strings['Libertree API token'] = 'Token API Libertree'; $a->strings['Post to Libertree by default'] = 'Invia sempre a Libertree'; -$a->strings['Save Settings'] = 'Salva Impostazioni'; +$a->strings['Libertree Export'] = 'Esporta Libertree'; diff --git a/libertree/libertree.php b/libertree/libertree.php index 8e8c9ba9..c1bb2a07 100644 --- a/libertree/libertree.php +++ b/libertree/libertree.php @@ -6,13 +6,12 @@ * Author: Tony Baldwin */ -use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\DI; +use Friendica\Model\Item; use Friendica\Model\Post; function libertree_install() @@ -74,13 +73,11 @@ function libertree_settings(array &$data) function libertree_settings_post(array &$b) { if (!empty($_POST['libertree-submit'])) { - DI::pConfig()->set(DI::userSession()->getLocalUserId(),'libertree','post',intval($_POST['libertree'])); - DI::pConfig()->set(DI::userSession()->getLocalUserId(),'libertree','post_by_default',intval($_POST['libertree_bydefault'])); - DI::pConfig()->set(DI::userSession()->getLocalUserId(),'libertree','libertree_api_token',trim($_POST['libertree_api_token'])); - DI::pConfig()->set(DI::userSession()->getLocalUserId(),'libertree','libertree_url',trim($_POST['libertree_url'])); - + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'libertree', 'post', intval($_POST['libertree'])); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'libertree', 'post_by_default', intval($_POST['libertree_bydefault'])); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'libertree', 'libertree_api_token', trim($_POST['libertree_api_token'])); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'libertree', 'libertree_url', trim($_POST['libertree_url'])); } - } function libertree_hook_fork(array &$b) @@ -91,8 +88,10 @@ function libertree_hook_fork(array &$b) $post = $b['data']; - if ($post['deleted'] || $post['private'] || ($post['created'] !== $post['edited']) || - !strstr($post['postopts'], 'libertree') || ($post['parent'] != $post['id'])) { + if ( + $post['deleted'] || ($post['private'] == Item::PRIVATE) || ($post['created'] !== $post['edited']) || + !strstr($post['postopts'], 'libertree') || ($post['gravity'] != Item::GRAVITY_PARENT) + ) { $b['execute'] = false; return; } @@ -100,26 +99,20 @@ function libertree_hook_fork(array &$b) function libertree_post_local(array &$b) { - - // This can probably be changed to allow editing by pointing to a different API endpoint - - if ($b['edit']) { - return; - } - if (!DI::userSession()->getLocalUserId() || (DI::userSession()->getLocalUserId() != $b['uid'])) { return; } - if ($b['private'] || $b['parent']) { + // This can probably be changed to allow editing by pointing to a different API endpoint + if ($b['edit'] || ($b['private'] == Item::PRIVATE) || ($b['gravity'] != Item::GRAVITY_PARENT)) { return; } - $ltree_post = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(),'libertree','post')); + $ltree_post = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'libertree', 'post')); $ltree_enable = (($ltree_post && !empty($_REQUEST['libertree_enable'])) ? intval($_REQUEST['libertree_enable']) : 0); - if ($b['api_source'] && intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(),'libertree','post_by_default'))) { + if ($b['api_source'] && intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'libertree', 'post_by_default'))) { $ltree_enable = 1; } @@ -136,13 +129,17 @@ function libertree_post_local(array &$b) function libertree_send(array &$b) { - Logger::notice('libertree_send: invoked'); + DI::logger()->notice('libertree_send: invoked'); - if ($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited'])) { + if ($b['deleted'] || ($b['private'] == Item::PRIVATE) || ($b['created'] !== $b['edited'])) { return; } - if (! strstr($b['postopts'],'libertree')) { + if (! strstr($b['postopts'], 'libertree')) { + return; + } + + if (Item::isGroupPost($b['uri-id'])) { return; } @@ -151,7 +148,7 @@ function libertree_send(array &$b) } // Dont't post if the post doesn't belong to us. - // This is a check for forum postings + // This is a check for group postings $self = DBA::selectFirst('contact', ['id'], ['uid' => $b['uid'], 'self' => true]); if ($b['contact-id'] != $self['id']) { return; @@ -159,15 +156,15 @@ function libertree_send(array &$b) $b['body'] = Post\Media::addAttachmentsToBody($b['uri-id'], DI::contentItem()->addSharedPost($b)); - $ltree_api_token = DI::pConfig()->get($b['uid'],'libertree','libertree_api_token'); - $ltree_url = DI::pConfig()->get($b['uid'],'libertree','libertree_url'); + $ltree_api_token = DI::pConfig()->get($b['uid'], 'libertree', 'libertree_api_token'); + $ltree_url = DI::pConfig()->get($b['uid'], 'libertree', 'libertree_url'); $ltree_blog = "$ltree_url/api/v1/posts/create/?token=$ltree_api_token"; $ltree_source = DI::baseUrl()->getHost(); if ($b['app'] != "") - $ltree_source .= " (".$b['app'].")"; + $ltree_source .= " (" . $b['app'] . ")"; - if($ltree_url && $ltree_api_token && $ltree_blog && $ltree_source) { + if ($ltree_url && $ltree_api_token && $ltree_blog && $ltree_source) { $title = $b['title']; $body = $b['body']; // Insert a newline before and after a quote @@ -177,7 +174,7 @@ function libertree_send(array &$b) // Removal of tags and mentions // #-tags $body = preg_replace('/#\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '#$2', $body); - // @-mentions + // @-mentions $body = preg_replace('/@\[url\=(\w+.*?)\](\w+.*?)\[\/url\]/i', '@$2', $body); // remove multiple newlines @@ -198,10 +195,10 @@ function libertree_send(array &$b) $params = [ 'text' => $body, 'source' => $ltree_source - // 'token' => $ltree_api_token + // 'token' => $ltree_api_token ]; - $result = DI::httpClient()->post($ltree_blog, $params)->getBody(); - Logger::notice('libertree: ' . $result); + $result = DI::httpClient()->post($ltree_blog, $params)->getBodyString(); + DI::logger()->notice('libertree: ' . $result); } } diff --git a/libravatar/Services/Libravatar.php b/libravatar/Services/Libravatar.php index 18aa5c90..8b3dd493 100644 --- a/libravatar/Services/Libravatar.php +++ b/libravatar/Services/Libravatar.php @@ -217,7 +217,7 @@ class Services_Libravatar * * @param array $options Array of options for getUrl() * - * @return void + * @return array * @throws Exception When an invalid option is used */ protected function checkOptionsArray($options) @@ -361,7 +361,7 @@ class Services_Libravatar protected function domainGet($identifier) { if ($identifier === null) { - return null; + return ''; } // What are we, email or openid? Split ourself up and get the @@ -401,9 +401,8 @@ class Services_Libravatar */ protected function srvGet($domain, $https = false) { - // Are we going secure? Set up a fallback too. - if (isset($https) && $https === true) { + if ($https === true) { $subdomain = '_avatars-sec._tcp.'; $fallback = 'seccdn.'; } else { @@ -426,6 +425,7 @@ class Services_Libravatar $top = $srv[0]; $sum = 0; + $pri = []; // Try to adhere to RFC2782's weighting algorithm, page 3 // "arrange all SRV RRs (that have not been ordered yet) in any order, @@ -462,6 +462,8 @@ class Services_Libravatar return $v['target']; } } + + return ''; } /** diff --git a/libravatar/lang/bg/messages.po b/libravatar/lang/bg/messages.po new file mode 100644 index 00000000..4b377dc3 --- /dev/null +++ b/libravatar/lang/bg/messages.po @@ -0,0 +1,70 @@ +# ADDON libravatar +# Copyright (C) +# This file is distributed under the same license as the Friendica libravatar addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2014-06-23 09:49+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: libravatar.php:68 +msgid "generic profile image" +msgstr "" + +#: libravatar.php:69 +msgid "random geometric pattern" +msgstr "" + +#: libravatar.php:70 +msgid "monster face" +msgstr "" + +#: libravatar.php:71 +msgid "computer generated face" +msgstr "" + +#: libravatar.php:72 +msgid "retro arcade style face" +msgstr "" + +#: libravatar.php:73 +msgid "roboter face" +msgstr "" + +#: libravatar.php:74 +msgid "retro adventure game character" +msgstr "" + +#: libravatar.php:78 +msgid "Information" +msgstr "" + +#: libravatar.php:78 +msgid "" +"Gravatar addon is installed. Please disable the Gravatar addon.
The " +"Libravatar addon will fall back to Gravatar if nothing was found at " +"Libravatar." +msgstr "" + +#: libravatar.php:83 +msgid "Save Settings" +msgstr "" + +#: libravatar.php:84 +msgid "Default avatar image" +msgstr "" + +#: libravatar.php:84 +msgid "Select default avatar image if none was found. See README" +msgstr "" diff --git a/libravatar/lang/bg/strings.php b/libravatar/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/libravatar/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: libravatar.php:68 +msgid "generic profile image" +msgstr "" + +#: libravatar.php:69 +msgid "random geometric pattern" +msgstr "" + +#: libravatar.php:70 +msgid "monster face" +msgstr "" + +#: libravatar.php:71 +msgid "computer generated face" +msgstr "" + +#: libravatar.php:72 +msgid "retro arcade style face" +msgstr "" + +#: libravatar.php:73 +msgid "roboter face" +msgstr "" + +#: libravatar.php:74 +msgid "retro adventure game character" +msgstr "" + +#: libravatar.php:78 +msgid "Information" +msgstr "" + +#: libravatar.php:78 +msgid "" +"Gravatar addon is installed. Please disable the Gravatar addon.
The " +"Libravatar addon will fall back to Gravatar if nothing was found at " +"Libravatar." +msgstr "" + +#: libravatar.php:83 +msgid "Save Settings" +msgstr "" + +#: libravatar.php:84 +msgid "Default avatar image" +msgstr "" + +#: libravatar.php:84 +msgid "Select default avatar image if none was found. See README" +msgstr "" diff --git a/libravatar/lang/ca/strings.php b/libravatar/lang/ca/strings.php index f921b9fd..d34874f6 100644 --- a/libravatar/lang/ca/strings.php +++ b/libravatar/lang/ca/strings.php @@ -1,17 +1,7 @@ -strings["Could NOT install Libravatar successfully.
It requires PHP >= 5.3"] = "No puc instal·lar Libravatar ,
requereix PHP>=5.3"; -$a->strings["generic profile image"] = "imatge de perfil genérica"; -$a->strings["random geometric pattern"] = "Patró geometric aleatori"; -$a->strings["monster face"] = "Cara monstruosa"; -$a->strings["computer generated face"] = "Cara monstruosa generada per ordinador"; -$a->strings["retro arcade style face"] = "Cara d'estil arcade retro"; -$a->strings["Warning"] = "Avís"; -$a->strings["Your PHP version %s is lower than the required PHP >= 5.3."] = "La teva versió de PHP %s es inferior a la requerida, PHP>=5.3"; -$a->strings["This addon is not functional on your server."] = "Aquest addon no es funcional al teu servidor."; -$a->strings["Information"] = "informació"; -$a->strings["Gravatar addon is installed. Please disable the Gravatar addon.
The Libravatar addon will fall back to Gravatar if nothing was found at Libravatar."] = "el addon Gravatar està instal·lat. Si us plau, desactiva el addon Gravatar.
El addon Libravatar tornarà a Gravatar si no es trova res a Libravatar."; -$a->strings["Submit"] = "Enviar"; -$a->strings["Default avatar image"] = "Imatge d'avatar per defecte"; -$a->strings["Select default avatar image if none was found. See README"] = "seleccionada la imatge d'avatar per defecte si no es trova cap altre. Veure README"; -$a->strings["Libravatar settings updated."] = "Ajustos de Libravatar actualitzats."; +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: libravatar.php:68 +msgid "generic profile image" +msgstr "" + +#: libravatar.php:69 +msgid "random geometric pattern" +msgstr "" + +#: libravatar.php:70 +msgid "monster face" +msgstr "" + +#: libravatar.php:71 +msgid "computer generated face" +msgstr "" + +#: libravatar.php:72 +msgid "retro arcade style face" +msgstr "" + +#: libravatar.php:73 +msgid "roboter face" +msgstr "" + +#: libravatar.php:74 +msgid "retro adventure game character" +msgstr "" + +#: libravatar.php:78 +msgid "Information" +msgstr "" + +#: libravatar.php:78 +msgid "" +"Gravatar addon is installed. Please disable the Gravatar addon.
The " +"Libravatar addon will fall back to Gravatar if nothing was found at " +"Libravatar." +msgstr "" + +#: libravatar.php:83 +msgid "Save Settings" +msgstr "" + +#: libravatar.php:84 +msgid "Default avatar image" +msgstr "" + +#: libravatar.php:84 +msgid "Select default avatar image if none was found. See README" +msgstr "" diff --git a/libravatar/lang/eo/strings.php b/libravatar/lang/eo/strings.php index 455f0e2a..68e8a64c 100644 --- a/libravatar/lang/eo/strings.php +++ b/libravatar/lang/eo/strings.php @@ -1,17 +1,7 @@ -strings["Could NOT install Libravatar successfully.
It requires PHP >= 5.3"] = "NE SUKCESIS instali la bibliotekon Libravatar.
Ĝi bezonas PHP >= 5.3"; -$a->strings["generic profile image"] = "komuna profilbildo"; -$a->strings["random geometric pattern"] = "loteca geometria skemo"; -$a->strings["monster face"] = "monstrobildo"; -$a->strings["computer generated face"] = "komputita vizaĝo"; -$a->strings["retro arcade style face"] = "retrostila videoludstila vizaĝo"; -$a->strings["Warning"] = "Averto"; -$a->strings["Your PHP version %s is lower than the required PHP >= 5.3."] = "Via PHP versio %s estas malpli alta ol la bezonata PHP >= 5.3."; -$a->strings["This addon is not functional on your server."] = "Tiu ĉi kromprogramo ne funkcieblas je via servilo."; -$a->strings["Information"] = "Informo"; -$a->strings["Gravatar addon is installed. Please disable the Gravatar addon.
The Libravatar addon will fall back to Gravatar if nothing was found at Libravatar."] = "La Gravatar kromprogramo estas instalita. Bonvolu malŝalti la Gravatar kromprogramon.
'; - $output .= $this->addRow('Message', $record->message); - $output .= $this->addRow('Time', $this->formatDate($record->datetime)); - $output .= $this->addRow('Channel', $record->channel); - if (\count($record->context) > 0) { + $output .= $this->addRow('Message', (string) $record['message']); + $output .= $this->addRow('Time', $this->formatDate($record['datetime'])); + $output .= $this->addRow('Channel', $record['channel']); + if ($record['context']) { $embeddedTable = '
'; - foreach ($record->context as $key => $value) { + foreach ($record['context'] as $key => $value) { $embeddedTable .= $this->addRow((string) $key, $this->convertToString($value)); } $embeddedTable .= '
'; $output .= $this->addRow('Context', $embeddedTable, false); } - if (\count($record->extra) > 0) { + if ($record['extra']) { $embeddedTable = ''; - foreach ($record->extra as $key => $value) { + foreach ($record['extra'] as $key => $value) { $embeddedTable .= $this->addRow((string) $key, $this->convertToString($value)); } $embeddedTable .= '
'; diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php index b2fc5bcb..b737d82e 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/JsonFormatter.php @@ -11,9 +11,7 @@ namespace Monolog\Formatter; -use Stringable; use Throwable; -use Monolog\LogRecord; /** * Encodes whatever record data is passed to it as json @@ -21,6 +19,8 @@ use Monolog\LogRecord; * This can be useful to log to databases or remote APIs * * @author Jordi Boggiano + * + * @phpstan-import-type Record from \Monolog\Logger */ class JsonFormatter extends NormalizerFormatter { @@ -28,13 +28,13 @@ class JsonFormatter extends NormalizerFormatter public const BATCH_MODE_NEWLINES = 2; /** @var self::BATCH_MODE_* */ - protected int $batchMode; - - protected bool $appendNewline; - - protected bool $ignoreEmptyContextAndExtra; - - protected bool $includeStacktraces = false; + protected $batchMode; + /** @var bool */ + protected $appendNewline; + /** @var bool */ + protected $ignoreEmptyContextAndExtra; + /** @var bool */ + protected $includeStacktraces = false; /** * @param self::BATCH_MODE_* $batchMode @@ -70,11 +70,11 @@ class JsonFormatter extends NormalizerFormatter } /** - * @inheritDoc + * {@inheritDoc} */ - public function format(LogRecord $record): string + public function format(array $record): string { - $normalized = parent::format($record); + $normalized = $this->normalize($record); if (isset($normalized['context']) && $normalized['context'] === []) { if ($this->ignoreEmptyContextAndExtra) { @@ -95,16 +95,23 @@ class JsonFormatter extends NormalizerFormatter } /** - * @inheritDoc + * {@inheritDoc} */ public function formatBatch(array $records): string { - return match ($this->batchMode) { - static::BATCH_MODE_NEWLINES => $this->formatBatchNewlines($records), - default => $this->formatBatchJson($records), - }; + switch ($this->batchMode) { + case static::BATCH_MODE_NEWLINES: + return $this->formatBatchNewlines($records); + + case static::BATCH_MODE_JSON: + default: + return $this->formatBatchJson($records); + } } + /** + * @return self + */ public function includeStacktraces(bool $include = true): self { $this->includeStacktraces = $include; @@ -115,7 +122,7 @@ class JsonFormatter extends NormalizerFormatter /** * Return a JSON-encoded array of records. * - * @phpstan-param LogRecord[] $records + * @phpstan-param Record[] $records */ protected function formatBatchJson(array $records): string { @@ -126,24 +133,30 @@ class JsonFormatter extends NormalizerFormatter * Use new lines to separate records instead of a * JSON-encoded array. * - * @phpstan-param LogRecord[] $records + * @phpstan-param Record[] $records */ protected function formatBatchNewlines(array $records): string { + $instance = $this; + $oldNewline = $this->appendNewline; $this->appendNewline = false; - $formatted = array_map(fn (LogRecord $record) => $this->format($record), $records); + array_walk($records, function (&$value, $key) use ($instance) { + $value = $instance->format($value); + }); $this->appendNewline = $oldNewline; - return implode("\n", $formatted); + return implode("\n", $records); } /** * Normalizes given $data. * - * @return null|scalar|array|object + * @param mixed $data + * + * @return mixed */ - protected function normalize(mixed $data, int $depth = 0): mixed + protected function normalize($data, int $depth = 0) { if ($depth > $this->maxNormalizeDepth) { return 'Over '.$this->maxNormalizeDepth.' levels deep, aborting normalization'; @@ -179,7 +192,7 @@ class JsonFormatter extends NormalizerFormatter return $data; } - if ($data instanceof Stringable) { + if (method_exists($data, '__toString')) { return $data->__toString(); } @@ -197,7 +210,7 @@ class JsonFormatter extends NormalizerFormatter * Normalizes given exception with or without its own stack trace based on * `includeStacktraces` property. * - * @inheritDoc + * {@inheritDoc} */ protected function normalizeException(Throwable $e, int $depth = 0): array { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php index 19fb72c5..e6e78983 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/LineFormatter.php @@ -11,9 +11,7 @@ namespace Monolog\Formatter; -use Closure; use Monolog\Utils; -use Monolog\LogRecord; /** * Formats incoming records into a one-line string @@ -27,16 +25,22 @@ class LineFormatter extends NormalizerFormatter { public const SIMPLE_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"; - protected string $format; - protected bool $allowInlineLineBreaks; - protected bool $ignoreEmptyContextAndExtra; - protected bool $includeStacktraces; - protected Closure|null $stacktracesParser = null; + /** @var string */ + protected $format; + /** @var bool */ + protected $allowInlineLineBreaks; + /** @var bool */ + protected $ignoreEmptyContextAndExtra; + /** @var bool */ + protected $includeStacktraces; + /** @var ?callable */ + protected $stacktracesParser; /** - * @param string|null $format The format of the message - * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format - * @param bool $allowInlineLineBreaks Whether to allow inline line breaks in log entries + * @param string|null $format The format of the message + * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format + * @param bool $allowInlineLineBreaks Whether to allow inline line breaks in log entries + * @param bool $ignoreEmptyContextAndExtra */ public function __construct(?string $format = null, ?string $dateFormat = null, bool $allowInlineLineBreaks = false, bool $ignoreEmptyContextAndExtra = false, bool $includeStacktraces = false) { @@ -47,7 +51,7 @@ class LineFormatter extends NormalizerFormatter parent::__construct($dateFormat); } - public function includeStacktraces(bool $include = true, ?Closure $parser = null): self + public function includeStacktraces(bool $include = true, ?callable $parser = null): self { $this->includeStacktraces = $include; if ($this->includeStacktraces) { @@ -73,13 +77,14 @@ class LineFormatter extends NormalizerFormatter } /** - * @inheritDoc + * {@inheritDoc} */ - public function format(LogRecord $record): string + public function format(array $record): string { $vars = parent::format($record); $output = $this->format; + foreach ($vars['extra'] as $var => $val) { if (false !== strpos($output, '%extra.'.$var.'%')) { $output = str_replace('%extra.'.$var.'%', $this->stringify($val), $output); @@ -95,12 +100,12 @@ class LineFormatter extends NormalizerFormatter } if ($this->ignoreEmptyContextAndExtra) { - if (\count($vars['context']) === 0) { + if (empty($vars['context'])) { unset($vars['context']); $output = str_replace('%context%', '', $output); } - if (\count($vars['extra']) === 0) { + if (empty($vars['extra'])) { unset($vars['extra']); $output = str_replace('%extra%', '', $output); } @@ -117,7 +122,6 @@ class LineFormatter extends NormalizerFormatter $output = preg_replace('/%(?:extra|context)\..+?%/', '', $output); if (null === $output) { $pcreErrorCode = preg_last_error(); - throw new \RuntimeException('Failed to run preg_replace: ' . $pcreErrorCode . ' / ' . Utils::pcreLastErrorMessage($pcreErrorCode)); } } @@ -147,11 +151,11 @@ class LineFormatter extends NormalizerFormatter { $str = $this->formatException($e); - if (($previous = $e->getPrevious()) instanceof \Throwable) { + if ($previous = $e->getPrevious()) { do { $depth++; if ($depth > $this->maxNormalizeDepth) { - $str .= '\n[previous exception] Over ' . $this->maxNormalizeDepth . ' levels deep, aborting normalization'; + $str .= "\n[previous exception] Over " . $this->maxNormalizeDepth . ' levels deep, aborting normalization'; break; } @@ -228,7 +232,7 @@ class LineFormatter extends NormalizerFormatter { $trace = $e->getTraceAsString(); - if ($this->stacktracesParser !== null) { + if ($this->stacktracesParser) { $trace = $this->stacktracesParserCustom($trace); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php index 5f0b6a45..29841aa3 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/LogglyFormatter.php @@ -11,8 +11,6 @@ namespace Monolog\Formatter; -use Monolog\LogRecord; - /** * Encodes message information into JSON in a format compatible with Loggly. * @@ -35,13 +33,13 @@ class LogglyFormatter extends JsonFormatter * @see https://www.loggly.com/docs/automated-parsing/#json * @see \Monolog\Formatter\JsonFormatter::format() */ - protected function normalizeRecord(LogRecord $record): array + public function format(array $record): string { - $recordData = parent::normalizeRecord($record); + if (isset($record["datetime"]) && ($record["datetime"] instanceof \DateTimeInterface)) { + $record["timestamp"] = $record["datetime"]->format("Y-m-d\TH:i:s.uO"); + unset($record["datetime"]); + } - $recordData["timestamp"] = $record->datetime->format("Y-m-d\TH:i:s.uO"); - unset($recordData["datetime"]); - - return $recordData; + return parent::format($record); } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/LogmaticFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/LogmaticFormatter.php index 10ad0d9c..b0451aba 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/LogmaticFormatter.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/LogmaticFormatter.php @@ -11,8 +11,6 @@ namespace Monolog\Formatter; -use Monolog\LogRecord; - /** * Encodes message information into JSON in a format compatible with Logmatic. * @@ -22,9 +20,15 @@ class LogmaticFormatter extends JsonFormatter { protected const MARKERS = ["sourcecode", "php"]; - protected string $hostname = ''; + /** + * @var string + */ + protected $hostname = ''; - protected string $appName = ''; + /** + * @var string + */ + protected $appname = ''; public function setHostname(string $hostname): self { @@ -33,9 +37,9 @@ class LogmaticFormatter extends JsonFormatter return $this; } - public function setAppName(string $appName): self + public function setAppname(string $appname): self { - $this->appName = $appName; + $this->appname = $appname; return $this; } @@ -46,19 +50,17 @@ class LogmaticFormatter extends JsonFormatter * @see http://doc.logmatic.io/docs/basics-to-send-data * @see \Monolog\Formatter\JsonFormatter::format() */ - public function normalizeRecord(LogRecord $record): array + public function format(array $record): string { - $record = parent::normalizeRecord($record); - - if ($this->hostname !== '') { + if (!empty($this->hostname)) { $record["hostname"] = $this->hostname; } - if ($this->appName !== '') { - $record["appname"] = $this->appName; + if (!empty($this->appname)) { + $record["appname"] = $this->appname; } $record["@marker"] = static::MARKERS; - return $record; + return parent::format($record); } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php index d0e8749e..f8de0d33 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/LogstashFormatter.php @@ -11,8 +11,6 @@ namespace Monolog\Formatter; -use Monolog\LogRecord; - /** * Serializes a log message to Logstash Event Format * @@ -26,22 +24,22 @@ class LogstashFormatter extends NormalizerFormatter /** * @var string the name of the system for the Logstash log message, used to fill the @source field */ - protected string $systemName; + protected $systemName; /** * @var string an application name for the Logstash log message, used to fill the @type field */ - protected string $applicationName; + protected $applicationName; /** * @var string the key for 'extra' fields from the Monolog record */ - protected string $extraKey; + protected $extraKey; /** * @var string the key for 'context' fields from the Monolog record */ - protected string $contextKey; + protected $contextKey; /** * @param string $applicationName The application that sends the data, used as the "type" field of logstash @@ -61,38 +59,41 @@ class LogstashFormatter extends NormalizerFormatter } /** - * @inheritDoc + * {@inheritDoc} */ - public function format(LogRecord $record): string + public function format(array $record): string { - $recordData = parent::format($record); + $record = parent::format($record); + if (empty($record['datetime'])) { + $record['datetime'] = gmdate('c'); + } $message = [ - '@timestamp' => $recordData['datetime'], + '@timestamp' => $record['datetime'], '@version' => 1, 'host' => $this->systemName, ]; - if (isset($recordData['message'])) { - $message['message'] = $recordData['message']; + if (isset($record['message'])) { + $message['message'] = $record['message']; } - if (isset($recordData['channel'])) { - $message['type'] = $recordData['channel']; - $message['channel'] = $recordData['channel']; + if (isset($record['channel'])) { + $message['type'] = $record['channel']; + $message['channel'] = $record['channel']; } - if (isset($recordData['level_name'])) { - $message['level'] = $recordData['level_name']; + if (isset($record['level_name'])) { + $message['level'] = $record['level_name']; } - if (isset($recordData['level'])) { - $message['monolog_level'] = $recordData['level']; + if (isset($record['level'])) { + $message['monolog_level'] = $record['level']; } - if ('' !== $this->applicationName) { + if ($this->applicationName) { $message['type'] = $this->applicationName; } - if (\count($recordData['extra']) > 0) { - $message[$this->extraKey] = $recordData['extra']; + if (!empty($record['extra'])) { + $message[$this->extraKey] = $record['extra']; } - if (\count($recordData['context']) > 0) { - $message[$this->contextKey] = $recordData['context']; + if (!empty($record['context'])) { + $message[$this->contextKey] = $record['context']; } return $this->toJson($message) . "\n"; diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php index a3bdd4f8..fca69a89 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/MongoDBFormatter.php @@ -14,7 +14,6 @@ namespace Monolog\Formatter; use MongoDB\BSON\Type; use MongoDB\BSON\UTCDateTime; use Monolog\Utils; -use Monolog\LogRecord; /** * Formats a record for use with the MongoDBHandler. @@ -23,12 +22,15 @@ use Monolog\LogRecord; */ class MongoDBFormatter implements FormatterInterface { - private bool $exceptionTraceAsString; - private int $maxNestingLevel; - private bool $isLegacyMongoExt; + /** @var bool */ + private $exceptionTraceAsString; + /** @var int */ + private $maxNestingLevel; + /** @var bool */ + private $isLegacyMongoExt; /** - * @param int $maxNestingLevel 0 means infinite nesting, the $record itself is level 1, $record->context is 2 + * @param int $maxNestingLevel 0 means infinite nesting, the $record itself is level 1, $record['context'] is 2 * @param bool $exceptionTraceAsString set to false to log exception traces as a sub documents instead of strings */ public function __construct(int $maxNestingLevel = 3, bool $exceptionTraceAsString = true) @@ -40,20 +42,20 @@ class MongoDBFormatter implements FormatterInterface } /** - * @inheritDoc + * {@inheritDoc} * * @return mixed[] */ - public function format(LogRecord $record): array + public function format(array $record): array { /** @var mixed[] $res */ - $res = $this->formatArray($record->toArray()); + $res = $this->formatArray($record); return $res; } /** - * @inheritDoc + * {@inheritDoc} * * @return array */ diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php index 1323587b..f926a842 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php @@ -14,7 +14,6 @@ namespace Monolog\Formatter; use Monolog\DateTimeImmutable; use Monolog\Utils; use Throwable; -use Monolog\LogRecord; /** * Normalizes incoming records to remove objects/resources so it's easier to dump to various targets @@ -25,11 +24,15 @@ class NormalizerFormatter implements FormatterInterface { public const SIMPLE_DATE = "Y-m-d\TH:i:sP"; - protected string $dateFormat; - protected int $maxNormalizeDepth = 9; - protected int $maxNormalizeItemCount = 1000; + /** @var string */ + protected $dateFormat; + /** @var int */ + protected $maxNormalizeDepth = 9; + /** @var int */ + protected $maxNormalizeItemCount = 1000; - private int $jsonEncodeOptions = Utils::DEFAULT_JSON_FLAGS; + /** @var int */ + private $jsonEncodeOptions = Utils::DEFAULT_JSON_FLAGS; /** * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format @@ -43,25 +46,17 @@ class NormalizerFormatter implements FormatterInterface } /** - * @inheritDoc - */ - public function format(LogRecord $record) - { - return $this->normalizeRecord($record); - } - - /** - * Normalize an arbitrary value to a scalar|array|null + * {@inheritDoc} * - * @return null|scalar|array + * @param mixed[] $record */ - public function normalizeValue(mixed $data): mixed + public function format(array $record) { - return $this->normalize($data); + return $this->normalize($record); } /** - * @inheritDoc + * {@inheritDoc} */ public function formatBatch(array $records) { @@ -129,25 +124,10 @@ class NormalizerFormatter implements FormatterInterface } /** - * Provided as extension point - * - * Because normalize is called with sub-values of context data etc, normalizeRecord can be - * extended when data needs to be appended on the record array but not to other normalized data. - * - * @return array + * @param mixed $data + * @return null|scalar|array */ - protected function normalizeRecord(LogRecord $record): array - { - /** @var array $normalized */ - $normalized = $this->normalize($record->toArray()); - - return $normalized; - } - - /** - * @return null|scalar|array - */ - protected function normalize(mixed $data, int $depth = 0): mixed + protected function normalize($data, int $depth = 0) { if ($depth > $this->maxNormalizeDepth) { return 'Over ' . $this->maxNormalizeDepth . ' levels deep, aborting normalization'; @@ -192,14 +172,17 @@ class NormalizerFormatter implements FormatterInterface } if ($data instanceof \JsonSerializable) { - /** @var null|scalar|array $value */ + /** @var null|scalar|array $value */ $value = $data->jsonSerialize(); + } elseif (\get_class($data) === '__PHP_Incomplete_Class') { + $accessor = new \ArrayObject($data); + $value = (string) $accessor['__PHP_Incomplete_Class_Name']; } elseif (method_exists($data, '__toString')) { /** @var string $value */ $value = $data->__toString(); } else { // the rest is normalized by json encoding and decoding it - /** @var null|scalar|array $value */ + /** @var null|scalar|array $value */ $value = json_decode($this->toJson($data, true), true); } @@ -253,12 +236,12 @@ class NormalizerFormatter implements FormatterInterface $trace = $e->getTrace(); foreach ($trace as $frame) { - if (isset($frame['file'], $frame['line'])) { + if (isset($frame['file'])) { $data['trace'][] = $frame['file'].':'.$frame['line']; } } - if (($previous = $e->getPrevious()) instanceof \Throwable) { + if ($previous = $e->getPrevious()) { $data['previous'] = $this->normalizeException($previous, $depth + 1); } @@ -277,7 +260,10 @@ class NormalizerFormatter implements FormatterInterface return Utils::jsonEncode($data, $this->jsonEncodeOptions, $ignoreErrors); } - protected function formatDate(\DateTimeInterface $date): string + /** + * @return string + */ + protected function formatDate(\DateTimeInterface $date) { // in case the date format isn't custom then we defer to the custom DateTimeImmutable // formatting logic, which will pick the right format based on whether useMicroseconds is on diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php index 4bc20a08..187bc550 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/ScalarFormatter.php @@ -11,10 +11,8 @@ namespace Monolog\Formatter; -use Monolog\LogRecord; - /** - * Formats data into an associative array of scalar (+ null) values. + * Formats data into an associative array of scalar values. * Objects and arrays will be JSON encoded. * * @author Andrew Lawson @@ -22,21 +20,25 @@ use Monolog\LogRecord; class ScalarFormatter extends NormalizerFormatter { /** - * @inheritDoc + * {@inheritDoc} * * @phpstan-return array $record */ - public function format(LogRecord $record): array + public function format(array $record): array { $result = []; - foreach ($record->toArray() as $key => $value) { - $result[$key] = $this->toScalar($value); + foreach ($record as $key => $value) { + $result[$key] = $this->normalizeValue($value); } return $result; } - protected function toScalar(mixed $value): string|int|float|bool|null + /** + * @param mixed $value + * @return scalar|null + */ + protected function normalizeValue($value) { $normalized = $this->normalize($value); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/SyslogFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/SyslogFormatter.php deleted file mode 100644 index 6ed7e92e..00000000 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/SyslogFormatter.php +++ /dev/null @@ -1,66 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog\Formatter; - -use Monolog\Level; -use Monolog\LogRecord; - -/** - * Serializes a log message according to RFC 5424 - * - * @author Dalibor Karlović - * @author Renat Gabdullin - */ -class SyslogFormatter extends LineFormatter -{ - private const SYSLOG_FACILITY_USER = 1; - private const FORMAT = "<%extra.priority%>1 %datetime% %extra.hostname% %extra.app-name% %extra.procid% %channel% %extra.structured-data% %level_name%: %message% %context% %extra%\n"; - private const NILVALUE = '-'; - - private string $hostname; - private int $procid; - - public function __construct(private string $applicationName = self::NILVALUE) - { - parent::__construct(self::FORMAT, 'Y-m-d\TH:i:s.uP', true, true); - $this->hostname = (string) gethostname(); - $this->procid = (int) getmypid(); - } - - public function format(LogRecord $record): string - { - $record->extra = $this->formatExtra($record); - - return parent::format($record); - } - - /** - * @param LogRecord $record - * @return array - */ - private function formatExtra(LogRecord $record): array - { - $extra = $record->extra; - $extra['app-name'] = $this->applicationName; - $extra['hostname'] = $this->hostname; - $extra['procid'] = $this->procid; - $extra['priority'] = self::calculatePriority($record->level); - $extra['structured-data'] = self::NILVALUE; - - return $extra; - } - - private static function calculatePriority(Level $level): int - { - return (self::SYSLOG_FACILITY_USER * 8) + $level->toRFC5424Level(); - } -} diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php index 8ef7b7d1..6539b347 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Formatter/WildfireFormatter.php @@ -11,8 +11,7 @@ namespace Monolog\Formatter; -use Monolog\Level; -use Monolog\LogRecord; +use Monolog\Logger; /** * Serializes a log message according to Wildfire's header requirements @@ -20,9 +19,27 @@ use Monolog\LogRecord; * @author Eric Clemmons (@ericclemmons) * @author Christophe Coevoet * @author Kirill chEbba Chebunin + * + * @phpstan-import-type Level from \Monolog\Logger */ class WildfireFormatter extends NormalizerFormatter { + /** + * Translates Monolog log levels to Wildfire levels. + * + * @var array + */ + private $logLevels = [ + Logger::DEBUG => 'LOG', + Logger::INFO => 'INFO', + Logger::NOTICE => 'INFO', + Logger::WARNING => 'WARN', + Logger::ERROR => 'ERROR', + Logger::CRITICAL => 'ERROR', + Logger::ALERT => 'ERROR', + Logger::EMERGENCY => 'ERROR', + ]; + /** * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format */ @@ -35,61 +52,46 @@ class WildfireFormatter extends NormalizerFormatter } /** - * Translates Monolog log levels to Wildfire levels. + * {@inheritDoc} * - * @return 'LOG'|'INFO'|'WARN'|'ERROR' + * @return string */ - private function toWildfireLevel(Level $level): string - { - return match ($level) { - Level::Debug => 'LOG', - Level::Info => 'INFO', - Level::Notice => 'INFO', - Level::Warning => 'WARN', - Level::Error => 'ERROR', - Level::Critical => 'ERROR', - Level::Alert => 'ERROR', - Level::Emergency => 'ERROR', - }; - } - - /** - * @inheritDoc - */ - public function format(LogRecord $record): string + public function format(array $record): string { // Retrieve the line and file if set and remove them from the formatted extra $file = $line = ''; - if (isset($record->extra['file'])) { - $file = $record->extra['file']; - unset($record->extra['file']); + if (isset($record['extra']['file'])) { + $file = $record['extra']['file']; + unset($record['extra']['file']); } - if (isset($record->extra['line'])) { - $line = $record->extra['line']; - unset($record->extra['line']); + if (isset($record['extra']['line'])) { + $line = $record['extra']['line']; + unset($record['extra']['line']); } - $message = ['message' => $record->message]; + /** @var mixed[] $record */ + $record = $this->normalize($record); + $message = ['message' => $record['message']]; $handleError = false; - if (count($record->context) > 0) { - $message['context'] = $this->normalize($record->context); + if ($record['context']) { + $message['context'] = $record['context']; $handleError = true; } - if (count($record->extra) > 0) { - $message['extra'] = $this->normalize($record->extra); + if ($record['extra']) { + $message['extra'] = $record['extra']; $handleError = true; } if (count($message) === 1) { $message = reset($message); } - if (is_array($message) && isset($message['context']['table'])) { + if (isset($record['context']['table'])) { $type = 'TABLE'; - $label = $record->channel .': '. $record->message; - $message = $message['context']['table']; + $label = $record['channel'] .': '. $record['message']; + $message = $record['context']['table']; } else { - $type = $this->toWildfireLevel($record->level); - $label = $record->channel; + $type = $this->logLevels[$record['level']]; + $label = $record['channel']; } // Create JSON object describing the appearance of the message in the console @@ -112,7 +114,7 @@ class WildfireFormatter extends NormalizerFormatter } /** - * @inheritDoc + * {@inheritDoc} * * @phpstan-return never */ @@ -122,11 +124,11 @@ class WildfireFormatter extends NormalizerFormatter } /** - * @inheritDoc + * {@inheritDoc} * - * @return null|scalar|array|object + * @return null|scalar|array|object */ - protected function normalize(mixed $data, int $depth = 0): mixed + protected function normalize($data, int $depth = 0) { if (is_object($data) && !$data instanceof \DateTimeInterface) { return $data; diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php index 3399a54e..a5cdaa71 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/AbstractHandler.php @@ -11,50 +11,55 @@ namespace Monolog\Handler; -use Monolog\Level; use Monolog\Logger; use Monolog\ResettableInterface; use Psr\Log\LogLevel; -use Monolog\LogRecord; /** * Base Handler class providing basic level/bubble support * * @author Jordi Boggiano + * + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger */ abstract class AbstractHandler extends Handler implements ResettableInterface { - protected Level $level = Level::Debug; - protected bool $bubble = true; + /** + * @var int + * @phpstan-var Level + */ + protected $level = Logger::DEBUG; + /** @var bool */ + protected $bubble = true; /** - * @param int|string|Level|LogLevel::* $level The minimum logging level at which this handler will be triggered - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param int|string $level The minimum logging level at which this handler will be triggered + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * - * @phpstan-param value-of|value-of|Level|LogLevel::* $level + * @phpstan-param Level|LevelName|LogLevel::* $level */ - public function __construct(int|string|Level $level = Level::Debug, bool $bubble = true) + public function __construct($level = Logger::DEBUG, bool $bubble = true) { $this->setLevel($level); $this->bubble = $bubble; } /** - * @inheritDoc + * {@inheritDoc} */ - public function isHandling(LogRecord $record): bool + public function isHandling(array $record): bool { - return $record->level->value >= $this->level->value; + return $record['level'] >= $this->level; } /** * Sets minimum logging level at which this handler will be triggered. * - * @param Level|LogLevel::* $level Level or level name - * - * @phpstan-param value-of|value-of|Level|LogLevel::* $level + * @param Level|LevelName|LogLevel::* $level Level or level name + * @return self */ - public function setLevel(int|string|Level $level): self + public function setLevel($level): self { $this->level = Logger::toMonologLevel($level); @@ -63,8 +68,12 @@ abstract class AbstractHandler extends Handler implements ResettableInterface /** * Gets minimum logging level at which this handler will be triggered. + * + * @return int + * + * @phpstan-return Level */ - public function getLevel(): Level + public function getLevel(): int { return $this->level; } @@ -72,8 +81,9 @@ abstract class AbstractHandler extends Handler implements ResettableInterface /** * Sets the bubbling behavior. * - * @param bool $bubble true means that this handler allows bubbling. - * false means that bubbling is not permitted. + * @param bool $bubble true means that this handler allows bubbling. + * false means that bubbling is not permitted. + * @return self */ public function setBubble(bool $bubble): self { @@ -94,9 +104,9 @@ abstract class AbstractHandler extends Handler implements ResettableInterface } /** - * @inheritDoc + * {@inheritDoc} */ - public function reset(): void + public function reset() { } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php index de13a76b..77e533fc 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php @@ -11,8 +11,6 @@ namespace Monolog\Handler; -use Monolog\LogRecord; - /** * Base Handler class providing the Handler structure, including processors and formatters * @@ -20,6 +18,11 @@ use Monolog\LogRecord; * * @author Jordi Boggiano * @author Christophe Coevoet + * + * @phpstan-import-type LevelName from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-type FormattedRecord array{message: string, context: mixed[], level: Level, level_name: LevelName, channel: string, datetime: \DateTimeImmutable, extra: mixed[], formatted: mixed} */ abstract class AbstractProcessingHandler extends AbstractHandler implements ProcessableHandlerInterface, FormattableHandlerInterface { @@ -27,19 +30,20 @@ abstract class AbstractProcessingHandler extends AbstractHandler implements Proc use FormattableHandlerTrait; /** - * @inheritDoc + * {@inheritDoc} */ - public function handle(LogRecord $record): bool + public function handle(array $record): bool { if (!$this->isHandling($record)) { return false; } - if (\count($this->processors) > 0) { + if ($this->processors) { + /** @var Record $record */ $record = $this->processRecord($record); } - $record->formatted = $this->getFormatter()->format($record); + $record['formatted'] = $this->getFormatter()->format($record); $this->write($record); @@ -47,11 +51,16 @@ abstract class AbstractProcessingHandler extends AbstractHandler implements Proc } /** - * Writes the (already formatted) record down to the log of the implementing handler + * Writes the record down to the log of the implementing handler + * + * @phpstan-param FormattedRecord $record */ - abstract protected function write(LogRecord $record): void; + abstract protected function write(array $record): void; - public function reset(): void + /** + * @return void + */ + public function reset() { parent::reset(); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php index 695a1c07..5e5ad1c1 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/AbstractSyslogHandler.php @@ -11,59 +11,70 @@ namespace Monolog\Handler; -use Monolog\Level; +use Monolog\Logger; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\LineFormatter; /** * Common syslog functionality + * + * @phpstan-import-type Level from \Monolog\Logger */ abstract class AbstractSyslogHandler extends AbstractProcessingHandler { - protected int $facility; + /** @var int */ + protected $facility; + + /** + * Translates Monolog log levels to syslog log priorities. + * @var array + * @phpstan-var array + */ + protected $logLevels = [ + Logger::DEBUG => LOG_DEBUG, + Logger::INFO => LOG_INFO, + Logger::NOTICE => LOG_NOTICE, + Logger::WARNING => LOG_WARNING, + Logger::ERROR => LOG_ERR, + Logger::CRITICAL => LOG_CRIT, + Logger::ALERT => LOG_ALERT, + Logger::EMERGENCY => LOG_EMERG, + ]; /** * List of valid log facility names. * @var array */ - protected array $facilities = [ - 'auth' => \LOG_AUTH, - 'authpriv' => \LOG_AUTHPRIV, - 'cron' => \LOG_CRON, - 'daemon' => \LOG_DAEMON, - 'kern' => \LOG_KERN, - 'lpr' => \LOG_LPR, - 'mail' => \LOG_MAIL, - 'news' => \LOG_NEWS, - 'syslog' => \LOG_SYSLOG, - 'user' => \LOG_USER, - 'uucp' => \LOG_UUCP, + protected $facilities = [ + 'auth' => LOG_AUTH, + 'authpriv' => LOG_AUTHPRIV, + 'cron' => LOG_CRON, + 'daemon' => LOG_DAEMON, + 'kern' => LOG_KERN, + 'lpr' => LOG_LPR, + 'mail' => LOG_MAIL, + 'news' => LOG_NEWS, + 'syslog' => LOG_SYSLOG, + 'user' => LOG_USER, + 'uucp' => LOG_UUCP, ]; - /** - * Translates Monolog log levels to syslog log priorities. - */ - protected function toSyslogPriority(Level $level): int - { - return $level->toRFC5424Level(); - } - /** * @param string|int $facility Either one of the names of the keys in $this->facilities, or a LOG_* facility constant */ - public function __construct(string|int $facility = \LOG_USER, int|string|Level $level = Level::Debug, bool $bubble = true) + public function __construct($facility = LOG_USER, $level = Logger::DEBUG, bool $bubble = true) { parent::__construct($level, $bubble); if (!defined('PHP_WINDOWS_VERSION_BUILD')) { - $this->facilities['local0'] = \LOG_LOCAL0; - $this->facilities['local1'] = \LOG_LOCAL1; - $this->facilities['local2'] = \LOG_LOCAL2; - $this->facilities['local3'] = \LOG_LOCAL3; - $this->facilities['local4'] = \LOG_LOCAL4; - $this->facilities['local5'] = \LOG_LOCAL5; - $this->facilities['local6'] = \LOG_LOCAL6; - $this->facilities['local7'] = \LOG_LOCAL7; + $this->facilities['local0'] = LOG_LOCAL0; + $this->facilities['local1'] = LOG_LOCAL1; + $this->facilities['local2'] = LOG_LOCAL2; + $this->facilities['local3'] = LOG_LOCAL3; + $this->facilities['local4'] = LOG_LOCAL4; + $this->facilities['local5'] = LOG_LOCAL5; + $this->facilities['local6'] = LOG_LOCAL6; + $this->facilities['local7'] = LOG_LOCAL7; } else { $this->facilities['local0'] = 128; // LOG_LOCAL0 $this->facilities['local1'] = 136; // LOG_LOCAL1 @@ -86,7 +97,7 @@ abstract class AbstractSyslogHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php index b25e4f13..994872ce 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/AmqpHandler.php @@ -11,38 +11,24 @@ namespace Monolog\Handler; -use Monolog\Level; +use Monolog\Logger; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\JsonFormatter; use PhpAmqpLib\Message\AMQPMessage; use PhpAmqpLib\Channel\AMQPChannel; use AMQPExchange; -use Monolog\LogRecord; +/** + * @phpstan-import-type Record from \Monolog\Logger + */ class AmqpHandler extends AbstractProcessingHandler { - protected AMQPExchange|AMQPChannel $exchange; - - /** @var array */ - private array $extraAttributes = []; - - protected string $exchangeName; - /** - * @param AMQPExchange|AMQPChannel $exchange AMQPExchange (php AMQP ext) or PHP AMQP lib channel, ready for use - * @param string|null $exchangeName Optional exchange name, for AMQPChannel (PhpAmqpLib) only + * @var AMQPExchange|AMQPChannel $exchange */ - public function __construct(AMQPExchange|AMQPChannel $exchange, ?string $exchangeName = null, int|string|Level $level = Level::Debug, bool $bubble = true) - { - if ($exchange instanceof AMQPChannel) { - $this->exchangeName = (string) $exchangeName; - } elseif ($exchangeName !== null) { - @trigger_error('The $exchangeName parameter can only be passed when using PhpAmqpLib, if using an AMQPExchange instance configure it beforehand', E_USER_DEPRECATED); - } - $this->exchange = $exchange; - - parent::__construct($level, $bubble); - } + protected $exchange; + /** @var array */ + private $extraAttributes = []; /** * @return array @@ -59,7 +45,7 @@ class AmqpHandler extends AbstractProcessingHandler * message_id, user_id, app_id, delivery_mode, * priority, timestamp, expiration, type * or reply_to, headers. - * @return $this + * @return AmqpHandler */ public function setExtraAttributes(array $extraAttributes): self { @@ -68,11 +54,34 @@ class AmqpHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * @var string */ - protected function write(LogRecord $record): void + protected $exchangeName; + + /** + * @param AMQPExchange|AMQPChannel $exchange AMQPExchange (php AMQP ext) or PHP AMQP lib channel, ready for use + * @param string|null $exchangeName Optional exchange name, for AMQPChannel (PhpAmqpLib) only + */ + public function __construct($exchange, ?string $exchangeName = null, $level = Logger::DEBUG, bool $bubble = true) { - $data = $record->formatted; + if ($exchange instanceof AMQPChannel) { + $this->exchangeName = (string) $exchangeName; + } elseif (!$exchange instanceof AMQPExchange) { + throw new \InvalidArgumentException('PhpAmqpLib\Channel\AMQPChannel or AMQPExchange instance required'); + } elseif ($exchangeName) { + @trigger_error('The $exchangeName parameter can only be passed when using PhpAmqpLib, if using an AMQPExchange instance configure it beforehand', E_USER_DEPRECATED); + } + $this->exchange = $exchange; + + parent::__construct($level, $bubble); + } + + /** + * {@inheritDoc} + */ + protected function write(array $record): void + { + $data = $record["formatted"]; $routingKey = $this->getRoutingKey($record); if ($this->exchange instanceof AMQPExchange) { @@ -80,7 +89,7 @@ class AmqpHandler extends AbstractProcessingHandler 'delivery_mode' => 2, 'content_type' => 'application/json', ]; - if (\count($this->extraAttributes) > 0) { + if ($this->extraAttributes) { $attributes = array_merge($attributes, $this->extraAttributes); } $this->exchange->publish( @@ -99,7 +108,7 @@ class AmqpHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ public function handleBatch(array $records): void { @@ -114,6 +123,7 @@ class AmqpHandler extends AbstractProcessingHandler continue; } + /** @var Record $record */ $record = $this->processRecord($record); $data = $this->getFormatter()->format($record); @@ -129,27 +139,30 @@ class AmqpHandler extends AbstractProcessingHandler /** * Gets the routing key for the AMQP exchange + * + * @phpstan-param Record $record */ - protected function getRoutingKey(LogRecord $record): string + protected function getRoutingKey(array $record): string { - $routingKey = sprintf('%s.%s', $record->level->name, $record->channel); + $routingKey = sprintf('%s.%s', $record['level_name'], $record['channel']); return strtolower($routingKey); } private function createAmqpMessage(string $data): AMQPMessage { - return new AMQPMessage( - $data, - [ - 'delivery_mode' => 2, - 'content_type' => 'application/json', - ] - ); + $attributes = [ + 'delivery_mode' => 2, + 'content_type' => 'application/json', + ]; + if ($this->extraAttributes) { + $attributes = array_merge($attributes, $this->extraAttributes); + } + return new AMQPMessage($data, $attributes); } /** - * @inheritDoc + * {@inheritDoc} */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php index 28564b3f..95bbfed4 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/BrowserConsoleHandler.php @@ -14,30 +14,35 @@ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\LineFormatter; use Monolog\Utils; -use Monolog\LogRecord; +use Monolog\Logger; use function count; use function headers_list; use function stripos; +use function trigger_error; + +use const E_USER_DEPRECATED; /** * Handler sending logs to browser's javascript console with no browser extension required * * @author Olivier Poitrey + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler */ class BrowserConsoleHandler extends AbstractProcessingHandler { - protected static bool $initialized = false; - - /** @var LogRecord[] */ - protected static array $records = []; + /** @var bool */ + protected static $initialized = false; + /** @var FormattedRecord[] */ + protected static $records = []; protected const FORMAT_HTML = 'html'; protected const FORMAT_JS = 'js'; protected const FORMAT_UNKNOWN = 'unknown'; /** - * @inheritDoc + * {@inheritDoc} * * Formatted output may contain some formatting markers to be transferred to `console.log` using the %c format. * @@ -51,9 +56,9 @@ class BrowserConsoleHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { // Accumulate records static::$records[] = $record; @@ -76,11 +81,11 @@ class BrowserConsoleHandler extends AbstractProcessingHandler return; } - if (count(static::$records) > 0) { + if (count(static::$records)) { if ($format === self::FORMAT_HTML) { - static::writeOutput(''); - } else { // js format - static::writeOutput(self::generateScript()); + static::writeOutput(''); + } elseif ($format === self::FORMAT_JS) { + static::writeOutput(static::generateScript()); } static::resetStatic(); } @@ -91,7 +96,7 @@ class BrowserConsoleHandler extends AbstractProcessingHandler self::resetStatic(); } - public function reset(): void + public function reset() { parent::reset(); @@ -169,18 +174,18 @@ class BrowserConsoleHandler extends AbstractProcessingHandler { $script = []; foreach (static::$records as $record) { - $context = self::dump('Context', $record->context); - $extra = self::dump('Extra', $record->extra); + $context = static::dump('Context', $record['context']); + $extra = static::dump('Extra', $record['extra']); - if (\count($context) === 0 && \count($extra) === 0) { - $script[] = self::call_array('log', self::handleStyles($record->formatted)); + if (empty($context) && empty($extra)) { + $script[] = static::call_array(static::getConsoleMethodForLevel($record['level']), static::handleStyles($record['formatted'])); } else { $script = array_merge( $script, - [self::call_array('groupCollapsed', self::handleStyles($record->formatted))], + [static::call_array('groupCollapsed', static::handleStyles($record['formatted']))], $context, $extra, - [self::call('groupEnd')] + [static::call('groupEnd')] ); } } @@ -188,6 +193,20 @@ class BrowserConsoleHandler extends AbstractProcessingHandler return "(function (c) {if (c && c.groupCollapsed) {\n" . implode("\n", $script) . "\n}})(console);"; } + private static function getConsoleMethodForLevel(int $level): string + { + return [ + Logger::DEBUG => 'debug', + Logger::INFO => 'info', + Logger::NOTICE => 'info', + Logger::WARNING => 'warn', + Logger::ERROR => 'error', + Logger::CRITICAL => 'error', + Logger::ALERT => 'error', + Logger::EMERGENCY => 'error', + ][$level] ?? 'log'; + } + /** * @return string[] */ @@ -199,14 +218,14 @@ class BrowserConsoleHandler extends AbstractProcessingHandler foreach (array_reverse($matches) as $match) { $args[] = '"font-weight: normal"'; - $args[] = self::quote(self::handleCustomStyles($match[2][0], $match[1][0])); + $args[] = static::quote(static::handleCustomStyles($match[2][0], $match[1][0])); $pos = $match[0][1]; $format = Utils::substr($format, 0, $pos) . '%c' . $match[1][0] . '%c' . Utils::substr($format, $pos + strlen($match[0][0])); } - $args[] = self::quote('font-weight: normal'); - $args[] = self::quote($format); + $args[] = static::quote('font-weight: normal'); + $args[] = static::quote($format); return array_reverse($args); } @@ -232,7 +251,6 @@ class BrowserConsoleHandler extends AbstractProcessingHandler if (null === $style) { $pcreErrorCode = preg_last_error(); - throw new \RuntimeException('Failed to run preg_replace_callback: ' . $pcreErrorCode . ' / ' . Utils::pcreLastErrorMessage($pcreErrorCode)); } @@ -247,16 +265,16 @@ class BrowserConsoleHandler extends AbstractProcessingHandler { $script = []; $dict = array_filter($dict); - if (\count($dict) === 0) { + if (empty($dict)) { return $script; } - $script[] = self::call('log', self::quote('%c%s'), self::quote('font-weight: bold'), self::quote($title)); + $script[] = static::call('log', static::quote('%c%s'), static::quote('font-weight: bold'), static::quote($title)); foreach ($dict as $key => $value) { $value = json_encode($value); if (empty($value)) { - $value = self::quote(''); + $value = static::quote(''); } - $script[] = self::call('log', self::quote('%s: %o'), self::quote((string) $key), $value); + $script[] = static::call('log', static::quote('%s: %o'), static::quote((string) $key), $value); } return $script; @@ -277,7 +295,7 @@ class BrowserConsoleHandler extends AbstractProcessingHandler throw new \UnexpectedValueException('Expected the first arg to be a string, got: '.var_export($method, true)); } - return self::call_array($method, $args); + return static::call_array($method, $args); } /** diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php index ff89faa8..fcce5d63 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/BufferHandler.php @@ -11,10 +11,9 @@ namespace Monolog\Handler; -use Monolog\Level; +use Monolog\Logger; use Monolog\ResettableInterface; use Monolog\Formatter\FormatterInterface; -use Monolog\LogRecord; /** * Buffers all records until closing the handler and then pass them as batch. @@ -23,30 +22,32 @@ use Monolog\LogRecord; * sending one per log message. * * @author Christophe Coevoet + * + * @phpstan-import-type Record from \Monolog\Logger */ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterface, FormattableHandlerInterface { use ProcessableHandlerTrait; - protected HandlerInterface $handler; - - protected int $bufferSize = 0; - - protected int $bufferLimit; - - protected bool $flushOnOverflow; - - /** @var LogRecord[] */ - protected array $buffer = []; - - protected bool $initialized = false; + /** @var HandlerInterface */ + protected $handler; + /** @var int */ + protected $bufferSize = 0; + /** @var int */ + protected $bufferLimit; + /** @var bool */ + protected $flushOnOverflow; + /** @var Record[] */ + protected $buffer = []; + /** @var bool */ + protected $initialized = false; /** * @param HandlerInterface $handler Handler. * @param int $bufferLimit How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. * @param bool $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded */ - public function __construct(HandlerInterface $handler, int $bufferLimit = 0, int|string|Level $level = Level::Debug, bool $bubble = true, bool $flushOnOverflow = false) + public function __construct(HandlerInterface $handler, int $bufferLimit = 0, $level = Logger::DEBUG, bool $bubble = true, bool $flushOnOverflow = false) { parent::__construct($level, $bubble); $this->handler = $handler; @@ -55,11 +56,11 @@ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterfa } /** - * @inheritDoc + * {@inheritDoc} */ - public function handle(LogRecord $record): bool + public function handle(array $record): bool { - if ($record->level->isLowerThan($this->level)) { + if ($record['level'] < $this->level) { return false; } @@ -78,7 +79,8 @@ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterfa } } - if (\count($this->processors) > 0) { + if ($this->processors) { + /** @var Record $record */ $record = $this->processRecord($record); } @@ -106,7 +108,7 @@ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterfa } /** - * @inheritDoc + * {@inheritDoc} */ public function close(): void { @@ -124,7 +126,7 @@ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterfa $this->buffer = []; } - public function reset(): void + public function reset() { $this->flush(); @@ -138,7 +140,7 @@ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterfa } /** - * @inheritDoc + * {@inheritDoc} */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -152,7 +154,7 @@ class BufferHandler extends AbstractHandler implements ProcessableHandlerInterfa } /** - * @inheritDoc + * {@inheritDoc} */ public function getFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php index 3742d47d..234ecf61 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ChromePHPHandler.php @@ -13,10 +13,8 @@ namespace Monolog\Handler; use Monolog\Formatter\ChromePHPFormatter; use Monolog\Formatter\FormatterInterface; -use Monolog\Level; +use Monolog\Logger; use Monolog\Utils; -use Monolog\LogRecord; -use Monolog\DateTimeImmutable; /** * Handler sending logs to the ChromePHP extension (http://www.chromephp.com/) @@ -24,6 +22,8 @@ use Monolog\DateTimeImmutable; * This also works out of the box with Firefox 43+ * * @author Christophe Coevoet + * + * @phpstan-import-type Record from \Monolog\Logger */ class ChromePHPHandler extends AbstractProcessingHandler { @@ -44,25 +44,29 @@ class ChromePHPHandler extends AbstractProcessingHandler */ protected const USER_AGENT_REGEX = '{\b(?:Chrome/\d+(?:\.\d+)*|HeadlessChrome|Firefox/(?:4[3-9]|[5-9]\d|\d{3,})(?:\.\d)*)\b}'; - protected static bool $initialized = false; + /** @var bool */ + protected static $initialized = false; /** * Tracks whether we sent too much data * * Chrome limits the headers to 4KB, so when we sent 3KB we stop sending + * + * @var bool */ - protected static bool $overflowed = false; + protected static $overflowed = false; /** @var mixed[] */ - protected static array $json = [ + protected static $json = [ 'version' => self::VERSION, 'columns' => ['label', 'log', 'backtrace', 'type'], 'rows' => [], ]; - protected static bool $sendHeaders = true; + /** @var bool */ + protected static $sendHeaders = true; - public function __construct(int|string|Level $level = Level::Debug, bool $bubble = true) + public function __construct($level = Logger::DEBUG, bool $bubble = true) { parent::__construct($level, $bubble); if (!function_exists('json_encode')) { @@ -71,7 +75,7 @@ class ChromePHPHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ public function handleBatch(array $records): void { @@ -82,15 +86,15 @@ class ChromePHPHandler extends AbstractProcessingHandler $messages = []; foreach ($records as $record) { - if ($record->level < $this->level) { + if ($record['level'] < $this->level) { continue; } - + /** @var Record $message */ $message = $this->processRecord($record); $messages[] = $message; } - if (\count($messages) > 0) { + if (!empty($messages)) { $messages = $this->getFormatter()->formatBatch($messages); self::$json['rows'] = array_merge(self::$json['rows'], $messages); $this->send(); @@ -98,7 +102,7 @@ class ChromePHPHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ protected function getDefaultFormatter(): FormatterInterface { @@ -111,13 +115,13 @@ class ChromePHPHandler extends AbstractProcessingHandler * @see sendHeader() * @see send() */ - protected function write(LogRecord $record): void + protected function write(array $record): void { if (!$this->isWebRequest()) { return; } - self::$json['rows'][] = $record->formatted; + self::$json['rows'][] = $record['formatted']; $this->send(); } @@ -149,12 +153,15 @@ class ChromePHPHandler extends AbstractProcessingHandler if (strlen($data) > 3 * 1024) { self::$overflowed = true; - $record = new LogRecord( - message: 'Incomplete logs, chrome header size limit reached', - level: Level::Warning, - channel: 'monolog', - datetime: new DateTimeImmutable(true), - ); + $record = [ + 'message' => 'Incomplete logs, chrome header size limit reached', + 'context' => [], + 'level' => Logger::WARNING, + 'level_name' => Logger::getLevelName(Logger::WARNING), + 'channel' => 'monolog', + 'datetime' => new \DateTimeImmutable(), + 'extra' => [], + ]; self::$json['rows'][count(self::$json['rows']) - 1] = $this->getFormatter()->format($record); $json = Utils::jsonEncode(self::$json, Utils::DEFAULT_JSON_FLAGS & ~JSON_UNESCAPED_UNICODE, true); $data = base64_encode($json); @@ -180,7 +187,7 @@ class ChromePHPHandler extends AbstractProcessingHandler */ protected function headersAccepted(): bool { - if (!isset($_SERVER['HTTP_USER_AGENT'])) { + if (empty($_SERVER['HTTP_USER_AGENT'])) { return false; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php index 8d9c10e7..52657613 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/CouchDBHandler.php @@ -13,42 +13,22 @@ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\JsonFormatter; -use Monolog\Level; -use Monolog\LogRecord; +use Monolog\Logger; /** * CouchDB handler * * @author Markus Bachmann - * @phpstan-type Options array{ - * host: string, - * port: int, - * dbname: string, - * username: string|null, - * password: string|null - * } - * @phpstan-type InputOptions array{ - * host?: string, - * port?: int, - * dbname?: string, - * username?: string|null, - * password?: string|null - * } */ class CouchDBHandler extends AbstractProcessingHandler { - /** - * @var mixed[] - * @phpstan-var Options - */ - private array $options; + /** @var mixed[] */ + private $options; /** * @param mixed[] $options - * - * @phpstan-param InputOptions $options */ - public function __construct(array $options = [], int|string|Level $level = Level::Debug, bool $bubble = true) + public function __construct(array $options = [], $level = Logger::DEBUG, bool $bubble = true) { $this->options = array_merge([ 'host' => 'localhost', @@ -62,12 +42,12 @@ class CouchDBHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { $basicAuth = null; - if (null !== $this->options['username'] && null !== $this->options['password']) { + if ($this->options['username']) { $basicAuth = sprintf('%s:%s@', $this->options['username'], $this->options['password']); } @@ -75,7 +55,7 @@ class CouchDBHandler extends AbstractProcessingHandler $context = stream_context_create([ 'http' => [ 'method' => 'POST', - 'content' => $record->formatted, + 'content' => $record['formatted'], 'ignore_errors' => true, 'max_redirects' => 0, 'header' => 'Content-type: application/json', @@ -88,7 +68,7 @@ class CouchDBHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php index 8388f5ad..3535a4fc 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/CubeHandler.php @@ -11,9 +11,8 @@ namespace Monolog\Handler; -use Monolog\Level; +use Monolog\Logger; use Monolog\Utils; -use Monolog\LogRecord; /** * Logs to Cube. @@ -24,13 +23,18 @@ use Monolog\LogRecord; */ class CubeHandler extends AbstractProcessingHandler { - private ?\Socket $udpConnection = null; - private ?\CurlHandle $httpConnection = null; - private string $scheme; - private string $host; - private int $port; + /** @var resource|\Socket|null */ + private $udpConnection = null; + /** @var resource|\CurlHandle|null */ + private $httpConnection = null; + /** @var string */ + private $scheme; + /** @var string */ + private $host; + /** @var int */ + private $port; /** @var string[] */ - private array $acceptedSchemes = ['http', 'udp']; + private $acceptedSchemes = ['http', 'udp']; /** * Create a Cube handler @@ -39,7 +43,7 @@ class CubeHandler extends AbstractProcessingHandler * A valid url must consist of three parts : protocol://host:port * Only valid protocols used by Cube are http and udp */ - public function __construct(string $url, int|string|Level $level = Level::Debug, bool $bubble = true) + public function __construct(string $url, $level = Logger::DEBUG, bool $bubble = true) { $urlInfo = parse_url($url); @@ -47,7 +51,7 @@ class CubeHandler extends AbstractProcessingHandler throw new \UnexpectedValueException('URL "'.$url.'" is not valid'); } - if (!in_array($urlInfo['scheme'], $this->acceptedSchemes, true)) { + if (!in_array($urlInfo['scheme'], $this->acceptedSchemes)) { throw new \UnexpectedValueException( 'Invalid protocol (' . $urlInfo['scheme'] . ').' . ' Valid options are ' . implode(', ', $this->acceptedSchemes) @@ -56,7 +60,7 @@ class CubeHandler extends AbstractProcessingHandler $this->scheme = $urlInfo['scheme']; $this->host = $urlInfo['host']; - $this->port = $urlInfo['port']; + $this->port = (int) $urlInfo['port']; parent::__construct($level, $bubble); } @@ -107,24 +111,24 @@ class CubeHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { - $date = $record->datetime; + $date = $record['datetime']; $data = ['time' => $date->format('Y-m-d\TH:i:s.uO')]; - $context = $record->context; + unset($record['datetime']); - if (isset($context['type'])) { - $data['type'] = $context['type']; - unset($context['type']); + if (isset($record['context']['type'])) { + $data['type'] = $record['context']['type']; + unset($record['context']['type']); } else { - $data['type'] = $record->channel; + $data['type'] = $record['channel']; } - $data['data'] = $context; - $data['data']['level'] = $record->level; + $data['data'] = $record['context']; + $data['data']['level'] = $record['level']; if ($this->scheme === 'http') { $this->writeHttp(Utils::jsonEncode($data)); @@ -135,20 +139,16 @@ class CubeHandler extends AbstractProcessingHandler private function writeUdp(string $data): void { - if (null === $this->udpConnection) { + if (!$this->udpConnection) { $this->connectUdp(); } - if (null === $this->udpConnection) { - throw new \LogicException('No UDP socket could be opened'); - } - socket_send($this->udpConnection, $data, strlen($data), 0); } private function writeHttp(string $data): void { - if (null === $this->httpConnection) { + if (!$this->httpConnection) { $this->connectHttp(); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php index 4decf0e6..7213e8ee 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/Curl/Util.php @@ -21,7 +21,7 @@ use CurlHandle; final class Util { /** @var array */ - private static array $retriableErrorCodes = [ + private static $retriableErrorCodes = [ CURLE_COULDNT_RESOLVE_HOST, CURLE_COULDNT_CONNECT, CURLE_HTTP_NOT_FOUND, @@ -34,17 +34,19 @@ final class Util /** * Executes a CURL request with optional retries and exception on failure * - * @param CurlHandle $ch curl handler - * @return bool|string @see curl_exec + * @param resource|CurlHandle $ch curl handler + * @param int $retries + * @param bool $closeAfterDone + * @return bool|string @see curl_exec */ - public static function execute(CurlHandle $ch, int $retries = 5, bool $closeAfterDone = true) + public static function execute($ch, int $retries = 5, bool $closeAfterDone = true) { while ($retries--) { $curlResponse = curl_exec($ch); if ($curlResponse === false) { $curlErrno = curl_errno($ch); - if (false === in_array($curlErrno, self::$retriableErrorCodes, true) || $retries === 0) { + if (false === in_array($curlErrno, self::$retriableErrorCodes, true) || !$retries) { $curlError = curl_error($ch); if ($closeAfterDone) { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php index 35549121..9b85ae7e 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/DeduplicationHandler.php @@ -11,10 +11,8 @@ namespace Monolog\Handler; -use Monolog\Level; use Monolog\Logger; use Psr\Log\LogLevel; -use Monolog\LogRecord; /** * Simple handler wrapper that deduplicates log records across multiple requests @@ -35,29 +33,45 @@ use Monolog\LogRecord; * same way. * * @author Jordi Boggiano + * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger */ class DeduplicationHandler extends BufferHandler { - protected string $deduplicationStore; - - protected Level $deduplicationLevel; - - protected int $time; - - private bool $gc = false; + /** + * @var string + */ + protected $deduplicationStore; /** - * @param HandlerInterface $handler Handler. - * @param string $deduplicationStore The file/path where the deduplication log should be kept - * @param int|string|Level|LogLevel::* $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes - * @param int $time The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - * - * @phpstan-param value-of|value-of|Level|LogLevel::* $deduplicationLevel + * @var Level */ - public function __construct(HandlerInterface $handler, ?string $deduplicationStore = null, int|string|Level $deduplicationLevel = Level::Error, int $time = 60, bool $bubble = true) + protected $deduplicationLevel; + + /** + * @var int + */ + protected $time; + + /** + * @var bool + */ + private $gc = false; + + /** + * @param HandlerInterface $handler Handler. + * @param string $deduplicationStore The file/path where the deduplication log should be kept + * @param string|int $deduplicationLevel The minimum logging level for log records to be looked at for deduplication purposes + * @param int $time The period (in seconds) during which duplicate entries should be suppressed after a given log is sent through + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * + * @phpstan-param Level|LevelName|LogLevel::* $deduplicationLevel + */ + public function __construct(HandlerInterface $handler, ?string $deduplicationStore = null, $deduplicationLevel = Logger::ERROR, int $time = 60, bool $bubble = true) { - parent::__construct($handler, 0, Level::Debug, $bubble, false); + parent::__construct($handler, 0, Logger::DEBUG, $bubble, false); $this->deduplicationStore = $deduplicationStore === null ? sys_get_temp_dir() . '/monolog-dedup-' . substr(md5(__FILE__), 0, 20) .'.log' : $deduplicationStore; $this->deduplicationLevel = Logger::toMonologLevel($deduplicationLevel); @@ -73,8 +87,8 @@ class DeduplicationHandler extends BufferHandler $passthru = null; foreach ($this->buffer as $record) { - if ($record->level->value >= $this->deduplicationLevel->value) { - $passthru = $passthru === true || !$this->isDuplicate($record); + if ($record['level'] >= $this->deduplicationLevel) { + $passthru = $passthru || !$this->isDuplicate($record); if ($passthru) { $this->appendRecord($record); } @@ -93,7 +107,10 @@ class DeduplicationHandler extends BufferHandler } } - private function isDuplicate(LogRecord $record): bool + /** + * @phpstan-param Record $record + */ + private function isDuplicate(array $record): bool { if (!file_exists($this->deduplicationStore)) { return false; @@ -105,13 +122,13 @@ class DeduplicationHandler extends BufferHandler } $yesterday = time() - 86400; - $timestampValidity = $record->datetime->getTimestamp() - $this->time; - $expectedMessage = preg_replace('{[\r\n].*}', '', $record->message); + $timestampValidity = $record['datetime']->getTimestamp() - $this->time; + $expectedMessage = preg_replace('{[\r\n].*}', '', $record['message']); for ($i = count($store) - 1; $i >= 0; $i--) { list($timestamp, $level, $message) = explode(':', $store[$i], 3); - if ($level === $record->level->getName() && $message === $expectedMessage && $timestamp > $timestampValidity) { + if ($level === $record['level_name'] && $message === $expectedMessage && $timestamp > $timestampValidity) { return true; } @@ -131,7 +148,7 @@ class DeduplicationHandler extends BufferHandler $handle = fopen($this->deduplicationStore, 'rw+'); - if (false === $handle) { + if (!$handle) { throw new \RuntimeException('Failed to open file for reading and writing: ' . $this->deduplicationStore); } @@ -142,7 +159,7 @@ class DeduplicationHandler extends BufferHandler while (!feof($handle)) { $log = fgets($handle); - if (is_string($log) && '' !== $log && substr($log, 0, 10) >= $timestampValidity) { + if ($log && substr($log, 0, 10) >= $timestampValidity) { $validLogs[] = $log; } } @@ -159,8 +176,11 @@ class DeduplicationHandler extends BufferHandler $this->gc = false; } - private function appendRecord(LogRecord $record): void + /** + * @phpstan-param Record $record + */ + private function appendRecord(array $record): void { - file_put_contents($this->deduplicationStore, $record->datetime->getTimestamp() . ':' . $record->level->getName() . ':' . preg_replace('{[\r\n].*}', '', $record->message) . "\n", FILE_APPEND); + file_put_contents($this->deduplicationStore, $record['datetime']->getTimestamp() . ':' . $record['level_name'] . ':' . preg_replace('{[\r\n].*}', '', $record['message']) . "\n", FILE_APPEND); } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php index eab9f108..ebd52c3a 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/DoctrineCouchDBHandler.php @@ -11,11 +11,10 @@ namespace Monolog\Handler; -use Monolog\Level; +use Monolog\Logger; use Monolog\Formatter\NormalizerFormatter; use Monolog\Formatter\FormatterInterface; use Doctrine\CouchDB\CouchDBClient; -use Monolog\LogRecord; /** * CouchDB handler for Doctrine CouchDB ODM @@ -24,20 +23,21 @@ use Monolog\LogRecord; */ class DoctrineCouchDBHandler extends AbstractProcessingHandler { - private CouchDBClient $client; + /** @var CouchDBClient */ + private $client; - public function __construct(CouchDBClient $client, int|string|Level $level = Level::Debug, bool $bubble = true) + public function __construct(CouchDBClient $client, $level = Logger::DEBUG, bool $bubble = true) { $this->client = $client; parent::__construct($level, $bubble); } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { - $this->client->postDocument($record->formatted); + $this->client->postDocument($record['formatted']); } protected function getDefaultFormatter(): FormatterInterface diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php index f1c5a959..21840bf6 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/DynamoDbHandler.php @@ -16,8 +16,7 @@ use Aws\DynamoDb\DynamoDbClient; use Monolog\Formatter\FormatterInterface; use Aws\DynamoDb\Marshaler; use Monolog\Formatter\ScalarFormatter; -use Monolog\Level; -use Monolog\LogRecord; +use Monolog\Logger; /** * Amazon DynamoDB handler (http://aws.amazon.com/dynamodb/) @@ -29,15 +28,35 @@ class DynamoDbHandler extends AbstractProcessingHandler { public const DATE_FORMAT = 'Y-m-d\TH:i:s.uO'; - protected DynamoDbClient $client; + /** + * @var DynamoDbClient + */ + protected $client; - protected string $table; + /** + * @var string + */ + protected $table; - protected Marshaler $marshaler; + /** + * @var int + */ + protected $version; - public function __construct(DynamoDbClient $client, string $table, int|string|Level $level = Level::Debug, bool $bubble = true) + /** + * @var Marshaler + */ + protected $marshaler; + + public function __construct(DynamoDbClient $client, string $table, $level = Logger::DEBUG, bool $bubble = true) { - $this->marshaler = new Marshaler; + /** @phpstan-ignore-next-line */ + if (defined('Aws\Sdk::VERSION') && version_compare(Sdk::VERSION, '3.0', '>=')) { + $this->version = 3; + $this->marshaler = new Marshaler; + } else { + $this->version = 2; + } $this->client = $client; $this->table = $table; @@ -46,12 +65,17 @@ class DynamoDbHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { - $filtered = $this->filterEmptyFields($record->formatted); - $formatted = $this->marshaler->marshalItem($filtered); + $filtered = $this->filterEmptyFields($record['formatted']); + if ($this->version === 3) { + $formatted = $this->marshaler->marshalItem($filtered); + } else { + /** @phpstan-ignore-next-line */ + $formatted = $this->client->formatAttributes($filtered); + } $this->client->putItem([ 'TableName' => $this->table, @@ -66,12 +90,12 @@ class DynamoDbHandler extends AbstractProcessingHandler protected function filterEmptyFields(array $record): array { return array_filter($record, function ($value) { - return [] !== $value; + return !empty($value) || false === $value || 0 === $value; }); } /** - * @inheritDoc + * {@inheritDoc} */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ElasticaHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ElasticaHandler.php index d9b85b4d..fc92ca42 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ElasticaHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ElasticaHandler.php @@ -14,10 +14,9 @@ namespace Monolog\Handler; use Elastica\Document; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\ElasticaFormatter; -use Monolog\Level; +use Monolog\Logger; use Elastica\Client; use Elastica\Exception\ExceptionInterface; -use Monolog\LogRecord; /** * Elastic Search handler @@ -34,34 +33,24 @@ use Monolog\LogRecord; * $log->pushHandler($handler); * * @author Jelle Vink - * @phpstan-type Options array{ - * index: string, - * type: string, - * ignore_error: bool - * } - * @phpstan-type InputOptions array{ - * index?: string, - * type?: string, - * ignore_error?: bool - * } */ class ElasticaHandler extends AbstractProcessingHandler { - protected Client $client; + /** + * @var Client + */ + protected $client; /** * @var mixed[] Handler config options - * @phpstan-var Options */ - protected array $options; + protected $options = []; /** * @param Client $client Elastica Client object * @param mixed[] $options Handler configuration - * - * @phpstan-param InputOptions $options */ - public function __construct(Client $client, array $options = [], int|string|Level $level = Level::Debug, bool $bubble = true) + public function __construct(Client $client, array $options = [], $level = Logger::DEBUG, bool $bubble = true) { parent::__construct($level, $bubble); $this->client = $client; @@ -76,15 +65,15 @@ class ElasticaHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { - $this->bulkSend([$record->formatted]); + $this->bulkSend([$record['formatted']]); } /** - * @inheritDoc + * {@inheritDoc} */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -97,8 +86,6 @@ class ElasticaHandler extends AbstractProcessingHandler /** * @return mixed[] - * - * @phpstan-return Options */ public function getOptions(): array { @@ -106,7 +93,7 @@ class ElasticaHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ protected function getDefaultFormatter(): FormatterInterface { @@ -114,7 +101,7 @@ class ElasticaHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ public function handleBatch(array $records): void { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ElasticsearchHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ElasticsearchHandler.php index c288824a..e88375c0 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ElasticsearchHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ElasticsearchHandler.php @@ -14,13 +14,12 @@ namespace Monolog\Handler; use Elastic\Elasticsearch\Response\Elasticsearch; use Throwable; use RuntimeException; -use Monolog\Level; +use Monolog\Logger; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\ElasticsearchFormatter; use InvalidArgumentException; use Elasticsearch\Common\Exceptions\RuntimeException as ElasticsearchRuntimeException; use Elasticsearch\Client; -use Monolog\LogRecord; use Elastic\Elasticsearch\Exception\InvalidArgumentException as ElasticInvalidArgumentException; use Elastic\Elasticsearch\Client as Client8; @@ -44,26 +43,18 @@ use Elastic\Elasticsearch\Client as Client8; * $log->pushHandler($handler); * * @author Avtandil Kikabidze - * @phpstan-type Options array{ - * index: string, - * type: string, - * ignore_error: bool - * } - * @phpstan-type InputOptions array{ - * index?: string, - * type?: string, - * ignore_error?: bool - * } */ class ElasticsearchHandler extends AbstractProcessingHandler { - protected Client|Client8 $client; + /** + * @var Client|Client8 + */ + protected $client; /** * @var mixed[] Handler config options - * @phpstan-var Options */ - protected array $options; + protected $options = []; /** * @var bool @@ -73,11 +64,13 @@ class ElasticsearchHandler extends AbstractProcessingHandler /** * @param Client|Client8 $client Elasticsearch Client object * @param mixed[] $options Handler configuration - * - * @phpstan-param InputOptions $options */ - public function __construct(Client|Client8 $client, array $options = [], int|string|Level $level = Level::Debug, bool $bubble = true) + public function __construct($client, array $options = [], $level = Logger::DEBUG, bool $bubble = true) { + if (!$client instanceof Client && !$client instanceof Client8) { + throw new \TypeError('Elasticsearch\Client or Elastic\Elasticsearch\Client instance required'); + } + parent::__construct($level, $bubble); $this->client = $client; $this->options = array_merge( @@ -99,15 +92,15 @@ class ElasticsearchHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { - $this->bulkSend([$record->formatted]); + $this->bulkSend([$record['formatted']]); } /** - * @inheritDoc + * {@inheritDoc} */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -122,8 +115,6 @@ class ElasticsearchHandler extends AbstractProcessingHandler * Getter options * * @return mixed[] - * - * @phpstan-return Options */ public function getOptions(): array { @@ -131,7 +122,7 @@ class ElasticsearchHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ protected function getDefaultFormatter(): FormatterInterface { @@ -139,7 +130,7 @@ class ElasticsearchHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ public function handleBatch(array $records): void { @@ -150,7 +141,7 @@ class ElasticsearchHandler extends AbstractProcessingHandler /** * Use Elasticsearch bulk API to send list of documents * - * @param array> $records Records + _index/_type keys + * @param array[] $records Records + _index/_type keys * @throws \RuntimeException */ protected function bulkSend(array $records): void diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php index 477d7e45..f2e22036 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ErrorLogHandler.php @@ -13,9 +13,8 @@ namespace Monolog\Handler; use Monolog\Formatter\LineFormatter; use Monolog\Formatter\FormatterInterface; -use Monolog\Level; +use Monolog\Logger; use Monolog\Utils; -use Monolog\LogRecord; /** * Stores to PHP error_log() handler. @@ -27,14 +26,16 @@ class ErrorLogHandler extends AbstractProcessingHandler public const OPERATING_SYSTEM = 0; public const SAPI = 4; - protected int $messageType; - protected bool $expandNewlines; + /** @var int */ + protected $messageType; + /** @var bool */ + protected $expandNewlines; /** * @param int $messageType Says where the error should go. * @param bool $expandNewlines If set to true, newlines in the message will be expanded to be take multiple log entries */ - public function __construct(int $messageType = self::OPERATING_SYSTEM, int|string|Level $level = Level::Debug, bool $bubble = true, bool $expandNewlines = false) + public function __construct(int $messageType = self::OPERATING_SYSTEM, $level = Logger::DEBUG, bool $bubble = true, bool $expandNewlines = false) { parent::__construct($level, $bubble); @@ -60,7 +61,7 @@ class ErrorLogHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ protected function getDefaultFormatter(): FormatterInterface { @@ -68,20 +69,19 @@ class ErrorLogHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { if (!$this->expandNewlines) { - error_log((string) $record->formatted, $this->messageType); + error_log((string) $record['formatted'], $this->messageType); return; } - $lines = preg_split('{[\r\n]+}', (string) $record->formatted); + $lines = preg_split('{[\r\n]+}', (string) $record['formatted']); if ($lines === false) { $pcreErrorCode = preg_last_error(); - throw new \RuntimeException('Failed to preg_split formatted string: ' . $pcreErrorCode . ' / '. Utils::pcreLastErrorMessage($pcreErrorCode)); } foreach ($lines as $line) { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FallbackGroupHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FallbackGroupHandler.php index 1776eb51..d4e234ce 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FallbackGroupHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FallbackGroupHandler.php @@ -12,7 +12,6 @@ namespace Monolog\Handler; use Throwable; -use Monolog\LogRecord; /** * Forwards records to at most one handler @@ -20,15 +19,18 @@ use Monolog\LogRecord; * If a handler fails, the exception is suppressed and the record is forwarded to the next handler. * * As soon as one handler handles a record successfully, the handling stops there. + * + * @phpstan-import-type Record from \Monolog\Logger */ class FallbackGroupHandler extends GroupHandler { /** - * @inheritDoc + * {@inheritDoc} */ - public function handle(LogRecord $record): bool + public function handle(array $record): bool { - if (\count($this->processors) > 0) { + if ($this->processors) { + /** @var Record $record */ $record = $this->processRecord($record); } foreach ($this->handlers as $handler) { @@ -44,15 +46,16 @@ class FallbackGroupHandler extends GroupHandler } /** - * @inheritDoc + * {@inheritDoc} */ public function handleBatch(array $records): void { - if (\count($this->processors) > 0) { + if ($this->processors) { $processed = []; foreach ($records as $record) { $processed[] = $this->processRecord($record); } + /** @var Record[] $records */ $records = $processed; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php index 00381ab4..718f17ef 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FilterHandler.php @@ -11,13 +11,10 @@ namespace Monolog\Handler; -use Closure; -use Monolog\Level; use Monolog\Logger; use Monolog\ResettableInterface; use Monolog\Formatter\FormatterInterface; use Psr\Log\LogLevel; -use Monolog\LogRecord; /** * Simple handler wrapper that filters records based on a list of levels @@ -26,99 +23,110 @@ use Monolog\LogRecord; * * @author Hennadiy Verkh * @author Jordi Boggiano + * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger */ class FilterHandler extends Handler implements ProcessableHandlerInterface, ResettableInterface, FormattableHandlerInterface { use ProcessableHandlerTrait; /** - * Handler or factory Closure($record, $this) + * Handler or factory callable($record, $this) * - * @phpstan-var (Closure(LogRecord|null, HandlerInterface): HandlerInterface)|HandlerInterface + * @var callable|HandlerInterface + * @phpstan-var callable(?Record, HandlerInterface): HandlerInterface|HandlerInterface */ - protected Closure|HandlerInterface $handler; + protected $handler; /** * Minimum level for logs that are passed to handler * - * @var bool[] Map of Level value => true - * @phpstan-var array, true> + * @var int[] + * @phpstan-var array */ - protected array $acceptedLevels; + protected $acceptedLevels; /** * Whether the messages that are handled can bubble up the stack or not + * + * @var bool */ - protected bool $bubble; + protected $bubble; /** - * @phpstan-param (Closure(LogRecord|null, HandlerInterface): HandlerInterface)|HandlerInterface $handler + * @psalm-param HandlerInterface|callable(?Record, HandlerInterface): HandlerInterface $handler * - * @param Closure|HandlerInterface $handler Handler or factory Closure($record|null, $filterHandler). - * @param int|string|Level|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided - * @param int|string|Level|LogLevel::* $maxLevel Maximum level to accept, only used if $minLevelOrList is not an array - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param callable|HandlerInterface $handler Handler or factory callable($record|null, $filterHandler). + * @param int|array $minLevelOrList A list of levels to accept or a minimum level if maxLevel is provided + * @param int|string $maxLevel Maximum level to accept, only used if $minLevelOrList is not an array + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not * - * @phpstan-param value-of|value-of|Level|LogLevel::*|array|value-of|Level|LogLevel::*> $minLevelOrList - * @phpstan-param value-of|value-of|Level|LogLevel::* $maxLevel + * @phpstan-param Level|LevelName|LogLevel::*|array $minLevelOrList + * @phpstan-param Level|LevelName|LogLevel::* $maxLevel */ - public function __construct(Closure|HandlerInterface $handler, int|string|Level|array $minLevelOrList = Level::Debug, int|string|Level $maxLevel = Level::Emergency, bool $bubble = true) + public function __construct($handler, $minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY, bool $bubble = true) { $this->handler = $handler; $this->bubble = $bubble; $this->setAcceptedLevels($minLevelOrList, $maxLevel); + + if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { + throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); + } } /** - * @phpstan-return list List of levels + * @phpstan-return array */ public function getAcceptedLevels(): array { - return array_map(fn (int $level) => Level::from($level), array_keys($this->acceptedLevels)); + return array_flip($this->acceptedLevels); } /** - * @param int|string|Level|LogLevel::*|array $minLevelOrList A list of levels to accept or a minimum level or level name if maxLevel is provided - * @param int|string|Level|LogLevel::* $maxLevel Maximum level or level name to accept, only used if $minLevelOrList is not an array + * @param int|string|array $minLevelOrList A list of levels to accept or a minimum level or level name if maxLevel is provided + * @param int|string $maxLevel Maximum level or level name to accept, only used if $minLevelOrList is not an array * - * @phpstan-param value-of|value-of|Level|LogLevel::*|array|value-of|Level|LogLevel::*> $minLevelOrList - * @phpstan-param value-of|value-of|Level|LogLevel::* $maxLevel + * @phpstan-param Level|LevelName|LogLevel::*|array $minLevelOrList + * @phpstan-param Level|LevelName|LogLevel::* $maxLevel */ - public function setAcceptedLevels(int|string|Level|array $minLevelOrList = Level::Debug, int|string|Level $maxLevel = Level::Emergency): self + public function setAcceptedLevels($minLevelOrList = Logger::DEBUG, $maxLevel = Logger::EMERGENCY): self { if (is_array($minLevelOrList)) { - $acceptedLevels = array_map(Logger::toMonologLevel(...), $minLevelOrList); + $acceptedLevels = array_map('Monolog\Logger::toMonologLevel', $minLevelOrList); } else { $minLevelOrList = Logger::toMonologLevel($minLevelOrList); $maxLevel = Logger::toMonologLevel($maxLevel); - $acceptedLevels = array_values(array_filter(Level::cases(), fn (Level $level) => $level->value >= $minLevelOrList->value && $level->value <= $maxLevel->value)); - } - $this->acceptedLevels = []; - foreach ($acceptedLevels as $level) { - $this->acceptedLevels[$level->value] = true; + $acceptedLevels = array_values(array_filter(Logger::getLevels(), function ($level) use ($minLevelOrList, $maxLevel) { + return $level >= $minLevelOrList && $level <= $maxLevel; + })); } + $this->acceptedLevels = array_flip($acceptedLevels); return $this; } /** - * @inheritDoc + * {@inheritDoc} */ - public function isHandling(LogRecord $record): bool + public function isHandling(array $record): bool { - return isset($this->acceptedLevels[$record->level->value]); + return isset($this->acceptedLevels[$record['level']]); } /** - * @inheritDoc + * {@inheritDoc} */ - public function handle(LogRecord $record): bool + public function handle(array $record): bool { if (!$this->isHandling($record)) { return false; } - if (\count($this->processors) > 0) { + if ($this->processors) { + /** @var Record $record */ $record = $this->processRecord($record); } @@ -128,7 +136,7 @@ class FilterHandler extends Handler implements ProcessableHandlerInterface, Rese } /** - * @inheritDoc + * {@inheritDoc} */ public function handleBatch(array $records): void { @@ -147,23 +155,26 @@ class FilterHandler extends Handler implements ProcessableHandlerInterface, Rese /** * Return the nested handler * - * If the handler was provided as a factory, this will trigger the handler's instantiation. + * If the handler was provided as a factory callable, this will trigger the handler's instantiation. + * + * @return HandlerInterface + * + * @phpstan-param Record $record */ - public function getHandler(LogRecord $record = null): HandlerInterface + public function getHandler(array $record = null) { if (!$this->handler instanceof HandlerInterface) { - $handler = ($this->handler)($record, $this); - if (!$handler instanceof HandlerInterface) { - throw new \RuntimeException("The factory Closure should return a HandlerInterface"); + $this->handler = ($this->handler)($record, $this); + if (!$this->handler instanceof HandlerInterface) { + throw new \RuntimeException("The factory callable should return a HandlerInterface"); } - $this->handler = $handler; } return $this->handler; } /** - * @inheritDoc + * {@inheritDoc} */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -178,7 +189,7 @@ class FilterHandler extends Handler implements ProcessableHandlerInterface, Rese } /** - * @inheritDoc + * {@inheritDoc} */ public function getFormatter(): FormatterInterface { @@ -190,7 +201,7 @@ class FilterHandler extends Handler implements ProcessableHandlerInterface, Rese throw new \UnexpectedValueException('The nested handler of type '.get_class($handler).' does not support formatters.'); } - public function reset(): void + public function reset() { $this->resetProcessors(); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php index e8a1b0b0..0aa5607b 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ActivationStrategyInterface.php @@ -11,17 +11,19 @@ namespace Monolog\Handler\FingersCrossed; -use Monolog\LogRecord; - /** * Interface for activation strategies for the FingersCrossedHandler. * * @author Johannes M. Schmitt + * + * @phpstan-import-type Record from \Monolog\Logger */ interface ActivationStrategyInterface { /** * Returns whether the given record activates the handler. + * + * @phpstan-param Record $record */ - public function isHandlerActivated(LogRecord $record): bool; + public function isHandlerActivated(array $record): bool; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php index 383e19af..7b9abb58 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ChannelLevelActivationStrategy.php @@ -11,10 +11,8 @@ namespace Monolog\Handler\FingersCrossed; -use Monolog\Level; use Monolog\Logger; use Psr\Log\LogLevel; -use Monolog\LogRecord; /** * Channel and Error level based monolog activation strategy. Allows to trigger activation @@ -25,45 +23,55 @@ use Monolog\LogRecord; * * * $activationStrategy = new ChannelLevelActivationStrategy( - * Level::Critical, + * Logger::CRITICAL, * array( - * 'request' => Level::Alert, - * 'sensitive' => Level::Error, + * 'request' => Logger::ALERT, + * 'sensitive' => Logger::ERROR, * ) * ); * $handler = new FingersCrossedHandler(new StreamHandler('php://stderr'), $activationStrategy); * * * @author Mike Meessen + * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger */ class ChannelLevelActivationStrategy implements ActivationStrategyInterface { - private Level $defaultActionLevel; + /** + * @var Level + */ + private $defaultActionLevel; /** * @var array */ - private array $channelToActionLevel; + private $channelToActionLevel; /** - * @param int|string|Level|LogLevel::* $defaultActionLevel The default action level to be used if the record's category doesn't match any - * @param array $channelToActionLevel An array that maps channel names to action levels. + * @param int|string $defaultActionLevel The default action level to be used if the record's category doesn't match any + * @param array $channelToActionLevel An array that maps channel names to action levels. * - * @phpstan-param value-of|value-of|Level|LogLevel::* $defaultActionLevel - * @phpstan-param array|value-of|Level|LogLevel::*> $channelToActionLevel + * @phpstan-param array $channelToActionLevel + * @phpstan-param Level|LevelName|LogLevel::* $defaultActionLevel */ - public function __construct(int|string|Level $defaultActionLevel, array $channelToActionLevel = []) + public function __construct($defaultActionLevel, array $channelToActionLevel = []) { $this->defaultActionLevel = Logger::toMonologLevel($defaultActionLevel); - $this->channelToActionLevel = array_map(Logger::toMonologLevel(...), $channelToActionLevel); + $this->channelToActionLevel = array_map('Monolog\Logger::toMonologLevel', $channelToActionLevel); } - public function isHandlerActivated(LogRecord $record): bool + /** + * @phpstan-param Record $record + */ + public function isHandlerActivated(array $record): bool { - if (isset($this->channelToActionLevel[$record->channel])) { - return $record->level->value >= $this->channelToActionLevel[$record->channel]->value; + if (isset($this->channelToActionLevel[$record['channel']])) { + return $record['level'] >= $this->channelToActionLevel[$record['channel']]; } - return $record->level->value >= $this->defaultActionLevel->value; + return $record['level'] >= $this->defaultActionLevel; } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php index c3ca2967..5ec88eab 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossed/ErrorLevelActivationStrategy.php @@ -11,8 +11,6 @@ namespace Monolog\Handler\FingersCrossed; -use Monolog\Level; -use Monolog\LogRecord; use Monolog\Logger; use Psr\Log\LogLevel; @@ -20,23 +18,29 @@ use Psr\Log\LogLevel; * Error level based activation strategy. * * @author Johannes M. Schmitt + * + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger */ class ErrorLevelActivationStrategy implements ActivationStrategyInterface { - private Level $actionLevel; + /** + * @var Level + */ + private $actionLevel; /** - * @param int|string|Level $actionLevel Level or name or value + * @param int|string $actionLevel Level or name or value * - * @phpstan-param value-of|value-of|Level|LogLevel::* $actionLevel + * @phpstan-param Level|LevelName|LogLevel::* $actionLevel */ - public function __construct(int|string|Level $actionLevel) + public function __construct($actionLevel) { $this->actionLevel = Logger::toMonologLevel($actionLevel); } - public function isHandlerActivated(LogRecord $record): bool + public function isHandlerActivated(array $record): bool { - return $record->level->value >= $this->actionLevel->value; + return $record['level'] >= $this->actionLevel; } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php index ce2a3a8e..0627b445 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FingersCrossedHandler.php @@ -11,15 +11,12 @@ namespace Monolog\Handler; -use Closure; use Monolog\Handler\FingersCrossed\ErrorLevelActivationStrategy; use Monolog\Handler\FingersCrossed\ActivationStrategyInterface; -use Monolog\Level; use Monolog\Logger; use Monolog\ResettableInterface; use Monolog\Formatter\FormatterInterface; use Psr\Log\LogLevel; -use Monolog\LogRecord; /** * Buffers all records until a certain level is reached @@ -36,50 +33,55 @@ use Monolog\LogRecord; * Monolog\Handler\FingersCrossed\ namespace. * * @author Jordi Boggiano + * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger */ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterface, ResettableInterface, FormattableHandlerInterface { use ProcessableHandlerTrait; /** - * Handler or factory Closure($record, $this) - * - * @phpstan-var (Closure(LogRecord|null, HandlerInterface): HandlerInterface)|HandlerInterface + * @var callable|HandlerInterface + * @phpstan-var callable(?Record, HandlerInterface): HandlerInterface|HandlerInterface */ - protected Closure|HandlerInterface $handler; - - protected ActivationStrategyInterface $activationStrategy; - - protected bool $buffering = true; - - protected int $bufferSize; - - /** @var LogRecord[] */ - protected array $buffer = []; - - protected bool $stopBuffering; - - protected Level|null $passthruLevel = null; - - protected bool $bubble; + protected $handler; + /** @var ActivationStrategyInterface */ + protected $activationStrategy; + /** @var bool */ + protected $buffering = true; + /** @var int */ + protected $bufferSize; + /** @var Record[] */ + protected $buffer = []; + /** @var bool */ + protected $stopBuffering; + /** + * @var ?int + * @phpstan-var ?Level + */ + protected $passthruLevel; + /** @var bool */ + protected $bubble; /** - * @phpstan-param (Closure(LogRecord|null, HandlerInterface): HandlerInterface)|HandlerInterface $handler + * @psalm-param HandlerInterface|callable(?Record, HandlerInterface): HandlerInterface $handler * - * @param Closure|HandlerInterface $handler Handler or factory Closure($record|null, $fingersCrossedHandler). - * @param int|string|Level|LogLevel::* $activationStrategy Strategy which determines when this handler takes action, or a level name/value at which the handler is activated - * @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - * @param bool $stopBuffering Whether the handler should stop buffering after being triggered (default true) - * @param int|string|Level|LogLevel::*|null $passthruLevel Minimum level to always flush to handler on close, even if strategy not triggered + * @param callable|HandlerInterface $handler Handler or factory callable($record|null, $fingersCrossedHandler). + * @param int|string|ActivationStrategyInterface $activationStrategy Strategy which determines when this handler takes action, or a level name/value at which the handler is activated + * @param int $bufferSize How many entries should be buffered at most, beyond that the oldest items are removed from the buffer. + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param bool $stopBuffering Whether the handler should stop buffering after being triggered (default true) + * @param int|string $passthruLevel Minimum level to always flush to handler on close, even if strategy not triggered * - * @phpstan-param value-of|value-of|Level|LogLevel::*|ActivationStrategyInterface $activationStrategy - * @phpstan-param value-of|value-of|Level|LogLevel::* $passthruLevel + * @phpstan-param Level|LevelName|LogLevel::* $passthruLevel + * @phpstan-param Level|LevelName|LogLevel::*|ActivationStrategyInterface $activationStrategy */ - public function __construct(Closure|HandlerInterface $handler, int|string|Level|ActivationStrategyInterface $activationStrategy = null, int $bufferSize = 0, bool $bubble = true, bool $stopBuffering = true, int|string|Level|null $passthruLevel = null) + public function __construct($handler, $activationStrategy = null, int $bufferSize = 0, bool $bubble = true, bool $stopBuffering = true, $passthruLevel = null) { if (null === $activationStrategy) { - $activationStrategy = new ErrorLevelActivationStrategy(Level::Warning); + $activationStrategy = new ErrorLevelActivationStrategy(Logger::WARNING); } // convert simple int activationStrategy to an object @@ -96,12 +98,16 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa if ($passthruLevel !== null) { $this->passthruLevel = Logger::toMonologLevel($passthruLevel); } + + if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { + throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); + } } /** - * @inheritDoc + * {@inheritDoc} */ - public function isHandling(LogRecord $record): bool + public function isHandling(array $record): bool { return true; } @@ -120,11 +126,12 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa } /** - * @inheritDoc + * {@inheritDoc} */ - public function handle(LogRecord $record): bool + public function handle(array $record): bool { - if (\count($this->processors) > 0) { + if ($this->processors) { + /** @var Record $record */ $record = $this->processRecord($record); } @@ -144,7 +151,7 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa } /** - * @inheritDoc + * {@inheritDoc} */ public function close(): void { @@ -153,7 +160,7 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa $this->getHandler()->close(); } - public function reset(): void + public function reset() { $this->flushBuffer(); @@ -183,7 +190,7 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa if (null !== $this->passthruLevel) { $level = $this->passthruLevel; $this->buffer = array_filter($this->buffer, function ($record) use ($level) { - return $record->level >= $level; + return $record['level'] >= $level; }); if (count($this->buffer) > 0) { $this->getHandler(end($this->buffer))->handleBatch($this->buffer); @@ -197,23 +204,26 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa /** * Return the nested handler * - * If the handler was provided as a factory, this will trigger the handler's instantiation. + * If the handler was provided as a factory callable, this will trigger the handler's instantiation. + * + * @return HandlerInterface + * + * @phpstan-param Record $record */ - public function getHandler(LogRecord $record = null): HandlerInterface + public function getHandler(array $record = null) { if (!$this->handler instanceof HandlerInterface) { - $handler = ($this->handler)($record, $this); - if (!$handler instanceof HandlerInterface) { - throw new \RuntimeException("The factory Closure should return a HandlerInterface"); + $this->handler = ($this->handler)($record, $this); + if (!$this->handler instanceof HandlerInterface) { + throw new \RuntimeException("The factory callable should return a HandlerInterface"); } - $this->handler = $handler; } return $this->handler; } /** - * @inheritDoc + * {@inheritDoc} */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -228,7 +238,7 @@ class FingersCrossedHandler extends Handler implements ProcessableHandlerInterfa } /** - * @inheritDoc + * {@inheritDoc} */ public function getFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php index 6b9e5103..72718de6 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FirePHPHandler.php @@ -13,12 +13,13 @@ namespace Monolog\Handler; use Monolog\Formatter\WildfireFormatter; use Monolog\Formatter\FormatterInterface; -use Monolog\LogRecord; /** * Simple FirePHP Handler (http://www.firephp.org/), which uses the Wildfire protocol. * * @author Eric Clemmons (@ericclemmons) + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler */ class FirePHPHandler extends AbstractProcessingHandler { @@ -46,15 +47,18 @@ class FirePHPHandler extends AbstractProcessingHandler /** * Whether or not Wildfire vendor-specific headers have been generated & sent yet + * @var bool */ - protected static bool $initialized = false; + protected static $initialized = false; /** * Shared static message index between potentially multiple handlers + * @var int */ - protected static int $messageIndex = 1; + protected static $messageIndex = 1; - protected static bool $sendHeaders = true; + /** @var bool */ + protected static $sendHeaders = true; /** * Base header creation function used by init headers & record headers @@ -81,19 +85,21 @@ class FirePHPHandler extends AbstractProcessingHandler * @phpstan-return non-empty-array * * @see createHeader() + * + * @phpstan-param FormattedRecord $record */ - protected function createRecordHeader(LogRecord $record): array + protected function createRecordHeader(array $record): array { // Wildfire is extensible to support multiple protocols & plugins in a single request, // but we're not taking advantage of that (yet), so we're using "1" for simplicity's sake. return $this->createHeader( [1, 1, 1, self::$messageIndex++], - $record->formatted + $record['formatted'] ); } /** - * @inheritDoc + * {@inheritDoc} */ protected function getDefaultFormatter(): FormatterInterface { @@ -134,7 +140,7 @@ class FirePHPHandler extends AbstractProcessingHandler * @see sendHeader() * @see sendInitHeaders() */ - protected function write(LogRecord $record): void + protected function write(array $record): void { if (!self::$sendHeaders || !$this->isWebRequest()) { return; @@ -165,7 +171,7 @@ class FirePHPHandler extends AbstractProcessingHandler */ protected function headersAccepted(): bool { - if (isset($_SERVER['HTTP_USER_AGENT']) && 1 === preg_match('{\bFirePHP/\d+\.\d+\b}', $_SERVER['HTTP_USER_AGENT'])) { + if (!empty($_SERVER['HTTP_USER_AGENT']) && preg_match('{\bFirePHP/\d+\.\d+\b}', $_SERVER['HTTP_USER_AGENT'])) { return true; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php index 9f44ba71..85c95b9d 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FleepHookHandler.php @@ -13,8 +13,7 @@ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\LineFormatter; -use Monolog\Level; -use Monolog\LogRecord; +use Monolog\Logger; /** * Sends logs to Fleep.io using Webhook integrations @@ -23,6 +22,8 @@ use Monolog\LogRecord; * * @see https://fleep.io/integrations/webhooks/ Fleep Webhooks Documentation * @author Ando Roots + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler */ class FleepHookHandler extends SocketHandler { @@ -33,7 +34,7 @@ class FleepHookHandler extends SocketHandler /** * @var string Webhook token (specifies the conversation where logs are sent) */ - protected string $token; + protected $token; /** * Construct a new Fleep.io Handler. @@ -41,12 +42,12 @@ class FleepHookHandler extends SocketHandler * For instructions on how to create a new web hook in your conversations * see https://fleep.io/integrations/webhooks/ * - * @param string $token Webhook token + * @param string $token Webhook token * @throws MissingExtensionException */ public function __construct( string $token, - $level = Level::Debug, + $level = Logger::DEBUG, bool $bubble = true, bool $persistent = false, float $timeout = 0.0, @@ -88,16 +89,16 @@ class FleepHookHandler extends SocketHandler /** * Handles a log record */ - public function write(LogRecord $record): void + public function write(array $record): void { parent::write($record); $this->closeSocket(); } /** - * @inheritDoc + * {@inheritDoc} */ - protected function generateDataStream(LogRecord $record): string + protected function generateDataStream(array $record): string { $content = $this->buildContent($record); @@ -120,11 +121,13 @@ class FleepHookHandler extends SocketHandler /** * Builds the body of API call + * + * @phpstan-param FormattedRecord $record */ - private function buildContent(LogRecord $record): string + private function buildContent(array $record): string { $dataArray = [ - 'message' => $record->formatted, + 'message' => $record['formatted'], ]; return http_build_query($dataArray); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php index 13581548..5715d580 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FlowdockHandler.php @@ -11,11 +11,10 @@ namespace Monolog\Handler; -use Monolog\Level; +use Monolog\Logger; use Monolog\Utils; use Monolog\Formatter\FlowdockFormatter; use Monolog\Formatter\FormatterInterface; -use Monolog\LogRecord; /** * Sends notifications through the Flowdock push API @@ -27,17 +26,23 @@ use Monolog\LogRecord; * * @author Dominik Liebler * @see https://www.flowdock.com/api/push + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler + * @deprecated Since 2.9.0 and 3.3.0, Flowdock was shutdown we will thus drop this handler in Monolog 4 */ class FlowdockHandler extends SocketHandler { - protected string $apiToken; + /** + * @var string + */ + protected $apiToken; /** * @throws MissingExtensionException if OpenSSL is missing */ public function __construct( string $apiToken, - $level = Level::Debug, + $level = Logger::DEBUG, bool $bubble = true, bool $persistent = false, float $timeout = 0.0, @@ -63,7 +68,7 @@ class FlowdockHandler extends SocketHandler } /** - * @inheritDoc + * {@inheritDoc} */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -83,9 +88,9 @@ class FlowdockHandler extends SocketHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { parent::write($record); @@ -93,9 +98,9 @@ class FlowdockHandler extends SocketHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function generateDataStream(LogRecord $record): string + protected function generateDataStream(array $record): string { $content = $this->buildContent($record); @@ -104,10 +109,12 @@ class FlowdockHandler extends SocketHandler /** * Builds the body of API call + * + * @phpstan-param FormattedRecord $record */ - private function buildContent(LogRecord $record): string + private function buildContent(array $record): string { - return Utils::jsonEncode($record->formatted); + return Utils::jsonEncode($record['formatted']['flowdock']); } /** diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerInterface.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerInterface.php index 72da59e1..fc1693cd 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerInterface.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerInterface.php @@ -23,12 +23,15 @@ interface FormattableHandlerInterface /** * Sets the formatter. * - * @return HandlerInterface self + * @param FormatterInterface $formatter + * @return HandlerInterface self */ public function setFormatter(FormatterInterface $formatter): HandlerInterface; /** * Gets the formatter. + * + * @return FormatterInterface */ public function getFormatter(): FormatterInterface; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php index c044e078..b60bdce0 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/FormattableHandlerTrait.php @@ -21,10 +21,13 @@ use Monolog\Formatter\LineFormatter; */ trait FormattableHandlerTrait { - protected FormatterInterface|null $formatter = null; + /** + * @var ?FormatterInterface + */ + protected $formatter; /** - * @inheritDoc + * {@inheritDoc} */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -34,11 +37,11 @@ trait FormattableHandlerTrait } /** - * @inheritDoc + * {@inheritDoc} */ public function getFormatter(): FormatterInterface { - if (null === $this->formatter) { + if (!$this->formatter) { $this->formatter = $this->getDefaultFormatter(); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php index ba5bb975..4ff26c4c 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/GelfHandler.php @@ -12,10 +12,9 @@ namespace Monolog\Handler; use Gelf\PublisherInterface; -use Monolog\Level; +use Monolog\Logger; use Monolog\Formatter\GelfMessageFormatter; use Monolog\Formatter\FormatterInterface; -use Monolog\LogRecord; /** * Handler to send messages to a Graylog2 (http://www.graylog2.org) server @@ -28,12 +27,12 @@ class GelfHandler extends AbstractProcessingHandler /** * @var PublisherInterface the publisher object that sends the message to the server */ - protected PublisherInterface $publisher; + protected $publisher; /** * @param PublisherInterface $publisher a gelf publisher object */ - public function __construct(PublisherInterface $publisher, int|string|Level $level = Level::Debug, bool $bubble = true) + public function __construct(PublisherInterface $publisher, $level = Logger::DEBUG, bool $bubble = true) { parent::__construct($level, $bubble); @@ -41,15 +40,15 @@ class GelfHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { - $this->publisher->publish($record->formatted); + $this->publisher->publish($record['formatted']); } /** - * @inheritDoc + * {@inheritDoc} */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php index 7ab8bd97..3c9dc4b3 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/GroupHandler.php @@ -13,20 +13,22 @@ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; use Monolog\ResettableInterface; -use Monolog\LogRecord; /** * Forwards records to multiple handlers * * @author Lenar Lõhmus + * + * @phpstan-import-type Record from \Monolog\Logger */ class GroupHandler extends Handler implements ProcessableHandlerInterface, ResettableInterface { use ProcessableHandlerTrait; /** @var HandlerInterface[] */ - protected array $handlers; - protected bool $bubble; + protected $handlers; + /** @var bool */ + protected $bubble; /** * @param HandlerInterface[] $handlers Array of Handlers. @@ -45,9 +47,9 @@ class GroupHandler extends Handler implements ProcessableHandlerInterface, Reset } /** - * @inheritDoc + * {@inheritDoc} */ - public function isHandling(LogRecord $record): bool + public function isHandling(array $record): bool { foreach ($this->handlers as $handler) { if ($handler->isHandling($record)) { @@ -59,11 +61,12 @@ class GroupHandler extends Handler implements ProcessableHandlerInterface, Reset } /** - * @inheritDoc + * {@inheritDoc} */ - public function handle(LogRecord $record): bool + public function handle(array $record): bool { - if (\count($this->processors) > 0) { + if ($this->processors) { + /** @var Record $record */ $record = $this->processRecord($record); } @@ -75,15 +78,16 @@ class GroupHandler extends Handler implements ProcessableHandlerInterface, Reset } /** - * @inheritDoc + * {@inheritDoc} */ public function handleBatch(array $records): void { - if (\count($this->processors) > 0) { + if ($this->processors) { $processed = []; foreach ($records as $record) { $processed[] = $this->processRecord($record); } + /** @var Record[] $records */ $records = $processed; } @@ -92,7 +96,7 @@ class GroupHandler extends Handler implements ProcessableHandlerInterface, Reset } } - public function reset(): void + public function reset() { $this->resetProcessors(); @@ -113,7 +117,7 @@ class GroupHandler extends Handler implements ProcessableHandlerInterface, Reset } /** - * @inheritDoc + * {@inheritDoc} */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/Handler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/Handler.php index e89f969b..34b4935d 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/Handler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/Handler.php @@ -19,7 +19,7 @@ namespace Monolog\Handler; abstract class Handler implements HandlerInterface { /** - * @inheritDoc + * {@inheritDoc} */ public function handleBatch(array $records): void { @@ -29,7 +29,7 @@ abstract class Handler implements HandlerInterface } /** - * @inheritDoc + * {@inheritDoc} */ public function close(): void { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php index 83905c32..affcc51f 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/HandlerInterface.php @@ -11,12 +11,13 @@ namespace Monolog\Handler; -use Monolog\LogRecord; - /** * Interface that all Monolog Handlers must implement * * @author Jordi Boggiano + * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger */ interface HandlerInterface { @@ -29,9 +30,13 @@ interface HandlerInterface * is no guarantee that handle() will not be called, and isHandling() might not be called * for a given record. * - * @param LogRecord $record Partial log record having only a level initialized + * @param array $record Partial log record containing only a level key + * + * @return bool + * + * @phpstan-param array{level: Level} $record */ - public function isHandling(LogRecord $record): bool; + public function isHandling(array $record): bool; /** * Handles a record. @@ -43,16 +48,20 @@ interface HandlerInterface * Unless the bubbling is interrupted (by returning true), the Logger class will keep on * calling further handlers in the stack with a given log record. * - * @param LogRecord $record The record to handle - * @return bool true means that this handler handled the record, and that bubbling is not permitted. - * false means the record was either not processed or that this handler allows bubbling. + * @param array $record The record to handle + * @return bool true means that this handler handled the record, and that bubbling is not permitted. + * false means the record was either not processed or that this handler allows bubbling. + * + * @phpstan-param Record $record */ - public function handle(LogRecord $record): bool; + public function handle(array $record): bool; /** * Handles a set of records at once. * - * @param array $records The records to handle + * @param array $records The records to handle (an array of record arrays) + * + * @phpstan-param Record[] $records */ public function handleBatch(array $records): void; diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php index 541ec254..d4351b9f 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/HandlerWrapper.php @@ -13,7 +13,6 @@ namespace Monolog\Handler; use Monolog\ResettableInterface; use Monolog\Formatter\FormatterInterface; -use Monolog\LogRecord; /** * This simple wrapper class can be used to extend handlers functionality. @@ -22,7 +21,7 @@ use Monolog\LogRecord; * * Inherit from this class and override handle() like this: * - * public function handle(LogRecord $record) + * public function handle(array $record) * { * if ($record meets certain conditions) { * return false; @@ -34,7 +33,10 @@ use Monolog\LogRecord; */ class HandlerWrapper implements HandlerInterface, ProcessableHandlerInterface, FormattableHandlerInterface, ResettableInterface { - protected HandlerInterface $handler; + /** + * @var HandlerInterface + */ + protected $handler; public function __construct(HandlerInterface $handler) { @@ -42,23 +44,23 @@ class HandlerWrapper implements HandlerInterface, ProcessableHandlerInterface, F } /** - * @inheritDoc + * {@inheritDoc} */ - public function isHandling(LogRecord $record): bool + public function isHandling(array $record): bool { return $this->handler->isHandling($record); } /** - * @inheritDoc + * {@inheritDoc} */ - public function handle(LogRecord $record): bool + public function handle(array $record): bool { return $this->handler->handle($record); } /** - * @inheritDoc + * {@inheritDoc} */ public function handleBatch(array $records): void { @@ -66,7 +68,7 @@ class HandlerWrapper implements HandlerInterface, ProcessableHandlerInterface, F } /** - * @inheritDoc + * {@inheritDoc} */ public function close(): void { @@ -74,7 +76,7 @@ class HandlerWrapper implements HandlerInterface, ProcessableHandlerInterface, F } /** - * @inheritDoc + * {@inheritDoc} */ public function pushProcessor(callable $callback): HandlerInterface { @@ -88,7 +90,7 @@ class HandlerWrapper implements HandlerInterface, ProcessableHandlerInterface, F } /** - * @inheritDoc + * {@inheritDoc} */ public function popProcessor(): callable { @@ -100,7 +102,7 @@ class HandlerWrapper implements HandlerInterface, ProcessableHandlerInterface, F } /** - * @inheritDoc + * {@inheritDoc} */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -114,7 +116,7 @@ class HandlerWrapper implements HandlerInterface, ProcessableHandlerInterface, F } /** - * @inheritDoc + * {@inheritDoc} */ public function getFormatter(): FormatterInterface { @@ -125,7 +127,7 @@ class HandlerWrapper implements HandlerInterface, ProcessableHandlerInterface, F throw new \LogicException('The wrapped handler does not implement ' . FormattableHandlerInterface::class); } - public function reset(): void + public function reset() { if ($this->handler instanceof ResettableInterface) { $this->handler->reset(); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php index ee7f81f6..000ccea4 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/IFTTTHandler.php @@ -11,9 +11,8 @@ namespace Monolog\Handler; -use Monolog\Level; +use Monolog\Logger; use Monolog\Utils; -use Monolog\LogRecord; /** * IFTTTHandler uses cURL to trigger IFTTT Maker actions @@ -28,14 +27,16 @@ use Monolog\LogRecord; */ class IFTTTHandler extends AbstractProcessingHandler { - private string $eventName; - private string $secretKey; + /** @var string */ + private $eventName; + /** @var string */ + private $secretKey; /** * @param string $eventName The name of the IFTTT Maker event that should be triggered * @param string $secretKey A valid IFTTT secret key */ - public function __construct(string $eventName, string $secretKey, int|string|Level $level = Level::Error, bool $bubble = true) + public function __construct(string $eventName, string $secretKey, $level = Logger::ERROR, bool $bubble = true) { if (!extension_loaded('curl')) { throw new MissingExtensionException('The curl extension is needed to use the IFTTTHandler'); @@ -48,14 +49,14 @@ class IFTTTHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ - public function write(LogRecord $record): void + public function write(array $record): void { $postData = [ - "value1" => $record->channel, + "value1" => $record["channel"], "value2" => $record["level_name"], - "value3" => $record->message, + "value3" => $record["message"], ]; $postString = Utils::jsonEncode($postData); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php index abb2f88f..71f64a26 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/InsightOpsHandler.php @@ -11,8 +11,7 @@ namespace Monolog\Handler; -use Monolog\Level; -use Monolog\LogRecord; +use Monolog\Logger; /** * Inspired on LogEntriesHandler. @@ -22,12 +21,15 @@ use Monolog\LogRecord; */ class InsightOpsHandler extends SocketHandler { - protected string $logToken; + /** + * @var string + */ + protected $logToken; /** - * @param string $token Log token supplied by InsightOps - * @param string $region Region where InsightOps account is hosted. Could be 'us' or 'eu'. - * @param bool $useSSL Whether or not SSL encryption should be used + * @param string $token Log token supplied by InsightOps + * @param string $region Region where InsightOps account is hosted. Could be 'us' or 'eu'. + * @param bool $useSSL Whether or not SSL encryption should be used * * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing */ @@ -35,7 +37,7 @@ class InsightOpsHandler extends SocketHandler string $token, string $region = 'us', bool $useSSL = true, - $level = Level::Debug, + $level = Logger::DEBUG, bool $bubble = true, bool $persistent = false, float $timeout = 0.0, @@ -65,10 +67,10 @@ class InsightOpsHandler extends SocketHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function generateDataStream(LogRecord $record): string + protected function generateDataStream(array $record): string { - return $this->logToken . ' ' . $record->formatted; + return $this->logToken . ' ' . $record['formatted']; } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php index 00259834..25fcd159 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogEntriesHandler.php @@ -11,27 +11,29 @@ namespace Monolog\Handler; -use Monolog\Level; -use Monolog\LogRecord; +use Monolog\Logger; /** * @author Robert Kaufmann III */ class LogEntriesHandler extends SocketHandler { - protected string $logToken; + /** + * @var string + */ + protected $logToken; /** - * @param string $token Log token supplied by LogEntries - * @param bool $useSSL Whether or not SSL encryption should be used. - * @param string $host Custom hostname to send the data to if needed + * @param string $token Log token supplied by LogEntries + * @param bool $useSSL Whether or not SSL encryption should be used. + * @param string $host Custom hostname to send the data to if needed * * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing */ public function __construct( string $token, bool $useSSL = true, - $level = Level::Debug, + $level = Logger::DEBUG, bool $bubble = true, string $host = 'data.logentries.com', bool $persistent = false, @@ -59,10 +61,10 @@ class LogEntriesHandler extends SocketHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function generateDataStream(LogRecord $record): string + protected function generateDataStream(array $record): string { - return $this->logToken . ' ' . $record->formatted; + return $this->logToken . ' ' . $record['formatted']; } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php index 2d8e66f1..6d13db37 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogglyHandler.php @@ -11,12 +11,11 @@ namespace Monolog\Handler; -use Monolog\Level; +use Monolog\Logger; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\LogglyFormatter; use function array_key_exists; use CurlHandle; -use Monolog\LogRecord; /** * Sends errors to Loggly. @@ -34,21 +33,22 @@ class LogglyHandler extends AbstractProcessingHandler /** * Caches the curl handlers for every given endpoint. * - * @var CurlHandle[] + * @var resource[]|CurlHandle[] */ - protected array $curlHandlers = []; + protected $curlHandlers = []; - protected string $token; + /** @var string */ + protected $token; /** @var string[] */ - protected array $tag = []; + protected $tag = []; /** * @param string $token API token supplied by Loggly * * @throws MissingExtensionException If the curl extension is missing */ - public function __construct(string $token, int|string|Level $level = Level::Debug, bool $bubble = true) + public function __construct(string $token, $level = Logger::DEBUG, bool $bubble = true) { if (!extension_loaded('curl')) { throw new MissingExtensionException('The curl extension is needed to use the LogglyHandler'); @@ -61,8 +61,12 @@ class LogglyHandler extends AbstractProcessingHandler /** * Loads and returns the shared curl handler for the given endpoint. + * + * @param string $endpoint + * + * @return resource|CurlHandle */ - protected function getCurlHandler(string $endpoint): CurlHandle + protected function getCurlHandler(string $endpoint) { if (!array_key_exists($endpoint, $this->curlHandlers)) { $this->curlHandlers[$endpoint] = $this->loadCurlHandle($endpoint); @@ -73,8 +77,12 @@ class LogglyHandler extends AbstractProcessingHandler /** * Starts a fresh curl session for the given endpoint and returns its handler. + * + * @param string $endpoint + * + * @return resource|CurlHandle */ - private function loadCurlHandle(string $endpoint): CurlHandle + private function loadCurlHandle(string $endpoint) { $url = sprintf("https://%s/%s/%s/", static::HOST, $endpoint, $this->token); @@ -90,13 +98,10 @@ class LogglyHandler extends AbstractProcessingHandler /** * @param string[]|string $tag */ - public function setTag(string|array $tag): self + public function setTag($tag): self { - if ('' === $tag || [] === $tag) { - $this->tag = []; - } else { - $this->tag = is_array($tag) ? $tag : [$tag]; - } + $tag = !empty($tag) ? $tag : []; + $this->tag = is_array($tag) ? $tag : [$tag]; return $this; } @@ -104,9 +109,9 @@ class LogglyHandler extends AbstractProcessingHandler /** * @param string[]|string $tag */ - public function addTag(string|array $tag): self + public function addTag($tag): self { - if ('' !== $tag) { + if (!empty($tag)) { $tag = is_array($tag) ? $tag : [$tag]; $this->tag = array_unique(array_merge($this->tag, $tag)); } @@ -114,9 +119,9 @@ class LogglyHandler extends AbstractProcessingHandler return $this; } - protected function write(LogRecord $record): void + protected function write(array $record): void { - $this->send($record->formatted, static::ENDPOINT_SINGLE); + $this->send($record["formatted"], static::ENDPOINT_SINGLE); } public function handleBatch(array $records): void @@ -124,10 +129,10 @@ class LogglyHandler extends AbstractProcessingHandler $level = $this->level; $records = array_filter($records, function ($record) use ($level) { - return ($record->level >= $level); + return ($record['level'] >= $level); }); - if (\count($records) > 0) { + if ($records) { $this->send($this->getFormatter()->formatBatch($records), static::ENDPOINT_BATCH); } } @@ -138,7 +143,7 @@ class LogglyHandler extends AbstractProcessingHandler $headers = ['Content-Type: application/json']; - if (\count($this->tag) > 0) { + if (!empty($this->tag)) { $headers[] = 'X-LOGGLY-TAG: '.implode(',', $this->tag); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogmaticHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogmaticHandler.php index 876b1a95..859a4690 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogmaticHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/LogmaticHandler.php @@ -11,36 +11,44 @@ namespace Monolog\Handler; -use Monolog\Level; +use Monolog\Logger; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\LogmaticFormatter; -use Monolog\LogRecord; /** * @author Julien Breux */ class LogmaticHandler extends SocketHandler { - private string $logToken; - - private string $hostname; - - private string $appName; + /** + * @var string + */ + private $logToken; /** - * @param string $token Log token supplied by Logmatic. - * @param string $hostname Host name supplied by Logmatic. - * @param string $appName Application name supplied by Logmatic. - * @param bool $useSSL Whether or not SSL encryption should be used. + * @var string + */ + private $hostname; + + /** + * @var string + */ + private $appname; + + /** + * @param string $token Log token supplied by Logmatic. + * @param string $hostname Host name supplied by Logmatic. + * @param string $appname Application name supplied by Logmatic. + * @param bool $useSSL Whether or not SSL encryption should be used. * * @throws MissingExtensionException If SSL encryption is set to true and OpenSSL is missing */ public function __construct( string $token, string $hostname = '', - string $appName = '', + string $appname = '', bool $useSSL = true, - $level = Level::Debug, + $level = Logger::DEBUG, bool $bubble = true, bool $persistent = false, float $timeout = 0.0, @@ -68,29 +76,29 @@ class LogmaticHandler extends SocketHandler $this->logToken = $token; $this->hostname = $hostname; - $this->appName = $appName; + $this->appname = $appname; } /** - * @inheritDoc + * {@inheritDoc} */ - protected function generateDataStream(LogRecord $record): string + protected function generateDataStream(array $record): string { - return $this->logToken . ' ' . $record->formatted; + return $this->logToken . ' ' . $record['formatted']; } /** - * @inheritDoc + * {@inheritDoc} */ protected function getDefaultFormatter(): FormatterInterface { $formatter = new LogmaticFormatter(); - if ($this->hostname !== '') { + if (!empty($this->hostname)) { $formatter->setHostname($this->hostname); } - if ($this->appName !== '') { - $formatter->setAppName($this->appName); + if (!empty($this->appname)) { + $formatter->setAppname($this->appname); } return $formatter; diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php index b6c82277..97f34320 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/MailHandler.php @@ -13,32 +13,33 @@ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\HtmlFormatter; -use Monolog\LogRecord; /** * Base class for all mail handlers * * @author Gyula Sallai + * + * @phpstan-import-type Record from \Monolog\Logger */ abstract class MailHandler extends AbstractProcessingHandler { /** - * @inheritDoc + * {@inheritDoc} */ public function handleBatch(array $records): void { $messages = []; foreach ($records as $record) { - if ($record->level->isLowerThan($this->level)) { + if ($record['level'] < $this->level) { continue; } - + /** @var Record $message */ $message = $this->processRecord($record); $messages[] = $message; } - if (\count($messages) > 0) { + if (!empty($messages)) { $this->send((string) $this->getFormatter()->formatBatch($messages), $messages); } } @@ -49,26 +50,27 @@ abstract class MailHandler extends AbstractProcessingHandler * @param string $content formatted email body to be sent * @param array $records the array of log records that formed this content * - * @phpstan-param non-empty-array $records + * @phpstan-param Record[] $records */ abstract protected function send(string $content, array $records): void; /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { - $this->send((string) $record->formatted, [$record]); + $this->send((string) $record['formatted'], [$record]); } /** - * @phpstan-param non-empty-array $records + * @phpstan-param non-empty-array $records + * @phpstan-return Record */ - protected function getHighestRecord(array $records): LogRecord + protected function getHighestRecord(array $records): array { $highestRecord = null; foreach ($records as $record) { - if ($highestRecord === null || $record->level->isHigherThan($highestRecord->level)) { + if ($highestRecord === null || $highestRecord['level'] < $record['level']) { $highestRecord = $record; } } @@ -83,6 +85,8 @@ abstract class MailHandler extends AbstractProcessingHandler /** * Gets the default formatter. + * + * @return FormatterInterface */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php index 0f923bc5..3003500e 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/MandrillHandler.php @@ -11,7 +11,7 @@ namespace Monolog\Handler; -use Monolog\Level; +use Monolog\Logger; use Swift; use Swift_Message; @@ -22,20 +22,22 @@ use Swift_Message; */ class MandrillHandler extends MailHandler { - protected Swift_Message $message; - protected string $apiKey; + /** @var Swift_Message */ + protected $message; + /** @var string */ + protected $apiKey; /** - * @phpstan-param (Swift_Message|callable(): Swift_Message) $message + * @psalm-param Swift_Message|callable(): Swift_Message $message * * @param string $apiKey A valid Mandrill API key * @param callable|Swift_Message $message An example message for real messages, only the body will be replaced */ - public function __construct(string $apiKey, callable|Swift_Message $message, int|string|Level $level = Level::Error, bool $bubble = true) + public function __construct(string $apiKey, $message, $level = Logger::ERROR, bool $bubble = true) { parent::__construct($level, $bubble); - if (!$message instanceof Swift_Message) { + if (!$message instanceof Swift_Message && is_callable($message)) { $message = $message(); } if (!$message instanceof Swift_Message) { @@ -46,7 +48,7 @@ class MandrillHandler extends MailHandler } /** - * @inheritDoc + * {@inheritDoc} */ protected function send(string $content, array $records): void { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php index 33ab68c6..30630911 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/MongoDBHandler.php @@ -14,10 +14,9 @@ namespace Monolog\Handler; use MongoDB\Driver\BulkWrite; use MongoDB\Driver\Manager; use MongoDB\Client; -use Monolog\Level; +use Monolog\Logger; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\MongoDBFormatter; -use Monolog\LogRecord; /** * Logs to a MongoDB database. @@ -34,11 +33,12 @@ use Monolog\LogRecord; */ class MongoDBHandler extends AbstractProcessingHandler { - private \MongoDB\Collection $collection; - - private Client|Manager $manager; - - private string|null $namespace = null; + /** @var \MongoDB\Collection */ + private $collection; + /** @var Client|Manager */ + private $manager; + /** @var string */ + private $namespace; /** * Constructor. @@ -47,8 +47,12 @@ class MongoDBHandler extends AbstractProcessingHandler * @param string $database Database name * @param string $collection Collection name */ - public function __construct(Client|Manager $mongodb, string $database, string $collection, int|string|Level $level = Level::Debug, bool $bubble = true) + public function __construct($mongodb, string $database, string $collection, $level = Logger::DEBUG, bool $bubble = true) { + if (!($mongodb instanceof Client || $mongodb instanceof Manager)) { + throw new \InvalidArgumentException('MongoDB\Client or MongoDB\Driver\Manager instance required'); + } + if ($mongodb instanceof Client) { $this->collection = $mongodb->selectCollection($database, $collection); } else { @@ -59,21 +63,21 @@ class MongoDBHandler extends AbstractProcessingHandler parent::__construct($level, $bubble); } - protected function write(LogRecord $record): void + protected function write(array $record): void { if (isset($this->collection)) { - $this->collection->insertOne($record->formatted); + $this->collection->insertOne($record['formatted']); } if (isset($this->manager, $this->namespace)) { $bulk = new BulkWrite; - $bulk->insert($record->formatted); + $bulk->insert($record["formatted"]); $this->manager->executeBulkWrite($this->namespace, $bulk); } } /** - * @inheritDoc + * {@inheritDoc} */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php index d4c9d801..0c0a3bdb 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/NativeMailerHandler.php @@ -11,7 +11,7 @@ namespace Monolog\Handler; -use Monolog\Level; +use Monolog\Logger; use Monolog\Formatter\LineFormatter; /** @@ -26,39 +26,43 @@ class NativeMailerHandler extends MailHandler * The email addresses to which the message will be sent * @var string[] */ - protected array $to; + protected $to; /** * The subject of the email + * @var string */ - protected string $subject; + protected $subject; /** * Optional headers for the message * @var string[] */ - protected array $headers = []; + protected $headers = []; /** * Optional parameters for the message * @var string[] */ - protected array $parameters = []; + protected $parameters = []; /** * The wordwrap length for the message + * @var int */ - protected int $maxColumnWidth; + protected $maxColumnWidth; /** * The Content-type for the message + * @var string|null */ - protected string|null $contentType = null; + protected $contentType; /** * The encoding for the message + * @var string */ - protected string $encoding = 'utf-8'; + protected $encoding = 'utf-8'; /** * @param string|string[] $to The receiver of the mail @@ -66,7 +70,7 @@ class NativeMailerHandler extends MailHandler * @param string $from The sender of the mail * @param int $maxColumnWidth The maximum column width that the message lines will have */ - public function __construct(string|array $to, string $subject, string $from, int|string|Level $level = Level::Error, bool $bubble = true, int $maxColumnWidth = 70) + public function __construct($to, string $subject, string $from, $level = Logger::ERROR, bool $bubble = true, int $maxColumnWidth = 70) { parent::__construct($level, $bubble); $this->to = (array) $to; @@ -105,11 +109,11 @@ class NativeMailerHandler extends MailHandler } /** - * @inheritDoc + * {@inheritDoc} */ protected function send(string $content, array $records): void { - $contentType = $this->getContentType() ?? ($this->isHtmlBody($content) ? 'text/html' : 'text/plain'); + $contentType = $this->getContentType() ?: ($this->isHtmlBody($content) ? 'text/html' : 'text/plain'); if ($contentType !== 'text/html') { $content = wordwrap($content, $this->maxColumnWidth); @@ -121,8 +125,11 @@ class NativeMailerHandler extends MailHandler $headers .= 'MIME-Version: 1.0' . "\r\n"; } - $subjectFormatter = new LineFormatter($this->subject); - $subject = $subjectFormatter->format($this->getHighestRecord($records)); + $subject = $this->subject; + if ($records) { + $subjectFormatter = new LineFormatter($this->subject); + $subject = $subjectFormatter->format($this->getHighestRecord($records)); + } $parameters = implode(' ', $this->parameters); foreach ($this->to as $to) { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php index b8cb3785..114d749e 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/NewRelicHandler.php @@ -11,17 +11,16 @@ namespace Monolog\Handler; -use Monolog\Level; +use Monolog\Logger; use Monolog\Utils; use Monolog\Formatter\NormalizerFormatter; use Monolog\Formatter\FormatterInterface; -use Monolog\LogRecord; /** * Class to record a log on a NewRelic application. * Enabling New Relic High Security mode may prevent capture of useful information. * - * This handler requires a NormalizerFormatter to function and expects an array in $record->formatted + * This handler requires a NormalizerFormatter to function and expects an array in $record['formatted'] * * @see https://docs.newrelic.com/docs/agents/php-agent * @see https://docs.newrelic.com/docs/accounts-partnerships/accounts/security/high-security @@ -29,58 +28,75 @@ use Monolog\LogRecord; class NewRelicHandler extends AbstractProcessingHandler { /** - * @inheritDoc + * Name of the New Relic application that will receive logs from this handler. + * + * @var ?string + */ + protected $appName; + + /** + * Name of the current transaction + * + * @var ?string + */ + protected $transactionName; + + /** + * Some context and extra data is passed into the handler as arrays of values. Do we send them as is + * (useful if we are using the API), or explode them for display on the NewRelic RPM website? + * + * @var bool + */ + protected $explodeArrays; + + /** + * {@inheritDoc} + * + * @param string|null $appName + * @param bool $explodeArrays + * @param string|null $transactionName */ public function __construct( - int|string|Level $level = Level::Error, + $level = Logger::ERROR, bool $bubble = true, - - /** - * Name of the New Relic application that will receive logs from this handler. - */ - protected string|null $appName = null, - - /** - * Some context and extra data is passed into the handler as arrays of values. Do we send them as is - * (useful if we are using the API), or explode them for display on the NewRelic RPM website? - */ - protected bool $explodeArrays = false, - - /** - * Name of the current transaction - */ - protected string|null $transactionName = null + ?string $appName = null, + bool $explodeArrays = false, + ?string $transactionName = null ) { parent::__construct($level, $bubble); + + $this->appName = $appName; + $this->explodeArrays = $explodeArrays; + $this->transactionName = $transactionName; } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { if (!$this->isNewRelicEnabled()) { throw new MissingExtensionException('The newrelic PHP extension is required to use the NewRelicHandler'); } - if (null !== ($appName = $this->getAppName($record->context))) { + if ($appName = $this->getAppName($record['context'])) { $this->setNewRelicAppName($appName); } - if (null !== ($transactionName = $this->getTransactionName($record->context))) { + if ($transactionName = $this->getTransactionName($record['context'])) { $this->setNewRelicTransactionName($transactionName); - unset($record->formatted['context']['transaction_name']); + unset($record['formatted']['context']['transaction_name']); } - if (isset($record->context['exception']) && $record->context['exception'] instanceof \Throwable) { - newrelic_notice_error($record->message, $record->context['exception']); - unset($record->formatted['context']['exception']); + if (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Throwable) { + newrelic_notice_error($record['message'], $record['context']['exception']); + unset($record['formatted']['context']['exception']); } else { - newrelic_notice_error($record->message); + newrelic_notice_error($record['message']); } - if (isset($record->formatted['context']) && is_array($record->formatted['context'])) { - foreach ($record->formatted['context'] as $key => $parameter) { + if (isset($record['formatted']['context']) && is_array($record['formatted']['context'])) { + foreach ($record['formatted']['context'] as $key => $parameter) { if (is_array($parameter) && $this->explodeArrays) { foreach ($parameter as $paramKey => $paramValue) { $this->setNewRelicParameter('context_' . $key . '_' . $paramKey, $paramValue); @@ -91,8 +107,8 @@ class NewRelicHandler extends AbstractProcessingHandler } } - if (isset($record->formatted['extra']) && is_array($record->formatted['extra'])) { - foreach ($record->formatted['extra'] as $key => $parameter) { + if (isset($record['formatted']['extra']) && is_array($record['formatted']['extra'])) { + foreach ($record['formatted']['extra'] as $key => $parameter) { if (is_array($parameter) && $this->explodeArrays) { foreach ($parameter as $paramKey => $paramValue) { $this->setNewRelicParameter('extra_' . $key . '_' . $paramKey, $paramValue); @@ -106,6 +122,8 @@ class NewRelicHandler extends AbstractProcessingHandler /** * Checks whether the NewRelic extension is enabled in the system. + * + * @return bool */ protected function isNewRelicEnabled(): bool { @@ -159,7 +177,8 @@ class NewRelicHandler extends AbstractProcessingHandler } /** - * @param mixed $value + * @param string $key + * @param mixed $value */ protected function setNewRelicParameter(string $key, $value): void { @@ -171,7 +190,7 @@ class NewRelicHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/NoopHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/NoopHandler.php index d9fea180..1ddf0beb 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/NoopHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/NoopHandler.php @@ -11,8 +11,6 @@ namespace Monolog\Handler; -use Monolog\LogRecord; - /** * No-op * @@ -25,17 +23,17 @@ use Monolog\LogRecord; class NoopHandler extends Handler { /** - * @inheritDoc + * {@inheritDoc} */ - public function isHandling(LogRecord $record): bool + public function isHandling(array $record): bool { return true; } /** - * @inheritDoc + * {@inheritDoc} */ - public function handle(LogRecord $record): bool + public function handle(array $record): bool { return false; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php index 1aa84e4f..e75ee0c6 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/NullHandler.php @@ -11,10 +11,8 @@ namespace Monolog\Handler; -use Monolog\Level; -use Psr\Log\LogLevel; use Monolog\Logger; -use Monolog\LogRecord; +use Psr\Log\LogLevel; /** * Blackhole @@ -23,34 +21,40 @@ use Monolog\LogRecord; * to put on top of an existing stack to override it temporarily. * * @author Jordi Boggiano + * + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger */ class NullHandler extends Handler { - private Level $level; + /** + * @var int + */ + private $level; /** - * @param string|int|Level $level The minimum logging level at which this handler will be triggered + * @param string|int $level The minimum logging level at which this handler will be triggered * - * @phpstan-param value-of|value-of|Level|LogLevel::* $level + * @phpstan-param Level|LevelName|LogLevel::* $level */ - public function __construct(string|int|Level $level = Level::Debug) + public function __construct($level = Logger::DEBUG) { $this->level = Logger::toMonologLevel($level); } /** - * @inheritDoc + * {@inheritDoc} */ - public function isHandling(LogRecord $record): bool + public function isHandling(array $record): bool { - return $record->level->value >= $this->level->value; + return $record['level'] >= $this->level; } /** - * @inheritDoc + * {@inheritDoc} */ - public function handle(LogRecord $record): bool + public function handle(array $record): bool { - return $record->level->value >= $this->level->value; + return $record['level'] >= $this->level; } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/OverflowHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/OverflowHandler.php index a72b7a11..22068c9a 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/OverflowHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/OverflowHandler.php @@ -11,9 +11,8 @@ namespace Monolog\Handler; -use Monolog\Level; +use Monolog\Logger; use Monolog\Formatter\FormatterInterface; -use Monolog\LogRecord; /** * Handler to only pass log messages when a certain threshold of number of messages is reached. @@ -28,7 +27,7 @@ use Monolog\LogRecord; * $handler = new SomeHandler(...) * * // Pass all warnings to the handler when more than 10 & all error messages when more then 5 - * $overflow = new OverflowHandler($handler, [Level::Warning->value => 10, Level::Error->value => 5]); + * $overflow = new OverflowHandler($handler, [Logger::WARNING => 10, Logger::ERROR => 5]); * * $log->pushHandler($overflow); *``` @@ -37,25 +36,36 @@ use Monolog\LogRecord; */ class OverflowHandler extends AbstractHandler implements FormattableHandlerInterface { - private HandlerInterface $handler; + /** @var HandlerInterface */ + private $handler; - /** @var array */ - private array $thresholdMap = []; + /** @var int[] */ + private $thresholdMap = [ + Logger::DEBUG => 0, + Logger::INFO => 0, + Logger::NOTICE => 0, + Logger::WARNING => 0, + Logger::ERROR => 0, + Logger::CRITICAL => 0, + Logger::ALERT => 0, + Logger::EMERGENCY => 0, + ]; /** * Buffer of all messages passed to the handler before the threshold was reached * * @var mixed[][] */ - private array $buffer = []; + private $buffer = []; /** - * @param array $thresholdMap Dictionary of log level value => threshold + * @param HandlerInterface $handler + * @param int[] $thresholdMap Dictionary of logger level => threshold */ public function __construct( HandlerInterface $handler, array $thresholdMap = [], - $level = Level::Debug, + $level = Logger::DEBUG, bool $bubble = true ) { $this->handler = $handler; @@ -75,15 +85,15 @@ class OverflowHandler extends AbstractHandler implements FormattableHandlerInter * Unless the bubbling is interrupted (by returning true), the Logger class will keep on * calling further handlers in the stack with a given log record. * - * @inheritDoc + * {@inheritDoc} */ - public function handle(LogRecord $record): bool + public function handle(array $record): bool { - if ($record->level->isLowerThan($this->level)) { + if ($record['level'] < $this->level) { return false; } - $level = $record->level->value; + $level = $record['level']; if (!isset($this->thresholdMap[$level])) { $this->thresholdMap[$level] = 0; @@ -112,7 +122,7 @@ class OverflowHandler extends AbstractHandler implements FormattableHandlerInter } /** - * @inheritDoc + * {@inheritDoc} */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -126,7 +136,7 @@ class OverflowHandler extends AbstractHandler implements FormattableHandlerInter } /** - * @inheritDoc + * {@inheritDoc} */ public function getFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php index 8aa78e4c..23a1d117 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/PHPConsoleHandler.php @@ -13,13 +13,11 @@ namespace Monolog\Handler; use Monolog\Formatter\LineFormatter; use Monolog\Formatter\FormatterInterface; -use Monolog\Level; +use Monolog\Logger; use Monolog\Utils; use PhpConsole\Connector; use PhpConsole\Handler as VendorPhpConsoleHandler; use PhpConsole\Helper; -use Monolog\LogRecord; -use PhpConsole\Storage; /** * Monolog handler for Google Chrome extension "PHP Console" @@ -39,59 +37,14 @@ use PhpConsole\Storage; * PC::debug($_SERVER); // PHP Console debugger for any type of vars * * @author Sergey Barbushin https://www.linkedin.com/in/barbushin - * @phpstan-type Options array{ - * enabled: bool, - * classesPartialsTraceIgnore: string[], - * debugTagsKeysInContext: array, - * useOwnErrorsHandler: bool, - * useOwnExceptionsHandler: bool, - * sourcesBasePath: string|null, - * registerHelper: bool, - * serverEncoding: string|null, - * headersLimit: int|null, - * password: string|null, - * enableSslOnlyMode: bool, - * ipMasks: string[], - * enableEvalListener: bool, - * dumperDetectCallbacks: bool, - * dumperLevelLimit: int, - * dumperItemsCountLimit: int, - * dumperItemSizeLimit: int, - * dumperDumpSizeLimit: int, - * detectDumpTraceAndSource: bool, - * dataStorage: Storage|null - * } - * @phpstan-type InputOptions array{ - * enabled?: bool, - * classesPartialsTraceIgnore?: string[], - * debugTagsKeysInContext?: array, - * useOwnErrorsHandler?: bool, - * useOwnExceptionsHandler?: bool, - * sourcesBasePath?: string|null, - * registerHelper?: bool, - * serverEncoding?: string|null, - * headersLimit?: int|null, - * password?: string|null, - * enableSslOnlyMode?: bool, - * ipMasks?: string[], - * enableEvalListener?: bool, - * dumperDetectCallbacks?: bool, - * dumperLevelLimit?: int, - * dumperItemsCountLimit?: int, - * dumperItemSizeLimit?: int, - * dumperDumpSizeLimit?: int, - * detectDumpTraceAndSource?: bool, - * dataStorage?: Storage|null - * } * + * @phpstan-import-type Record from \Monolog\Logger * @deprecated Since 2.8.0 and 3.2.0, PHPConsole is abandoned and thus we will drop this handler in Monolog 4 */ class PHPConsoleHandler extends AbstractProcessingHandler { - /** - * @phpstan-var Options - */ - private array $options = [ + /** @var array */ + private $options = [ 'enabled' => true, // bool Is PHP Console server enabled 'classesPartialsTraceIgnore' => ['Monolog\\'], // array Hide calls of classes started with... 'debugTagsKeysInContext' => [0, 'tag'], // bool Is PHP Console server enabled @@ -114,15 +67,15 @@ class PHPConsoleHandler extends AbstractProcessingHandler 'dataStorage' => null, // \PhpConsole\Storage|null Fixes problem with custom $_SESSION handler(see http://goo.gl/Ne8juJ) ]; - private Connector $connector; + /** @var Connector */ + private $connector; /** * @param array $options See \Monolog\Handler\PHPConsoleHandler::$options for more details * @param Connector|null $connector Instance of \PhpConsole\Connector class (optional) * @throws \RuntimeException - * @phpstan-param InputOptions $options */ - public function __construct(array $options = [], ?Connector $connector = null, int|string|Level $level = Level::Debug, bool $bubble = true) + public function __construct(array $options = [], ?Connector $connector = null, $level = Logger::DEBUG, bool $bubble = true) { if (!class_exists('PhpConsole\Connector')) { throw new \RuntimeException('PHP Console library not found. See https://github.com/barbushin/php-console#installation'); @@ -133,16 +86,14 @@ class PHPConsoleHandler extends AbstractProcessingHandler } /** - * @param array $options - * @return array + * @param array $options * - * @phpstan-param InputOptions $options - * @phpstan-return Options + * @return array */ private function initOptions(array $options): array { $wrongOptions = array_diff(array_keys($options), array_keys($this->options)); - if (\count($wrongOptions) > 0) { + if ($wrongOptions) { throw new \RuntimeException('Unknown options: ' . implode(', ', $wrongOptions)); } @@ -151,8 +102,8 @@ class PHPConsoleHandler extends AbstractProcessingHandler private function initConnector(?Connector $connector = null): Connector { - if (null === $connector) { - if ($this->options['dataStorage'] instanceof Storage) { + if (!$connector) { + if ($this->options['dataStorage']) { Connector::setPostponeStorage($this->options['dataStorage']); } $connector = Connector::getInstance(); @@ -169,22 +120,22 @@ class PHPConsoleHandler extends AbstractProcessingHandler $handler->setHandleExceptions($this->options['useOwnExceptionsHandler']); $handler->start(); } - if (null !== $this->options['sourcesBasePath']) { + if ($this->options['sourcesBasePath']) { $connector->setSourcesBasePath($this->options['sourcesBasePath']); } - if (null !== $this->options['serverEncoding']) { + if ($this->options['serverEncoding']) { $connector->setServerEncoding($this->options['serverEncoding']); } - if (null !== $this->options['password']) { + if ($this->options['password']) { $connector->setPassword($this->options['password']); } if ($this->options['enableSslOnlyMode']) { $connector->enableSslOnlyMode(); } - if (\count($this->options['ipMasks']) > 0) { + if ($this->options['ipMasks']) { $connector->setAllowedIpMasks($this->options['ipMasks']); } - if (null !== $this->options['headersLimit'] && $this->options['headersLimit'] > 0) { + if ($this->options['headersLimit']) { $connector->setHeadersLimit($this->options['headersLimit']); } if ($this->options['detectDumpTraceAndSource']) { @@ -217,7 +168,7 @@ class PHPConsoleHandler extends AbstractProcessingHandler return $this->options; } - public function handle(LogRecord $record): bool + public function handle(array $record): bool { if ($this->options['enabled'] && $this->connector->isActiveClient()) { return parent::handle($record); @@ -229,39 +180,48 @@ class PHPConsoleHandler extends AbstractProcessingHandler /** * Writes the record down to the log of the implementing handler */ - protected function write(LogRecord $record): void + protected function write(array $record): void { - if ($record->level->isLowerThan(Level::Notice)) { + if ($record['level'] < Logger::NOTICE) { $this->handleDebugRecord($record); - } elseif (isset($record->context['exception']) && $record->context['exception'] instanceof \Throwable) { + } elseif (isset($record['context']['exception']) && $record['context']['exception'] instanceof \Throwable) { $this->handleExceptionRecord($record); } else { $this->handleErrorRecord($record); } } - private function handleDebugRecord(LogRecord $record): void + /** + * @phpstan-param Record $record + */ + private function handleDebugRecord(array $record): void { - [$tags, $filteredContext] = $this->getRecordTags($record); - $message = $record->message; - if (\count($filteredContext) > 0) { - $message .= ' ' . Utils::jsonEncode($this->connector->getDumper()->dump(array_filter($filteredContext)), null, true); + $tags = $this->getRecordTags($record); + $message = $record['message']; + if ($record['context']) { + $message .= ' ' . Utils::jsonEncode($this->connector->getDumper()->dump(array_filter($record['context'])), null, true); } $this->connector->getDebugDispatcher()->dispatchDebug($message, $tags, $this->options['classesPartialsTraceIgnore']); } - private function handleExceptionRecord(LogRecord $record): void + /** + * @phpstan-param Record $record + */ + private function handleExceptionRecord(array $record): void { - $this->connector->getErrorsDispatcher()->dispatchException($record->context['exception']); + $this->connector->getErrorsDispatcher()->dispatchException($record['context']['exception']); } - private function handleErrorRecord(LogRecord $record): void + /** + * @phpstan-param Record $record + */ + private function handleErrorRecord(array $record): void { - $context = $record->context; + $context = $record['context']; $this->connector->getErrorsDispatcher()->dispatchError( $context['code'] ?? null, - $context['message'] ?? $record->message, + $context['message'] ?? $record['message'], $context['file'] ?? null, $context['line'] ?? null, $this->options['classesPartialsTraceIgnore'] @@ -269,32 +229,32 @@ class PHPConsoleHandler extends AbstractProcessingHandler } /** - * @return array{string, mixed[]} + * @phpstan-param Record $record + * @return string */ - private function getRecordTags(LogRecord $record): array + private function getRecordTags(array &$record) { $tags = null; - $filteredContext = []; - if ($record->context !== []) { - $filteredContext = $record->context; + if (!empty($record['context'])) { + $context = & $record['context']; foreach ($this->options['debugTagsKeysInContext'] as $key) { - if (isset($filteredContext[$key])) { - $tags = $filteredContext[$key]; + if (!empty($context[$key])) { + $tags = $context[$key]; if ($key === 0) { - array_shift($filteredContext); + array_shift($context); } else { - unset($filteredContext[$key]); + unset($context[$key]); } break; } } } - return [$tags ?? $record->level->toPsrLogLevel(), $filteredContext]; + return $tags ?: strtolower($record['level_name']); } /** - * @inheritDoc + * {@inheritDoc} */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessHandler.php index 9edc9ac5..8a8cf1be 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessHandler.php @@ -11,8 +11,7 @@ namespace Monolog\Handler; -use Monolog\Level; -use Monolog\LogRecord; +use Monolog\Logger; /** * Stores to STDIN of any process, specified by a command. @@ -34,14 +33,20 @@ class ProcessHandler extends AbstractProcessingHandler */ private $process; - private string $command; + /** + * @var string + */ + private $command; - private ?string $cwd; + /** + * @var string|null + */ + private $cwd; /** * @var resource[] */ - private array $pipes = []; + private $pipes = []; /** * @var array @@ -58,7 +63,7 @@ class ProcessHandler extends AbstractProcessingHandler * @param string|null $cwd "Current working directory" (CWD) for the process to be executed in. * @throws \InvalidArgumentException */ - public function __construct(string $command, int|string|Level $level = Level::Debug, bool $bubble = true, ?string $cwd = null) + public function __construct(string $command, $level = Logger::DEBUG, bool $bubble = true, ?string $cwd = null) { if ($command === '') { throw new \InvalidArgumentException('The command argument must be a non-empty string.'); @@ -78,14 +83,14 @@ class ProcessHandler extends AbstractProcessingHandler * * @throws \UnexpectedValueException */ - protected function write(LogRecord $record): void + protected function write(array $record): void { $this->ensureProcessIsStarted(); - $this->writeProcessInput($record->formatted); + $this->writeProcessInput($record['formatted']); $errors = $this->readProcessErrors(); - if ($errors !== '') { + if (empty($errors) === false) { throw new \UnexpectedValueException(sprintf('Errors while writing to process: %s', $errors)); } } @@ -129,7 +134,7 @@ class ProcessHandler extends AbstractProcessingHandler $errors = $this->readProcessErrors(); - if (is_resource($this->process) === false || $errors !== '') { + if (is_resource($this->process) === false || empty($errors) === false) { throw new \UnexpectedValueException( sprintf('The process "%s" could not be opened: ' . $errors, $this->command) ); @@ -171,7 +176,7 @@ class ProcessHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ public function close(): void { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php index 9fb290fa..3adec7a4 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerInterface.php @@ -12,19 +12,20 @@ namespace Monolog\Handler; use Monolog\Processor\ProcessorInterface; -use Monolog\LogRecord; /** * Interface to describe loggers that have processors * * @author Jordi Boggiano + * + * @phpstan-import-type Record from \Monolog\Logger */ interface ProcessableHandlerInterface { /** * Adds a processor in the stack. * - * @phpstan-param ProcessorInterface|(callable(LogRecord): LogRecord) $callback + * @psalm-param ProcessorInterface|callable(Record): Record $callback * * @param ProcessorInterface|callable $callback * @return HandlerInterface self @@ -34,7 +35,7 @@ interface ProcessableHandlerInterface /** * Removes the processor on top of the stack and returns it. * - * @phpstan-return ProcessorInterface|(callable(LogRecord): LogRecord) $callback + * @psalm-return ProcessorInterface|callable(Record): Record $callback * * @throws \LogicException In case the processor stack is empty * @return callable|ProcessorInterface diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php index 74eedddd..9ef6e301 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ProcessableHandlerTrait.php @@ -13,23 +13,24 @@ namespace Monolog\Handler; use Monolog\ResettableInterface; use Monolog\Processor\ProcessorInterface; -use Monolog\LogRecord; /** * Helper trait for implementing ProcessableInterface * * @author Jordi Boggiano + * + * @phpstan-import-type Record from \Monolog\Logger */ trait ProcessableHandlerTrait { /** * @var callable[] - * @phpstan-var array<(callable(LogRecord): LogRecord)|ProcessorInterface> + * @phpstan-var array */ - protected array $processors = []; + protected $processors = []; /** - * @inheritDoc + * {@inheritDoc} */ public function pushProcessor(callable $callback): HandlerInterface { @@ -39,18 +40,24 @@ trait ProcessableHandlerTrait } /** - * @inheritDoc + * {@inheritDoc} */ public function popProcessor(): callable { - if (\count($this->processors) === 0) { + if (!$this->processors) { throw new \LogicException('You tried to pop from an empty processor stack.'); } return array_shift($this->processors); } - protected function processRecord(LogRecord $record): LogRecord + /** + * Processes a record. + * + * @phpstan-param Record $record + * @phpstan-return Record + */ + protected function processRecord(array $record): array { foreach ($this->processors as $processor) { $record = $processor($record); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php index 6599a83b..36e19ccc 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/PsrHandler.php @@ -11,10 +11,9 @@ namespace Monolog\Handler; -use Monolog\Level; +use Monolog\Logger; use Psr\Log\LoggerInterface; use Monolog\Formatter\FormatterInterface; -use Monolog\LogRecord; /** * Proxies log messages to an existing PSR-3 compliant logger. @@ -29,15 +28,20 @@ class PsrHandler extends AbstractHandler implements FormattableHandlerInterface { /** * PSR-3 compliant logger + * + * @var LoggerInterface */ - protected LoggerInterface $logger; + protected $logger; - protected FormatterInterface|null $formatter = null; + /** + * @var FormatterInterface|null + */ + protected $formatter; /** * @param LoggerInterface $logger The underlying PSR-3 compliant logger to which messages will be proxied */ - public function __construct(LoggerInterface $logger, int|string|Level $level = Level::Debug, bool $bubble = true) + public function __construct(LoggerInterface $logger, $level = Logger::DEBUG, bool $bubble = true) { parent::__construct($level, $bubble); @@ -45,19 +49,19 @@ class PsrHandler extends AbstractHandler implements FormattableHandlerInterface } /** - * @inheritDoc + * {@inheritDoc} */ - public function handle(LogRecord $record): bool + public function handle(array $record): bool { if (!$this->isHandling($record)) { return false; } - if ($this->formatter !== null) { + if ($this->formatter) { $formatted = $this->formatter->format($record); - $this->logger->log($record->level->toPsrLogLevel(), (string) $formatted, $record->context); + $this->logger->log(strtolower($record['level_name']), (string) $formatted, $record['context']); } else { - $this->logger->log($record->level->toPsrLogLevel(), $record->message, $record->context); + $this->logger->log(strtolower($record['level_name']), $record['message'], $record['context']); } return false === $this->bubble; @@ -65,6 +69,8 @@ class PsrHandler extends AbstractHandler implements FormattableHandlerInterface /** * Sets the formatter. + * + * @param FormatterInterface $formatter */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -75,10 +81,12 @@ class PsrHandler extends AbstractHandler implements FormattableHandlerInterface /** * Gets the formatter. + * + * @return FormatterInterface */ public function getFormatter(): FormatterInterface { - if ($this->formatter === null) { + if (!$this->formatter) { throw new \LogicException('No formatter has been set and this handler does not have a default formatter'); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php index 118f5760..fed2303d 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/PushoverHandler.php @@ -11,45 +11,48 @@ namespace Monolog\Handler; -use Monolog\Level; use Monolog\Logger; use Monolog\Utils; use Psr\Log\LogLevel; -use Monolog\LogRecord; /** * Sends notifications through the pushover api to mobile phones * * @author Sebastian Göttschkes * @see https://www.pushover.net/api + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger */ class PushoverHandler extends SocketHandler { - private string $token; - + /** @var string */ + private $token; /** @var array */ - private array $users; + private $users; + /** @var string */ + private $title; + /** @var string|int|null */ + private $user = null; + /** @var int */ + private $retry; + /** @var int */ + private $expire; - private string $title; - - private string|int|null $user = null; - - private int $retry; - - private int $expire; - - private Level $highPriorityLevel; - - private Level $emergencyLevel; - - private bool $useFormattedMessage = false; + /** @var int */ + private $highPriorityLevel; + /** @var int */ + private $emergencyLevel; + /** @var bool */ + private $useFormattedMessage = false; /** * All parameters that can be sent to Pushover * @see https://pushover.net/api * @var array */ - private array $parameterNames = [ + private $parameterNames = [ 'token' => true, 'user' => true, 'message' => true, @@ -70,42 +73,40 @@ class PushoverHandler extends SocketHandler * @see https://pushover.net/api#sounds * @var string[] */ - private array $sounds = [ + private $sounds = [ 'pushover', 'bike', 'bugle', 'cashregister', 'classical', 'cosmic', 'falling', 'gamelan', 'incoming', 'intermission', 'magic', 'mechanical', 'pianobar', 'siren', 'spacealarm', 'tugboat', 'alien', 'climb', 'persistent', 'echo', 'updown', 'none', ]; /** - * @param string $token Pushover api token - * @param string|array $users Pushover user id or array of ids the message will be sent to - * @param string|null $title Title sent to the Pushover API - * @param bool $useSSL Whether to connect via SSL. Required when pushing messages to users that are not - * the pushover.net app owner. OpenSSL is required for this option. - * @param int $retry The retry parameter specifies how often (in seconds) the Pushover servers will - * send the same notification to the user. - * @param int $expire The expire parameter specifies how many seconds your notification will continue - * to be retried for (every retry seconds). - * - * @param int|string|Level|LogLevel::* $highPriorityLevel The minimum logging level at which this handler will start - * sending "high priority" requests to the Pushover API - * @param int|string|Level|LogLevel::* $emergencyLevel The minimum logging level at which this handler will start - * sending "emergency" requests to the Pushover API - * + * @param string $token Pushover api token + * @param string|array $users Pushover user id or array of ids the message will be sent to + * @param string|null $title Title sent to the Pushover API + * @param bool $useSSL Whether to connect via SSL. Required when pushing messages to users that are not + * the pushover.net app owner. OpenSSL is required for this option. + * @param string|int $highPriorityLevel The minimum logging level at which this handler will start + * sending "high priority" requests to the Pushover API + * @param string|int $emergencyLevel The minimum logging level at which this handler will start + * sending "emergency" requests to the Pushover API + * @param int $retry The retry parameter specifies how often (in seconds) the Pushover servers will + * send the same notification to the user. + * @param int $expire The expire parameter specifies how many seconds your notification will continue + * to be retried for (every retry seconds). * * @phpstan-param string|array $users - * @phpstan-param value-of|value-of|Level|LogLevel::* $highPriorityLevel - * @phpstan-param value-of|value-of|Level|LogLevel::* $emergencyLevel + * @phpstan-param Level|LevelName|LogLevel::* $highPriorityLevel + * @phpstan-param Level|LevelName|LogLevel::* $emergencyLevel */ public function __construct( string $token, $users, ?string $title = null, - int|string|Level $level = Level::Critical, + $level = Logger::CRITICAL, bool $bubble = true, bool $useSSL = true, - int|string|Level $highPriorityLevel = Level::Critical, - int|string|Level $emergencyLevel = Level::Emergency, + $highPriorityLevel = Logger::CRITICAL, + $emergencyLevel = Logger::EMERGENCY, int $retry = 30, int $expire = 25200, bool $persistent = false, @@ -128,29 +129,32 @@ class PushoverHandler extends SocketHandler $this->token = $token; $this->users = (array) $users; - $this->title = $title ?? (string) gethostname(); + $this->title = $title ?: (string) gethostname(); $this->highPriorityLevel = Logger::toMonologLevel($highPriorityLevel); $this->emergencyLevel = Logger::toMonologLevel($emergencyLevel); $this->retry = $retry; $this->expire = $expire; } - protected function generateDataStream(LogRecord $record): string + protected function generateDataStream(array $record): string { $content = $this->buildContent($record); return $this->buildHeader($content) . $content; } - private function buildContent(LogRecord $record): string + /** + * @phpstan-param FormattedRecord $record + */ + private function buildContent(array $record): string { // Pushover has a limit of 512 characters on title and message combined. $maxMessageLength = 512 - strlen($this->title); - $message = ($this->useFormattedMessage) ? $record->formatted : $record->message; + $message = ($this->useFormattedMessage) ? $record['formatted'] : $record['message']; $message = Utils::substr($message, 0, $maxMessageLength); - $timestamp = $record->datetime->getTimestamp(); + $timestamp = $record['datetime']->getTimestamp(); $dataArray = [ 'token' => $this->token, @@ -160,23 +164,23 @@ class PushoverHandler extends SocketHandler 'timestamp' => $timestamp, ]; - if ($record->level->value >= $this->emergencyLevel->value) { + if (isset($record['level']) && $record['level'] >= $this->emergencyLevel) { $dataArray['priority'] = 2; $dataArray['retry'] = $this->retry; $dataArray['expire'] = $this->expire; - } elseif ($record->level->value >= $this->highPriorityLevel->value) { + } elseif (isset($record['level']) && $record['level'] >= $this->highPriorityLevel) { $dataArray['priority'] = 1; } // First determine the available parameters - $context = array_intersect_key($record->context, $this->parameterNames); - $extra = array_intersect_key($record->extra, $this->parameterNames); + $context = array_intersect_key($record['context'], $this->parameterNames); + $extra = array_intersect_key($record['extra'], $this->parameterNames); // Least important info should be merged with subsequent info $dataArray = array_merge($extra, $context, $dataArray); // Only pass sounds that are supported by the API - if (isset($dataArray['sound']) && !in_array($dataArray['sound'], $this->sounds, true)) { + if (isset($dataArray['sound']) && !in_array($dataArray['sound'], $this->sounds)) { unset($dataArray['sound']); } @@ -194,7 +198,7 @@ class PushoverHandler extends SocketHandler return $header; } - protected function write(LogRecord $record): void + protected function write(array $record): void { foreach ($this->users as $user) { $this->user = $user; @@ -207,25 +211,25 @@ class PushoverHandler extends SocketHandler } /** - * @param int|string|Level|LogLevel::* $level + * @param int|string $value * - * @phpstan-param value-of|value-of|Level|LogLevel::* $level + * @phpstan-param Level|LevelName|LogLevel::* $value */ - public function setHighPriorityLevel(int|string|Level $level): self + public function setHighPriorityLevel($value): self { - $this->highPriorityLevel = Logger::toMonologLevel($level); + $this->highPriorityLevel = Logger::toMonologLevel($value); return $this; } /** - * @param int|string|Level|LogLevel::* $level + * @param int|string $value * - * @phpstan-param value-of|value-of|Level|LogLevel::* $level + * @phpstan-param Level|LevelName|LogLevel::* $value */ - public function setEmergencyLevel(int|string|Level $level): self + public function setEmergencyLevel($value): self { - $this->emergencyLevel = Logger::toMonologLevel($level); + $this->emergencyLevel = Logger::toMonologLevel($value); return $this; } @@ -233,9 +237,9 @@ class PushoverHandler extends SocketHandler /** * Use the formatted message? */ - public function useFormattedMessage(bool $useFormattedMessage): self + public function useFormattedMessage(bool $value): self { - $this->useFormattedMessage = $useFormattedMessage; + $this->useFormattedMessage = $value; return $this; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php index 5eee5dc6..91d16eaf 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/RedisHandler.php @@ -13,10 +13,7 @@ namespace Monolog\Handler; use Monolog\Formatter\LineFormatter; use Monolog\Formatter\FormatterInterface; -use Monolog\Level; -use Monolog\LogRecord; -use Predis\Client as Predis; -use Redis; +use Monolog\Logger; /** * Logs to a Redis key using rpush @@ -28,21 +25,29 @@ use Redis; * $log->pushHandler($redis); * * @author Thomas Tourlourat + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler */ class RedisHandler extends AbstractProcessingHandler { - /** @var Predis|Redis */ - private Predis|Redis $redisClient; - private string $redisKey; - protected int $capSize; + /** @var \Predis\Client<\Predis\Client>|\Redis */ + private $redisClient; + /** @var string */ + private $redisKey; + /** @var int */ + protected $capSize; /** - * @param Predis|Redis $redis The redis instance - * @param string $key The key name to push records to - * @param int $capSize Number of entries to limit list size to, 0 = unlimited + * @param \Predis\Client<\Predis\Client>|\Redis $redis The redis instance + * @param string $key The key name to push records to + * @param int $capSize Number of entries to limit list size to, 0 = unlimited */ - public function __construct(Predis|Redis $redis, string $key, int|string|Level $level = Level::Debug, bool $bubble = true, int $capSize = 0) + public function __construct($redis, string $key, $level = Logger::DEBUG, bool $bubble = true, int $capSize = 0) { + if (!(($redis instanceof \Predis\Client) || ($redis instanceof \Redis))) { + throw new \InvalidArgumentException('Predis\Client or Redis instance required'); + } + $this->redisClient = $redis; $this->redisKey = $key; $this->capSize = $capSize; @@ -51,41 +56,43 @@ class RedisHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { - if ($this->capSize > 0) { + if ($this->capSize) { $this->writeCapped($record); } else { - $this->redisClient->rpush($this->redisKey, $record->formatted); + $this->redisClient->rpush($this->redisKey, $record["formatted"]); } } /** * Write and cap the collection * Writes the record to the redis list and caps its + * + * @phpstan-param FormattedRecord $record */ - protected function writeCapped(LogRecord $record): void + protected function writeCapped(array $record): void { - if ($this->redisClient instanceof Redis) { - $mode = defined('Redis::MULTI') ? Redis::MULTI : 1; + if ($this->redisClient instanceof \Redis) { + $mode = defined('\Redis::MULTI') ? \Redis::MULTI : 1; $this->redisClient->multi($mode) - ->rPush($this->redisKey, $record->formatted) + ->rpush($this->redisKey, $record["formatted"]) ->ltrim($this->redisKey, -$this->capSize, -1) ->exec(); } else { $redisKey = $this->redisKey; $capSize = $this->capSize; $this->redisClient->transaction(function ($tx) use ($record, $redisKey, $capSize) { - $tx->rpush($redisKey, $record->formatted); + $tx->rpush($redisKey, $record["formatted"]); $tx->ltrim($redisKey, -$capSize, -1); }); } } /** - * @inheritDoc + * {@inheritDoc} */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/RedisPubSubHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/RedisPubSubHandler.php index fa8e9e9f..7789309c 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/RedisPubSubHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/RedisPubSubHandler.php @@ -13,10 +13,7 @@ namespace Monolog\Handler; use Monolog\Formatter\LineFormatter; use Monolog\Formatter\FormatterInterface; -use Monolog\Level; -use Monolog\LogRecord; -use Predis\Client as Predis; -use Redis; +use Monolog\Logger; /** * Sends the message to a Redis Pub/Sub channel using PUBLISH @@ -24,23 +21,28 @@ use Redis; * usage example: * * $log = new Logger('application'); - * $redis = new RedisPubSubHandler(new Predis\Client("tcp://localhost:6379"), "logs", Level::Warning); + * $redis = new RedisPubSubHandler(new Predis\Client("tcp://localhost:6379"), "logs", Logger::WARNING); * $log->pushHandler($redis); * * @author Gaëtan Faugère */ class RedisPubSubHandler extends AbstractProcessingHandler { - /** @var Predis|Redis */ - private Predis|Redis $redisClient; - private string $channelKey; + /** @var \Predis\Client<\Predis\Client>|\Redis */ + private $redisClient; + /** @var string */ + private $channelKey; /** - * @param Predis|Redis $redis The redis instance - * @param string $key The channel key to publish records to + * @param \Predis\Client<\Predis\Client>|\Redis $redis The redis instance + * @param string $key The channel key to publish records to */ - public function __construct(Predis|Redis $redis, string $key, int|string|Level $level = Level::Debug, bool $bubble = true) + public function __construct($redis, string $key, $level = Logger::DEBUG, bool $bubble = true) { + if (!(($redis instanceof \Predis\Client) || ($redis instanceof \Redis))) { + throw new \InvalidArgumentException('Predis\Client or Redis instance required'); + } + $this->redisClient = $redis; $this->channelKey = $key; @@ -48,15 +50,15 @@ class RedisPubSubHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { - $this->redisClient->publish($this->channelKey, $record->formatted); + $this->redisClient->publish($this->channelKey, $record["formatted"]); } /** - * @inheritDoc + * {@inheritDoc} */ protected function getDefaultFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php index 1d124723..adcc9395 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/RollbarHandler.php @@ -11,10 +11,9 @@ namespace Monolog\Handler; -use Monolog\Level; use Rollbar\RollbarLogger; use Throwable; -use Monolog\LogRecord; +use Monolog\Logger; /** * Sends errors to Rollbar @@ -34,19 +33,37 @@ use Monolog\LogRecord; */ class RollbarHandler extends AbstractProcessingHandler { - protected RollbarLogger $rollbarLogger; + /** + * @var RollbarLogger + */ + protected $rollbarLogger; + + /** @var string[] */ + protected $levelMap = [ + Logger::DEBUG => 'debug', + Logger::INFO => 'info', + Logger::NOTICE => 'info', + Logger::WARNING => 'warning', + Logger::ERROR => 'error', + Logger::CRITICAL => 'critical', + Logger::ALERT => 'critical', + Logger::EMERGENCY => 'critical', + ]; /** * Records whether any log records have been added since the last flush of the rollbar notifier + * + * @var bool */ - private bool $hasRecords = false; + private $hasRecords = false; - protected bool $initialized = false; + /** @var bool */ + protected $initialized = false; /** * @param RollbarLogger $rollbarLogger RollbarLogger object constructed with valid token */ - public function __construct(RollbarLogger $rollbarLogger, int|string|Level $level = Level::Error, bool $bubble = true) + public function __construct(RollbarLogger $rollbarLogger, $level = Logger::ERROR, bool $bubble = true) { $this->rollbarLogger = $rollbarLogger; @@ -54,41 +71,22 @@ class RollbarHandler extends AbstractProcessingHandler } /** - * Translates Monolog log levels to Rollbar levels. - * - * @return 'debug'|'info'|'warning'|'error'|'critical' + * {@inheritDoc} */ - protected function toRollbarLevel(Level $level): string - { - return match ($level) { - Level::Debug => 'debug', - Level::Info => 'info', - Level::Notice => 'info', - Level::Warning => 'warning', - Level::Error => 'error', - Level::Critical => 'critical', - Level::Alert => 'critical', - Level::Emergency => 'critical', - }; - } - - /** - * @inheritDoc - */ - protected function write(LogRecord $record): void + protected function write(array $record): void { if (!$this->initialized) { // __destructor() doesn't get called on Fatal errors - register_shutdown_function([$this, 'close']); + register_shutdown_function(array($this, 'close')); $this->initialized = true; } - $context = $record->context; - $context = array_merge($context, $record->extra, [ - 'level' => $this->toRollbarLevel($record->level), - 'monolog_level' => $record->level->getName(), - 'channel' => $record->channel, - 'datetime' => $record->datetime->format('U'), + $context = $record['context']; + $context = array_merge($context, $record['extra'], [ + 'level' => $this->levelMap[$record['level']], + 'monolog_level' => $record['level_name'], + 'channel' => $record['channel'], + 'datetime' => $record['datetime']->format('U'), ]); if (isset($context['exception']) && $context['exception'] instanceof Throwable) { @@ -96,7 +94,7 @@ class RollbarHandler extends AbstractProcessingHandler unset($context['exception']); $toLog = $exception; } else { - $toLog = $record->message; + $toLog = $record['message']; } // @phpstan-ignore-next-line @@ -114,7 +112,7 @@ class RollbarHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ public function close(): void { @@ -122,9 +120,9 @@ class RollbarHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ - public function reset(): void + public function reset() { $this->flush(); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php index 12ce6923..17745d22 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php @@ -12,9 +12,8 @@ namespace Monolog\Handler; use InvalidArgumentException; -use Monolog\Level; +use Monolog\Logger; use Monolog\Utils; -use Monolog\LogRecord; /** * Stores logs to files that are rotated every day and a limited number of files are kept. @@ -31,19 +30,26 @@ class RotatingFileHandler extends StreamHandler public const FILE_PER_MONTH = 'Y-m'; public const FILE_PER_YEAR = 'Y'; - protected string $filename; - protected int $maxFiles; - protected bool|null $mustRotate = null; - protected \DateTimeImmutable $nextRotation; - protected string $filenameFormat; - protected string $dateFormat; + /** @var string */ + protected $filename; + /** @var int */ + protected $maxFiles; + /** @var bool */ + protected $mustRotate; + /** @var \DateTimeImmutable */ + protected $nextRotation; + /** @var string */ + protected $filenameFormat; + /** @var string */ + protected $dateFormat; /** - * @param int $maxFiles The maximal amount of files to keep (0 means unlimited) - * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) - * @param bool $useLocking Try to lock log file before doing any writes + * @param string $filename + * @param int $maxFiles The maximal amount of files to keep (0 means unlimited) + * @param int|null $filePermission Optional file permissions (default (0644) are only for owner read/write) + * @param bool $useLocking Try to lock log file before doing any writes */ - public function __construct(string $filename, int $maxFiles = 0, int|string|Level $level = Level::Debug, bool $bubble = true, ?int $filePermission = null, bool $useLocking = false) + public function __construct(string $filename, int $maxFiles = 0, $level = Logger::DEBUG, bool $bubble = true, ?int $filePermission = null, bool $useLocking = false) { $this->filename = Utils::canonicalizePath($filename); $this->maxFiles = $maxFiles; @@ -55,7 +61,7 @@ class RotatingFileHandler extends StreamHandler } /** - * @inheritDoc + * {@inheritDoc} */ public function close(): void { @@ -67,9 +73,9 @@ class RotatingFileHandler extends StreamHandler } /** - * @inheritDoc + * {@inheritDoc} */ - public function reset(): void + public function reset() { parent::reset(); @@ -80,7 +86,7 @@ class RotatingFileHandler extends StreamHandler public function setFilenameFormat(string $filenameFormat, string $dateFormat): self { - if (0 === preg_match('{^[Yy](([/_.-]?m)([/_.-]?d)?)?$}', $dateFormat)) { + if (!preg_match('{^[Yy](([/_.-]?m)([/_.-]?d)?)?$}', $dateFormat)) { throw new InvalidArgumentException( 'Invalid date format - format must be one of '. 'RotatingFileHandler::FILE_PER_DAY ("Y-m-d"), RotatingFileHandler::FILE_PER_MONTH ("Y-m") '. @@ -102,16 +108,16 @@ class RotatingFileHandler extends StreamHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { // on the first record written, if the log is new, we should rotate (once per day) if (null === $this->mustRotate) { $this->mustRotate = null === $this->url || !file_exists($this->url); } - if ($this->nextRotation <= $record->datetime) { + if ($this->nextRotation <= $record['datetime']) { $this->mustRotate = true; $this->close(); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php index 511ec585..c128a32d 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SamplingHandler.php @@ -11,9 +11,7 @@ namespace Monolog\Handler; -use Closure; use Monolog\Formatter\FormatterInterface; -use Monolog\LogRecord; /** * Sampling handler @@ -28,42 +26,52 @@ use Monolog\LogRecord; * * @author Bryan Davis * @author Kunal Mehta + * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger */ class SamplingHandler extends AbstractHandler implements ProcessableHandlerInterface, FormattableHandlerInterface { use ProcessableHandlerTrait; /** - * Handler or factory Closure($record, $this) - * - * @phpstan-var (Closure(LogRecord|null, HandlerInterface): HandlerInterface)|HandlerInterface + * @var HandlerInterface|callable + * @phpstan-var HandlerInterface|callable(Record|array{level: Level}|null, HandlerInterface): HandlerInterface */ - protected Closure|HandlerInterface $handler; - - protected int $factor; + protected $handler; /** - * @phpstan-param (Closure(LogRecord|null, HandlerInterface): HandlerInterface)|HandlerInterface $handler - * - * @param Closure|HandlerInterface $handler Handler or factory Closure($record|null, $samplingHandler). - * @param int $factor Sample factor (e.g. 10 means every ~10th record is sampled) + * @var int $factor */ - public function __construct(Closure|HandlerInterface $handler, int $factor) + protected $factor; + + /** + * @psalm-param HandlerInterface|callable(Record|array{level: Level}|null, HandlerInterface): HandlerInterface $handler + * + * @param callable|HandlerInterface $handler Handler or factory callable($record|null, $samplingHandler). + * @param int $factor Sample factor (e.g. 10 means every ~10th record is sampled) + */ + public function __construct($handler, int $factor) { parent::__construct(); $this->handler = $handler; $this->factor = $factor; + + if (!$this->handler instanceof HandlerInterface && !is_callable($this->handler)) { + throw new \RuntimeException("The given handler (".json_encode($this->handler).") is not a callable nor a Monolog\Handler\HandlerInterface object"); + } } - public function isHandling(LogRecord $record): bool + public function isHandling(array $record): bool { return $this->getHandler($record)->isHandling($record); } - public function handle(LogRecord $record): bool + public function handle(array $record): bool { if ($this->isHandling($record) && mt_rand(1, $this->factor) === 1) { - if (\count($this->processors) > 0) { + if ($this->processors) { + /** @var Record $record */ $record = $this->processRecord($record); } @@ -76,23 +84,26 @@ class SamplingHandler extends AbstractHandler implements ProcessableHandlerInter /** * Return the nested handler * - * If the handler was provided as a factory, this will trigger the handler's instantiation. + * If the handler was provided as a factory callable, this will trigger the handler's instantiation. + * + * @phpstan-param Record|array{level: Level}|null $record + * + * @return HandlerInterface */ - public function getHandler(LogRecord $record = null): HandlerInterface + public function getHandler(array $record = null) { if (!$this->handler instanceof HandlerInterface) { - $handler = ($this->handler)($record, $this); - if (!$handler instanceof HandlerInterface) { - throw new \RuntimeException("The factory Closure should return a HandlerInterface"); + $this->handler = ($this->handler)($record, $this); + if (!$this->handler instanceof HandlerInterface) { + throw new \RuntimeException("The factory callable should return a HandlerInterface"); } - $this->handler = $handler; } return $this->handler; } /** - * @inheritDoc + * {@inheritDoc} */ public function setFormatter(FormatterInterface $formatter): HandlerInterface { @@ -107,7 +118,7 @@ class SamplingHandler extends AbstractHandler implements ProcessableHandlerInter } /** - * @inheritDoc + * {@inheritDoc} */ public function getFormatter(): FormatterInterface { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SendGridHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SendGridHandler.php index 6228a02f..1280ee70 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SendGridHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SendGridHandler.php @@ -11,7 +11,7 @@ namespace Monolog\Handler; -use Monolog\Level; +use Monolog\Logger; /** * SendGridrHandler uses the SendGrid API v2 function to send Log emails, more information in https://sendgrid.com/docs/API_Reference/Web_API/mail.html @@ -22,29 +22,33 @@ class SendGridHandler extends MailHandler { /** * The SendGrid API User + * @var string */ - protected string $apiUser; + protected $apiUser; /** * The SendGrid API Key + * @var string */ - protected string $apiKey; + protected $apiKey; /** * The email addresses to which the message will be sent + * @var string */ - protected string $from; + protected $from; /** * The email addresses to which the message will be sent * @var string[] */ - protected array $to; + protected $to; /** * The subject of the email + * @var string */ - protected string $subject; + protected $subject; /** * @param string $apiUser The SendGrid API User @@ -53,7 +57,7 @@ class SendGridHandler extends MailHandler * @param string|string[] $to The recipients of the email * @param string $subject The subject of the mail */ - public function __construct(string $apiUser, string $apiKey, string $from, string|array $to, string $subject, int|string|Level $level = Level::Error, bool $bubble = true) + public function __construct(string $apiUser, string $apiKey, string $from, $to, string $subject, $level = Logger::ERROR, bool $bubble = true) { if (!extension_loaded('curl')) { throw new MissingExtensionException('The curl extension is needed to use the SendGridHandler'); @@ -68,7 +72,7 @@ class SendGridHandler extends MailHandler } /** - * @inheritDoc + * {@inheritDoc} */ protected function send(string $content, array $records): void { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php index 7e9cccc9..71a41094 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/Slack/SlackRecord.php @@ -11,11 +11,10 @@ namespace Monolog\Handler\Slack; -use Monolog\Level; +use Monolog\Logger; use Monolog\Utils; use Monolog\Formatter\NormalizerFormatter; use Monolog\Formatter\FormatterInterface; -use Monolog\LogRecord; /** * Slack record utility helping to log to Slack webhooks or API. @@ -24,6 +23,9 @@ use Monolog\LogRecord; * @author Haralan Dobrev * @see https://api.slack.com/incoming-webhooks * @see https://api.slack.com/docs/message-attachments + * + * @phpstan-import-type FormattedRecord from \Monolog\Handler\AbstractProcessingHandler + * @phpstan-import-type Record from \Monolog\Logger */ class SlackRecord { @@ -37,43 +39,55 @@ class SlackRecord /** * Slack channel (encoded ID or name) + * @var string|null */ - private string|null $channel; + private $channel; /** * Name of a bot + * @var string|null */ - private string|null $username; + private $username; /** * User icon e.g. 'ghost', 'http://example.com/user.png' + * @var string|null */ - private string|null $userIcon; + private $userIcon; /** * Whether the message should be added to Slack as attachment (plain text otherwise) + * @var bool */ - private bool $useAttachment; + private $useAttachment; /** * Whether the the context/extra messages added to Slack as attachments are in a short style + * @var bool */ - private bool $useShortAttachment; + private $useShortAttachment; /** * Whether the attachment should include context and extra data + * @var bool */ - private bool $includeContextAndExtra; + private $includeContextAndExtra; /** * Dot separated list of fields to exclude from slack message. E.g. ['context.field1', 'extra.field2'] * @var string[] */ - private array $excludeFields; + private $excludeFields; - private FormatterInterface|null $formatter; + /** + * @var ?FormatterInterface + */ + private $formatter; - private NormalizerFormatter $normalizerFormatter; + /** + * @var NormalizerFormatter + */ + private $normalizerFormatter; /** * @param string[] $excludeFields @@ -85,7 +99,7 @@ class SlackRecord ?string $userIcon = null, bool $useShortAttachment = false, bool $includeContextAndExtra = false, - array $excludeFields = [], + array $excludeFields = array(), FormatterInterface $formatter = null ) { $this @@ -107,76 +121,77 @@ class SlackRecord * Returns required data in format that Slack * is expecting. * + * @phpstan-param FormattedRecord $record * @phpstan-return mixed[] */ - public function getSlackData(LogRecord $record): array + public function getSlackData(array $record): array { - $dataArray = []; + $dataArray = array(); + $record = $this->removeExcludedFields($record); - if ($this->username !== null) { + if ($this->username) { $dataArray['username'] = $this->username; } - if ($this->channel !== null) { + if ($this->channel) { $dataArray['channel'] = $this->channel; } - if ($this->formatter !== null && !$this->useAttachment) { + if ($this->formatter && !$this->useAttachment) { + /** @phpstan-ignore-next-line */ $message = $this->formatter->format($record); } else { - $message = $record->message; + $message = $record['message']; } - $recordData = $this->removeExcludedFields($record); - if ($this->useAttachment) { - $attachment = [ - 'fallback' => $message, - 'text' => $message, - 'color' => $this->getAttachmentColor($record->level), - 'fields' => [], - 'mrkdwn_in' => ['fields'], - 'ts' => $recordData['datetime']->getTimestamp(), + $attachment = array( + 'fallback' => $message, + 'text' => $message, + 'color' => $this->getAttachmentColor($record['level']), + 'fields' => array(), + 'mrkdwn_in' => array('fields'), + 'ts' => $record['datetime']->getTimestamp(), 'footer' => $this->username, 'footer_icon' => $this->userIcon, - ]; + ); if ($this->useShortAttachment) { - $attachment['title'] = $recordData['level_name']; + $attachment['title'] = $record['level_name']; } else { $attachment['title'] = 'Message'; - $attachment['fields'][] = $this->generateAttachmentField('Level', $recordData['level_name']); + $attachment['fields'][] = $this->generateAttachmentField('Level', $record['level_name']); } if ($this->includeContextAndExtra) { - foreach (['extra', 'context'] as $key) { - if (!isset($recordData[$key]) || \count($recordData[$key]) === 0) { + foreach (array('extra', 'context') as $key) { + if (empty($record[$key])) { continue; } if ($this->useShortAttachment) { $attachment['fields'][] = $this->generateAttachmentField( - $key, - $recordData[$key] + (string) $key, + $record[$key] ); } else { // Add all extra fields as individual fields in attachment $attachment['fields'] = array_merge( $attachment['fields'], - $this->generateAttachmentFields($recordData[$key]) + $this->generateAttachmentFields($record[$key]) ); } } } - $dataArray['attachments'] = [$attachment]; + $dataArray['attachments'] = array($attachment); } else { $dataArray['text'] = $message; } - if ($this->userIcon !== null) { - if (false !== ($iconUrl = filter_var($this->userIcon, FILTER_VALIDATE_URL))) { - $dataArray['icon_url'] = $iconUrl; + if ($this->userIcon) { + if (filter_var($this->userIcon, FILTER_VALIDATE_URL)) { + $dataArray['icon_url'] = $this->userIcon; } else { $dataArray['icon_emoji'] = ":{$this->userIcon}:"; } @@ -189,14 +204,18 @@ class SlackRecord * Returns a Slack message attachment color associated with * provided level. */ - public function getAttachmentColor(Level $level): string + public function getAttachmentColor(int $level): string { - return match ($level) { - Level::Error, Level::Critical, Level::Alert, Level::Emergency => static::COLOR_DANGER, - Level::Warning => static::COLOR_WARNING, - Level::Info, Level::Notice => static::COLOR_GOOD, - Level::Debug => static::COLOR_DEFAULT - }; + switch (true) { + case $level >= Logger::ERROR: + return static::COLOR_DANGER; + case $level >= Logger::WARNING: + return static::COLOR_WARNING; + case $level >= Logger::INFO: + return static::COLOR_GOOD; + default: + return static::COLOR_DEFAULT; + } } /** @@ -206,13 +225,13 @@ class SlackRecord */ public function stringify(array $fields): string { - /** @var array $normalized */ - $normalized = $this->normalizerFormatter->normalizeValue($fields); + /** @var Record $fields */ + $normalized = $this->normalizerFormatter->format($fields); - $hasSecondDimension = \count(array_filter($normalized, 'is_array')) > 0; - $hasOnlyNonNumericKeys = \count(array_filter(array_keys($normalized), 'is_numeric')) === 0; + $hasSecondDimension = count(array_filter($normalized, 'is_array')); + $hasNonNumericKeys = !count(array_filter(array_keys($normalized), 'is_numeric')); - return $hasSecondDimension || $hasOnlyNonNumericKeys + return $hasSecondDimension || $hasNonNumericKeys ? Utils::jsonEncode($normalized, JSON_PRETTY_PRINT|Utils::DEFAULT_JSON_FLAGS) : Utils::jsonEncode($normalized, Utils::DEFAULT_JSON_FLAGS); } @@ -311,11 +330,11 @@ class SlackRecord ? sprintf('```%s```', substr($this->stringify($value), 0, 1990)) : $value; - return [ + return array( 'title' => ucfirst($title), 'value' => $value, 'short' => false, - ]; + ); } /** @@ -327,10 +346,10 @@ class SlackRecord */ private function generateAttachmentFields(array $data): array { - /** @var array $normalized */ - $normalized = $this->normalizerFormatter->normalizeValue($data); + /** @var Record $data */ + $normalized = $this->normalizerFormatter->format($data); - $fields = []; + $fields = array(); foreach ($normalized as $key => $value) { $fields[] = $this->generateAttachmentField((string) $key, $value); } @@ -341,14 +360,15 @@ class SlackRecord /** * Get a copy of record with fields excluded according to $this->excludeFields * + * @phpstan-param FormattedRecord $record + * * @return mixed[] */ - private function removeExcludedFields(LogRecord $record): array + private function removeExcludedFields(array $record): array { - $recordData = $record->toArray(); foreach ($this->excludeFields as $field) { $keys = explode('.', $field); - $node = &$recordData; + $node = &$record; $lastKey = end($keys); foreach ($keys as $key) { if (!isset($node[$key])) { @@ -362,6 +382,6 @@ class SlackRecord } } - return $recordData; + return $record; } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php index 321d8660..a648513e 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SlackHandler.php @@ -12,28 +12,31 @@ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; -use Monolog\Level; +use Monolog\Logger; use Monolog\Utils; use Monolog\Handler\Slack\SlackRecord; -use Monolog\LogRecord; /** * Sends notifications through Slack API * * @author Greg Kedzierski * @see https://api.slack.com/ + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler */ class SlackHandler extends SocketHandler { /** * Slack API token + * @var string */ - private string $token; + private $token; /** * Instance of the SlackRecord util class preparing data for Slack API. + * @var SlackRecord */ - private SlackRecord $slackRecord; + private $slackRecord; /** * @param string $token Slack API token @@ -52,11 +55,11 @@ class SlackHandler extends SocketHandler ?string $username = null, bool $useAttachment = true, ?string $iconEmoji = null, - $level = Level::Critical, + $level = Logger::CRITICAL, bool $bubble = true, bool $useShortAttachment = false, bool $includeContextAndExtra = false, - array $excludeFields = [], + array $excludeFields = array(), bool $persistent = false, float $timeout = 0.0, float $writingTimeout = 10.0, @@ -102,9 +105,9 @@ class SlackHandler extends SocketHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function generateDataStream(LogRecord $record): string + protected function generateDataStream(array $record): string { $content = $this->buildContent($record); @@ -113,8 +116,10 @@ class SlackHandler extends SocketHandler /** * Builds the body of API call + * + * @phpstan-param FormattedRecord $record */ - private function buildContent(LogRecord $record): string + private function buildContent(array $record): string { $dataArray = $this->prepareContentData($record); @@ -122,14 +127,15 @@ class SlackHandler extends SocketHandler } /** + * @phpstan-param FormattedRecord $record * @return string[] */ - protected function prepareContentData(LogRecord $record): array + protected function prepareContentData(array $record): array { $dataArray = $this->slackRecord->getSlackData($record); $dataArray['token'] = $this->token; - if (isset($dataArray['attachments']) && is_array($dataArray['attachments']) && \count($dataArray['attachments']) > 0) { + if (!empty($dataArray['attachments'])) { $dataArray['attachments'] = Utils::jsonEncode($dataArray['attachments']); } @@ -151,9 +157,9 @@ class SlackHandler extends SocketHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { parent::write($record); $this->finalizeWrite(); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php index 14ed6b1f..8ae3c788 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SlackWebhookHandler.php @@ -12,10 +12,9 @@ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; -use Monolog\Level; +use Monolog\Logger; use Monolog\Utils; use Monolog\Handler\Slack\SlackRecord; -use Monolog\LogRecord; /** * Sends notifications through Slack Webhooks @@ -27,13 +26,15 @@ class SlackWebhookHandler extends AbstractProcessingHandler { /** * Slack Webhook token + * @var string */ - private string $webhookUrl; + private $webhookUrl; /** * Instance of the SlackRecord util class preparing data for Slack API. + * @var SlackRecord */ - private SlackRecord $slackRecord; + private $slackRecord; /** * @param string $webhookUrl Slack Webhook URL @@ -53,9 +54,9 @@ class SlackWebhookHandler extends AbstractProcessingHandler ?string $iconEmoji = null, bool $useShortAttachment = false, bool $includeContextAndExtra = false, - $level = Level::Critical, + $level = Logger::CRITICAL, bool $bubble = true, - array $excludeFields = [] + array $excludeFields = array() ) { if (!extension_loaded('curl')) { throw new MissingExtensionException('The curl extension is needed to use the SlackWebhookHandler'); @@ -87,21 +88,21 @@ class SlackWebhookHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { $postData = $this->slackRecord->getSlackData($record); $postString = Utils::jsonEncode($postData); $ch = curl_init(); - $options = [ + $options = array( CURLOPT_URL => $this->webhookUrl, CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, - CURLOPT_HTTPHEADER => ['Content-type: application/json'], + CURLOPT_HTTPHEADER => array('Content-type: application/json'), CURLOPT_POSTFIELDS => $postString, - ]; + ); if (defined('CURLOPT_SAFE_UPLOAD')) { $options[CURLOPT_SAFE_UPLOAD] = true; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php index c5f70888..21701afa 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SocketHandler.php @@ -11,29 +11,41 @@ namespace Monolog\Handler; -use Monolog\Level; -use Monolog\LogRecord; +use Monolog\Logger; /** * Stores to any socket - uses fsockopen() or pfsockopen(). * * @author Pablo de Leon Belloc * @see http://php.net/manual/en/function.fsockopen.php + * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler */ class SocketHandler extends AbstractProcessingHandler { - private string $connectionString; - private float $connectionTimeout; + /** @var string */ + private $connectionString; + /** @var float */ + private $connectionTimeout; /** @var resource|null */ private $resource; - private float $timeout; - private float $writingTimeout; - private int|null $lastSentBytes = null; - private int|null $chunkSize; - private bool $persistent; - private int|null $errno = null; - private string|null $errstr = null; - private float|null $lastWritingAt = null; + /** @var float */ + private $timeout; + /** @var float */ + private $writingTimeout; + /** @var ?int */ + private $lastSentBytes = null; + /** @var ?int */ + private $chunkSize; + /** @var bool */ + private $persistent; + /** @var ?int */ + private $errno = null; + /** @var ?string */ + private $errstr = null; + /** @var ?float */ + private $lastWritingAt = null; /** * @param string $connectionString Socket connection string @@ -44,11 +56,11 @@ class SocketHandler extends AbstractProcessingHandler * established * @param int|null $chunkSize Sets the chunk size. Only has effect during connection in the writing cycle * - * @throws \InvalidArgumentException If an invalid timeout value (less than 0) is passed. + * @throws \InvalidArgumentException If an invalid timeout value (less than 0) is passed. */ public function __construct( string $connectionString, - $level = Level::Debug, + $level = Logger::DEBUG, bool $bubble = true, bool $persistent = false, float $timeout = 0.0, @@ -75,12 +87,12 @@ class SocketHandler extends AbstractProcessingHandler /** * Connect (if necessary) and write to the socket * - * @inheritDoc + * {@inheritDoc} * * @throws \UnexpectedValueException * @throws \RuntimeException */ - protected function write(LogRecord $record): void + protected function write(array $record): void { $this->connectIfNotConnected(); $data = $this->generateDataStream($record); @@ -201,6 +213,8 @@ class SocketHandler extends AbstractProcessingHandler /** * Get current local writing timeout + * + * @return float */ public function getWritingTimeout(): float { @@ -250,8 +264,10 @@ class SocketHandler extends AbstractProcessingHandler * Wrapper to allow mocking * * @see http://php.net/manual/en/function.stream-set-timeout.php + * + * @return bool */ - protected function streamSetTimeout(): bool + protected function streamSetTimeout() { $seconds = floor($this->timeout); $microseconds = round(($this->timeout - $seconds) * 1e6); @@ -268,9 +284,9 @@ class SocketHandler extends AbstractProcessingHandler * * @see http://php.net/manual/en/function.stream-set-chunk-size.php * - * @return int|false + * @return int|bool */ - protected function streamSetChunkSize(): int|bool + protected function streamSetChunkSize() { if (!is_resource($this->resource)) { throw new \LogicException('streamSetChunkSize called but $this->resource is not a resource'); @@ -286,9 +302,9 @@ class SocketHandler extends AbstractProcessingHandler /** * Wrapper to allow mocking * - * @return int|false + * @return int|bool */ - protected function fwrite(string $data): int|bool + protected function fwrite(string $data) { if (!is_resource($this->resource)) { throw new \LogicException('fwrite called but $this->resource is not a resource'); @@ -302,7 +318,7 @@ class SocketHandler extends AbstractProcessingHandler * * @return mixed[]|bool */ - protected function streamGetMetadata(): array|bool + protected function streamGetMetadata() { if (!is_resource($this->resource)) { throw new \LogicException('streamGetMetadata called but $this->resource is not a resource'); @@ -326,9 +342,12 @@ class SocketHandler extends AbstractProcessingHandler $this->connect(); } - protected function generateDataStream(LogRecord $record): string + /** + * @phpstan-param FormattedRecord $record + */ + protected function generateDataStream(array $record): string { - return (string) $record->formatted; + return (string) $record['formatted']; } /** @@ -368,7 +387,7 @@ class SocketHandler extends AbstractProcessingHandler private function setStreamChunkSize(): void { - if (null !== $this->chunkSize && false === $this->streamSetChunkSize()) { + if ($this->chunkSize && !$this->streamSetChunkSize()) { throw new \UnexpectedValueException("Failed setting chunk size with stream_set_chunk_size()"); } } @@ -389,7 +408,7 @@ class SocketHandler extends AbstractProcessingHandler } $sent += $chunk; $socketInfo = $this->streamGetMetadata(); - if (is_array($socketInfo) && (bool) $socketInfo['timed_out']) { + if (is_array($socketInfo) && $socketInfo['timed_out']) { throw new \RuntimeException("Write timed-out"); } @@ -418,7 +437,7 @@ class SocketHandler extends AbstractProcessingHandler usleep(100); } - if ((microtime(true) - (float) $this->lastWritingAt) >= $this->writingTimeout) { + if ((microtime(true) - $this->lastWritingAt) >= $this->writingTimeout) { $this->closeSocket(); return true; diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SqsHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SqsHandler.php index b4512a60..dcf282b4 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SqsHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SqsHandler.php @@ -12,9 +12,8 @@ namespace Monolog\Handler; use Aws\Sqs\SqsClient; -use Monolog\Level; +use Monolog\Logger; use Monolog\Utils; -use Monolog\LogRecord; /** * Writes to any sqs queue. @@ -28,10 +27,12 @@ class SqsHandler extends AbstractProcessingHandler /** 100 KB in bytes - head message size for new error log */ protected const HEAD_MESSAGE_SIZE = 102400; - private SqsClient $client; - private string $queueUrl; + /** @var SqsClient */ + private $client; + /** @var string */ + private $queueUrl; - public function __construct(SqsClient $sqsClient, string $queueUrl, int|string|Level $level = Level::Debug, bool $bubble = true) + public function __construct(SqsClient $sqsClient, string $queueUrl, $level = Logger::DEBUG, bool $bubble = true) { parent::__construct($level, $bubble); @@ -40,15 +41,15 @@ class SqsHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { - if (!isset($record->formatted) || 'string' !== gettype($record->formatted)) { + if (!isset($record['formatted']) || 'string' !== gettype($record['formatted'])) { throw new \InvalidArgumentException('SqsHandler accepts only formatted records as a string' . Utils::getRecordMessageForException($record)); } - $messageBody = $record->formatted; + $messageBody = $record['formatted']; if (strlen($messageBody) >= static::MAX_MESSAGE_SIZE) { $messageBody = Utils::substr($messageBody, 0, static::HEAD_MESSAGE_SIZE); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php index 027a7217..82c048e1 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php @@ -11,9 +11,8 @@ namespace Monolog\Handler; -use Monolog\Level; +use Monolog\Logger; use Monolog\Utils; -use Monolog\LogRecord; /** * Stores to any stream resource @@ -21,21 +20,29 @@ use Monolog\LogRecord; * Can be used to store into php://stderr, remote and local files, etc. * * @author Jordi Boggiano + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler */ class StreamHandler extends AbstractProcessingHandler { + /** @const int */ protected const MAX_CHUNK_SIZE = 2147483647; - /** 10MB */ + /** @const int 10MB */ protected const DEFAULT_CHUNK_SIZE = 10 * 1024 * 1024; - protected int $streamChunkSize; + /** @var int */ + protected $streamChunkSize; /** @var resource|null */ protected $stream; - protected string|null $url = null; - private string|null $errorMessage = null; - protected int|null $filePermission; - protected bool $useLocking; + /** @var ?string */ + protected $url = null; + /** @var ?string */ + private $errorMessage = null; + /** @var ?int */ + protected $filePermission; + /** @var bool */ + protected $useLocking; /** @var true|null */ - private bool|null $dirCreated = null; + private $dirCreated = null; /** * @param resource|string $stream If a missing path can't be created, an UnexpectedValueException will be thrown on first write @@ -44,7 +51,7 @@ class StreamHandler extends AbstractProcessingHandler * * @throws \InvalidArgumentException If stream is not a resource or string */ - public function __construct($stream, int|string|Level $level = Level::Debug, bool $bubble = true, ?int $filePermission = null, bool $useLocking = false) + public function __construct($stream, $level = Logger::DEBUG, bool $bubble = true, ?int $filePermission = null, bool $useLocking = false) { parent::__construct($level, $bubble); @@ -76,11 +83,11 @@ class StreamHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ public function close(): void { - if (null !== $this->url && is_resource($this->stream)) { + if ($this->url && is_resource($this->stream)) { fclose($this->stream); } $this->stream = null; @@ -99,21 +106,26 @@ class StreamHandler extends AbstractProcessingHandler /** * Return the stream URL if it was configured with a URL and not an active resource + * + * @return string|null */ public function getUrl(): ?string { return $this->url; } + /** + * @return int + */ public function getStreamChunkSize(): int { return $this->streamChunkSize; } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { if (!is_resource($this->stream)) { $url = $this->url; @@ -123,11 +135,14 @@ class StreamHandler extends AbstractProcessingHandler $this->createDir($url); $this->errorMessage = null; set_error_handler([$this, 'customErrorHandler']); - $stream = fopen($url, 'a'); - if ($this->filePermission !== null) { - @chmod($url, $this->filePermission); + try { + $stream = fopen($url, 'a'); + if ($this->filePermission !== null) { + @chmod($url, $this->filePermission); + } + } finally { + restore_error_handler(); } - restore_error_handler(); if (!is_resource($stream)) { $this->stream = null; @@ -138,6 +153,10 @@ class StreamHandler extends AbstractProcessingHandler } $stream = $this->stream; + if (!is_resource($stream)) { + throw new \LogicException('No stream was opened yet' . Utils::getRecordMessageForException($record)); + } + if ($this->useLocking) { // ignoring errors here, there's not much we can do about them flock($stream, LOCK_EX); @@ -153,10 +172,13 @@ class StreamHandler extends AbstractProcessingHandler /** * Write to stream * @param resource $stream + * @param array $record + * + * @phpstan-param FormattedRecord $record */ - protected function streamWrite($stream, LogRecord $record): void + protected function streamWrite($stream, array $record): void { - fwrite($stream, (string) $record->formatted); + fwrite($stream, (string) $record['formatted']); } private function customErrorHandler(int $code, string $msg): bool @@ -183,7 +205,7 @@ class StreamHandler extends AbstractProcessingHandler private function createDir(string $url): void { // Do not try to create dir if it has already been tried. - if (true === $this->dirCreated) { + if ($this->dirCreated) { return; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php new file mode 100644 index 00000000..fae92514 --- /dev/null +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SwiftMailerHandler.php @@ -0,0 +1,115 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Monolog\Handler; + +use Monolog\Logger; +use Monolog\Utils; +use Monolog\Formatter\FormatterInterface; +use Monolog\Formatter\LineFormatter; +use Swift_Message; +use Swift; + +/** + * SwiftMailerHandler uses Swift_Mailer to send the emails + * + * @author Gyula Sallai + * + * @phpstan-import-type Record from \Monolog\Logger + * @deprecated Since Monolog 2.6. Use SymfonyMailerHandler instead. + */ +class SwiftMailerHandler extends MailHandler +{ + /** @var \Swift_Mailer */ + protected $mailer; + /** @var Swift_Message|callable(string, Record[]): Swift_Message */ + private $messageTemplate; + + /** + * @psalm-param Swift_Message|callable(string, Record[]): Swift_Message $message + * + * @param \Swift_Mailer $mailer The mailer to use + * @param callable|Swift_Message $message An example message for real messages, only the body will be replaced + */ + public function __construct(\Swift_Mailer $mailer, $message, $level = Logger::ERROR, bool $bubble = true) + { + parent::__construct($level, $bubble); + + @trigger_error('The SwiftMailerHandler is deprecated since Monolog 2.6. Use SymfonyMailerHandler instead.', E_USER_DEPRECATED); + + $this->mailer = $mailer; + $this->messageTemplate = $message; + } + + /** + * {@inheritDoc} + */ + protected function send(string $content, array $records): void + { + $this->mailer->send($this->buildMessage($content, $records)); + } + + /** + * Gets the formatter for the Swift_Message subject. + * + * @param string|null $format The format of the subject + */ + protected function getSubjectFormatter(?string $format): FormatterInterface + { + return new LineFormatter($format); + } + + /** + * Creates instance of Swift_Message to be sent + * + * @param string $content formatted email body to be sent + * @param array $records Log records that formed the content + * @return Swift_Message + * + * @phpstan-param Record[] $records + */ + protected function buildMessage(string $content, array $records): Swift_Message + { + $message = null; + if ($this->messageTemplate instanceof Swift_Message) { + $message = clone $this->messageTemplate; + $message->generateId(); + } elseif (is_callable($this->messageTemplate)) { + $message = ($this->messageTemplate)($content, $records); + } + + if (!$message instanceof Swift_Message) { + $record = reset($records); + throw new \InvalidArgumentException('Could not resolve message as instance of Swift_Message or a callable returning it' . ($record ? Utils::getRecordMessageForException($record) : '')); + } + + if ($records) { + $subjectFormatter = $this->getSubjectFormatter($message->getSubject()); + $message->setSubject($subjectFormatter->format($this->getHighestRecord($records))); + } + + $mime = 'text/plain'; + if ($this->isHtmlBody($content)) { + $mime = 'text/html'; + } + + $message->setBody($content, $mime); + /** @phpstan-ignore-next-line */ + if (version_compare(Swift::VERSION, '6.0.0', '>=')) { + $message->setDate(new \DateTimeImmutable()); + } else { + /** @phpstan-ignore-next-line */ + $message->setDate(time()); + } + + return $message; + } +} diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SymfonyMailerHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SymfonyMailerHandler.php index 842b6577..130e6f1f 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SymfonyMailerHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SymfonyMailerHandler.php @@ -11,10 +11,7 @@ namespace Monolog\Handler; -use Closure; -use Monolog\Level; use Monolog\Logger; -use Monolog\LogRecord; use Monolog\Utils; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\LineFormatter; @@ -26,20 +23,23 @@ use Symfony\Component\Mime\Email; * SymfonyMailerHandler uses Symfony's Mailer component to send the emails * * @author Jordi Boggiano + * + * @phpstan-import-type Record from \Monolog\Logger */ class SymfonyMailerHandler extends MailHandler { - protected MailerInterface|TransportInterface $mailer; - /** @var Email|Closure(string, LogRecord[]): Email */ - private Email|Closure $emailTemplate; + /** @var MailerInterface|TransportInterface */ + protected $mailer; + /** @var Email|callable(string, Record[]): Email */ + private $emailTemplate; /** - * @phpstan-param Email|Closure(string, LogRecord[]): Email $email + * @psalm-param Email|callable(string, Record[]): Email $email * * @param MailerInterface|TransportInterface $mailer The mailer to use - * @param Closure|Email $email An email template, the subject/body will be replaced + * @param callable|Email $email An email template, the subject/body will be replaced */ - public function __construct($mailer, Email|Closure $email, int|string|Level $level = Level::Error, bool $bubble = true) + public function __construct($mailer, $email, $level = Logger::ERROR, bool $bubble = true) { parent::__construct($level, $bubble); @@ -68,8 +68,10 @@ class SymfonyMailerHandler extends MailHandler /** * Creates instance of Email to be sent * - * @param string $content formatted email body to be sent - * @param LogRecord[] $records Log records that formed the content + * @param string $content formatted email body to be sent + * @param array $records Log records that formed the content + * + * @phpstan-param Record[] $records */ protected function buildMessage(string $content, array $records): Email { @@ -82,10 +84,10 @@ class SymfonyMailerHandler extends MailHandler if (!$message instanceof Email) { $record = reset($records); - throw new \InvalidArgumentException('Could not resolve message as instance of Email or a callable returning it' . ($record instanceof LogRecord ? Utils::getRecordMessageForException($record) : '')); + throw new \InvalidArgumentException('Could not resolve message as instance of Email or a callable returning it' . ($record ? Utils::getRecordMessageForException($record) : '')); } - if (\count($records) > 0) { + if ($records) { $subjectFormatter = $this->getSubjectFormatter($message->getSubject()); $message->subject($subjectFormatter->format($this->getHighestRecord($records))); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php index 0816a011..1d543b7e 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogHandler.php @@ -11,9 +11,8 @@ namespace Monolog\Handler; -use Monolog\Level; +use Monolog\Logger; use Monolog\Utils; -use Monolog\LogRecord; /** * Logs to syslog service. @@ -30,14 +29,17 @@ use Monolog\LogRecord; */ class SyslogHandler extends AbstractSyslogHandler { - protected string $ident; - protected int $logopts; + /** @var string */ + protected $ident; + /** @var int */ + protected $logopts; /** + * @param string $ident * @param string|int $facility Either one of the names of the keys in $this->facilities, or a LOG_* facility constant * @param int $logopts Option flags for the openlog() call, defaults to LOG_PID */ - public function __construct(string $ident, string|int $facility = LOG_USER, int|string|Level $level = Level::Debug, bool $bubble = true, int $logopts = LOG_PID) + public function __construct(string $ident, $facility = LOG_USER, $level = Logger::DEBUG, bool $bubble = true, int $logopts = LOG_PID) { parent::__construct($facility, $level, $bubble); @@ -46,7 +48,7 @@ class SyslogHandler extends AbstractSyslogHandler } /** - * @inheritDoc + * {@inheritDoc} */ public function close(): void { @@ -54,13 +56,13 @@ class SyslogHandler extends AbstractSyslogHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { if (!openlog($this->ident, $this->logopts, $this->facility)) { throw new \LogicException('Can\'t open syslog for ident "'.$this->ident.'" and facility "'.$this->facility.'"' . Utils::getRecordMessageForException($record)); } - syslog($this->toSyslogPriority($record->level), (string) $record->formatted); + syslog($this->logLevels[$record['level']], (string) $record['formatted']); } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php index 6a483345..dbd8ef69 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdp/UdpSocket.php @@ -18,9 +18,12 @@ class UdpSocket { protected const DATAGRAM_MAX_LENGTH = 65023; - protected string $ip; - protected int $port; - protected ?Socket $socket = null; + /** @var string */ + protected $ip; + /** @var int */ + protected $port; + /** @var resource|Socket|null */ + protected $socket = null; public function __construct(string $ip, int $port = 514) { @@ -28,20 +31,28 @@ class UdpSocket $this->port = $port; } - public function write(string $line, string $header = ""): void + /** + * @param string $line + * @param string $header + * @return void + */ + public function write($line, $header = "") { $this->send($this->assembleMessage($line, $header)); } public function close(): void { - if ($this->socket instanceof Socket) { + if (is_resource($this->socket) || $this->socket instanceof Socket) { socket_close($this->socket); $this->socket = null; } } - protected function getSocket(): Socket + /** + * @return resource|Socket + */ + protected function getSocket() { if (null !== $this->socket) { return $this->socket; @@ -55,12 +66,12 @@ class UdpSocket $protocol = IPPROTO_IP; } - $socket = socket_create($domain, SOCK_DGRAM, $protocol); - if ($socket instanceof Socket) { - return $this->socket = $socket; + $this->socket = socket_create($domain, SOCK_DGRAM, $protocol) ?: null; + if (null === $this->socket) { + throw new \RuntimeException('The UdpSocket to '.$this->ip.':'.$this->port.' could not be opened via socket_create'); } - throw new \RuntimeException('The UdpSocket to '.$this->ip.':'.$this->port.' could not be opened via socket_create'); + return $this->socket; } protected function send(string $chunk): void diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php index abb8be9b..deaa19f8 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php @@ -12,9 +12,8 @@ namespace Monolog\Handler; use DateTimeInterface; +use Monolog\Logger; use Monolog\Handler\SyslogUdp\UdpSocket; -use Monolog\Level; -use Monolog\LogRecord; use Monolog\Utils; /** @@ -30,29 +29,31 @@ class SyslogUdpHandler extends AbstractSyslogHandler const RFC5424e = 2; /** @var array */ - private array $dateFormats = [ + private $dateFormats = array( self::RFC3164 => 'M d H:i:s', self::RFC5424 => \DateTime::RFC3339, self::RFC5424e => \DateTime::RFC3339_EXTENDED, - ]; + ); - protected UdpSocket $socket; - protected string $ident; + /** @var UdpSocket */ + protected $socket; + /** @var string */ + protected $ident; /** @var self::RFC* */ - protected int $rfc; + protected $rfc; /** - * @param string $host Either IP/hostname or a path to a unix socket (port must be 0 then) - * @param int $port Port number, or 0 if $host is a unix socket - * @param string|int $facility Either one of the names of the keys in $this->facilities, or a LOG_* facility constant - * @param bool $bubble Whether the messages that are handled can bubble up the stack or not - * @param string $ident Program name or tag for each log message. - * @param int $rfc RFC to format the message for. + * @param string $host Either IP/hostname or a path to a unix socket (port must be 0 then) + * @param int $port Port number, or 0 if $host is a unix socket + * @param string|int $facility Either one of the names of the keys in $this->facilities, or a LOG_* facility constant + * @param bool $bubble Whether the messages that are handled can bubble up the stack or not + * @param string $ident Program name or tag for each log message. + * @param int $rfc RFC to format the message for. * @throws MissingExtensionException * * @phpstan-param self::RFC* $rfc */ - public function __construct(string $host, int $port = 514, string|int $facility = LOG_USER, int|string|Level $level = Level::Debug, bool $bubble = true, string $ident = 'php', int $rfc = self::RFC5424) + public function __construct(string $host, int $port = 514, $facility = LOG_USER, $level = Logger::DEBUG, bool $bubble = true, string $ident = 'php', int $rfc = self::RFC5424) { if (!extension_loaded('sockets')) { throw new MissingExtensionException('The sockets extension is required to use the SyslogUdpHandler'); @@ -66,11 +67,11 @@ class SyslogUdpHandler extends AbstractSyslogHandler $this->socket = new UdpSocket($host, $port); } - protected function write(LogRecord $record): void + protected function write(array $record): void { - $lines = $this->splitMessageIntoLines($record->formatted); + $lines = $this->splitMessageIntoLines($record['formatted']); - $header = $this->makeCommonSyslogHeader($this->toSyslogPriority($record->level), $record->datetime); + $header = $this->makeCommonSyslogHeader($this->logLevels[$record['level']], $record['datetime']); foreach ($lines as $line) { $this->socket->write($line, $header); @@ -95,7 +96,6 @@ class SyslogUdpHandler extends AbstractSyslogHandler $lines = preg_split('/$\R?^/m', (string) $message, -1, PREG_SPLIT_NO_EMPTY); if (false === $lines) { $pcreErrorCode = preg_last_error(); - throw new \RuntimeException('Could not preg_split: ' . $pcreErrorCode . ' / ' . Utils::pcreLastErrorMessage($pcreErrorCode)); } @@ -109,13 +109,11 @@ class SyslogUdpHandler extends AbstractSyslogHandler { $priority = $severity + $this->facility; - $pid = getmypid(); - if (false === $pid) { + if (!$pid = getmypid()) { $pid = '-'; } - $hostname = gethostname(); - if (false === $hostname) { + if (!$hostname = gethostname()) { $hostname = '-'; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/TelegramBotHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/TelegramBotHandler.php index 2e1be9f6..8912eba5 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/TelegramBotHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/TelegramBotHandler.php @@ -12,9 +12,8 @@ namespace Monolog\Handler; use RuntimeException; -use Monolog\Level; +use Monolog\Logger; use Monolog\Utils; -use Monolog\LogRecord; /** * Handler send logs to Telegram using Telegram Bot API. @@ -29,6 +28,8 @@ use Monolog\LogRecord; * @link https://core.telegram.org/bots/api * * @author Mazur Alexandr + * + * @phpstan-import-type Record from \Monolog\Logger */ class TelegramBotHandler extends AbstractProcessingHandler { @@ -51,61 +52,69 @@ class TelegramBotHandler extends AbstractProcessingHandler /** * Telegram bot access token provided by BotFather. * Create telegram bot with https://telegram.me/BotFather and use access token from it. + * @var string */ - private string $apiKey; + private $apiKey; /** * Telegram channel name. * Since to start with '@' symbol as prefix. + * @var string */ - private string $channel; + private $channel; /** * The kind of formatting that is used for the message. * See available options at https://core.telegram.org/bots/api#formatting-options * or in AVAILABLE_PARSE_MODES + * @var ?string */ - private string|null $parseMode; + private $parseMode; /** * Disables link previews for links in the message. + * @var ?bool */ - private bool|null $disableWebPagePreview; + private $disableWebPagePreview; /** * Sends the message silently. Users will receive a notification with no sound. + * @var ?bool */ - private bool|null $disableNotification; + private $disableNotification; /** * True - split a message longer than MAX_MESSAGE_LENGTH into parts and send in multiple messages. * False - truncates a message that is too long. + * @var bool */ - private bool $splitLongMessages; + private $splitLongMessages; /** * Adds 1-second delay between sending a split message (according to Telegram API to avoid 429 Too Many Requests). + * @var bool */ - private bool $delayBetweenMessages; + private $delayBetweenMessages; /** - * @param string $apiKey Telegram bot access token provided by BotFather - * @param string $channel Telegram channel name - * @param bool $splitLongMessages Split a message longer than MAX_MESSAGE_LENGTH into parts and send in multiple messages - * @param bool $delayBetweenMessages Adds delay between sending a split message according to Telegram API + * @param string $apiKey Telegram bot access token provided by BotFather + * @param string $channel Telegram channel name + * @param bool $splitLongMessages Split a message longer than MAX_MESSAGE_LENGTH into parts and send in multiple messages + * @param bool $delayBetweenMessages Adds delay between sending a split message according to Telegram API * @throws MissingExtensionException */ public function __construct( string $apiKey, string $channel, - $level = Level::Debug, + $level = Logger::DEBUG, bool $bubble = true, string $parseMode = null, bool $disableWebPagePreview = null, bool $disableNotification = null, bool $splitLongMessages = false, bool $delayBetweenMessages = false - ) { + ) + { if (!extension_loaded('curl')) { throw new MissingExtensionException('The curl extension is needed to use the TelegramBotHandler'); } @@ -123,7 +132,7 @@ class TelegramBotHandler extends AbstractProcessingHandler public function setParseMode(string $parseMode = null): self { - if ($parseMode !== null && !in_array($parseMode, self::AVAILABLE_PARSE_MODES, true)) { + if ($parseMode !== null && !in_array($parseMode, self::AVAILABLE_PARSE_MODES)) { throw new \InvalidArgumentException('Unknown parseMode, use one of these: ' . implode(', ', self::AVAILABLE_PARSE_MODES) . '.'); } @@ -149,6 +158,7 @@ class TelegramBotHandler extends AbstractProcessingHandler /** * True - split a message longer than MAX_MESSAGE_LENGTH into parts and send in multiple messages. * False - truncates a message that is too long. + * @param bool $splitLongMessages * @return $this */ public function splitLongMessages(bool $splitLongMessages = false): self @@ -160,6 +170,7 @@ class TelegramBotHandler extends AbstractProcessingHandler /** * Adds 1-second delay between sending a split message (according to Telegram API to avoid 429 Too Many Requests). + * @param bool $delayBetweenMessages * @return $this */ public function delayBetweenMessages(bool $delayBetweenMessages = false): self @@ -170,10 +181,11 @@ class TelegramBotHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ public function handleBatch(array $records): void { + /** @var Record[] $messages */ $messages = []; foreach ($records as $record) { @@ -181,28 +193,30 @@ class TelegramBotHandler extends AbstractProcessingHandler continue; } - if (\count($this->processors) > 0) { + if ($this->processors) { + /** @var Record $record */ $record = $this->processRecord($record); } $messages[] = $record; } - if (\count($messages) > 0) { - $this->send((string) $this->getFormatter()->formatBatch($messages)); + if (!empty($messages)) { + $this->send((string)$this->getFormatter()->formatBatch($messages)); } } /** * @inheritDoc */ - protected function write(LogRecord $record): void + protected function write(array $record): void { - $this->send($record->formatted); + $this->send($record['formatted']); } /** * Send request to @link https://api.telegram.org/bot on SendMessage action. + * @param string $message */ protected function send(string $message): void { @@ -245,6 +259,7 @@ class TelegramBotHandler extends AbstractProcessingHandler /** * Handle a message that is too long: truncates or splits into several + * @param string $message * @return string[] */ private function handleMessageLength(string $message): array diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php index 1884f83f..0986da27 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/TestHandler.php @@ -11,10 +11,8 @@ namespace Monolog\Handler; -use Monolog\Level; use Monolog\Logger; use Psr\Log\LogLevel; -use Monolog\LogRecord; /** * Used for testing purposes. @@ -67,67 +65,85 @@ use Monolog\LogRecord; * @method bool hasNoticeThatPasses($message) * @method bool hasInfoThatPasses($message) * @method bool hasDebugThatPasses($message) + * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger */ class TestHandler extends AbstractProcessingHandler { - /** @var LogRecord[] */ - protected array $records = []; - /** @phpstan-var array, LogRecord[]> */ - protected array $recordsByLevel = []; - private bool $skipReset = false; + /** @var Record[] */ + protected $records = []; + /** @var array */ + protected $recordsByLevel = []; + /** @var bool */ + private $skipReset = false; /** - * @return array + * @return array + * + * @phpstan-return Record[] */ - public function getRecords(): array + public function getRecords() { return $this->records; } - public function clear(): void + /** + * @return void + */ + public function clear() { $this->records = []; $this->recordsByLevel = []; } - public function reset(): void + /** + * @return void + */ + public function reset() { if (!$this->skipReset) { $this->clear(); } } - public function setSkipReset(bool $skipReset): void + /** + * @return void + */ + public function setSkipReset(bool $skipReset) { $this->skipReset = $skipReset; } /** - * @param int|string|Level|LogLevel::* $level Logging level value or name + * @param string|int $level Logging level value or name * - * @phpstan-param value-of|value-of|Level|LogLevel::* $level + * @phpstan-param Level|LevelName|LogLevel::* $level */ - public function hasRecords(int|string|Level $level): bool + public function hasRecords($level): bool { - return isset($this->recordsByLevel[Logger::toMonologLevel($level)->value]); + return isset($this->recordsByLevel[Logger::toMonologLevel($level)]); } /** - * @param string|array $recordAssertions Either a message string or an array containing message and optionally context keys that will be checked against all records + * @param string|array $record Either a message string or an array containing message and optionally context keys that will be checked against all records + * @param string|int $level Logging level value or name * - * @phpstan-param array{message: string, context?: mixed[]}|string $recordAssertions + * @phpstan-param array{message: string, context?: mixed[]}|string $record + * @phpstan-param Level|LevelName|LogLevel::* $level */ - public function hasRecord(string|array $recordAssertions, Level $level): bool + public function hasRecord($record, $level): bool { - if (is_string($recordAssertions)) { - $recordAssertions = ['message' => $recordAssertions]; + if (is_string($record)) { + $record = array('message' => $record); } - return $this->hasRecordThatPasses(function (LogRecord $rec) use ($recordAssertions) { - if ($rec->message !== $recordAssertions['message']) { + return $this->hasRecordThatPasses(function ($rec) use ($record) { + if ($rec['message'] !== $record['message']) { return false; } - if (isset($recordAssertions['context']) && $rec->context !== $recordAssertions['context']) { + if (isset($record['context']) && $rec['context'] !== $record['context']) { return false; } @@ -135,29 +151,47 @@ class TestHandler extends AbstractProcessingHandler }, $level); } - public function hasRecordThatContains(string $message, Level $level): bool + /** + * @param string|int $level Logging level value or name + * + * @phpstan-param Level|LevelName|LogLevel::* $level + */ + public function hasRecordThatContains(string $message, $level): bool { - return $this->hasRecordThatPasses(fn (LogRecord $rec) => str_contains($rec->message, $message), $level); - } - - public function hasRecordThatMatches(string $regex, Level $level): bool - { - return $this->hasRecordThatPasses(fn (LogRecord $rec) => preg_match($regex, $rec->message) > 0, $level); + return $this->hasRecordThatPasses(function ($rec) use ($message) { + return strpos($rec['message'], $message) !== false; + }, $level); } /** - * @phpstan-param callable(LogRecord, int): mixed $predicate + * @param string|int $level Logging level value or name + * + * @phpstan-param Level|LevelName|LogLevel::* $level */ - public function hasRecordThatPasses(callable $predicate, Level $level): bool + public function hasRecordThatMatches(string $regex, $level): bool + { + return $this->hasRecordThatPasses(function (array $rec) use ($regex): bool { + return preg_match($regex, $rec['message']) > 0; + }, $level); + } + + /** + * @param string|int $level Logging level value or name + * @return bool + * + * @psalm-param callable(Record, int): mixed $predicate + * @phpstan-param Level|LevelName|LogLevel::* $level + */ + public function hasRecordThatPasses(callable $predicate, $level) { $level = Logger::toMonologLevel($level); - if (!isset($this->recordsByLevel[$level->value])) { + if (!isset($this->recordsByLevel[$level])) { return false; } - foreach ($this->recordsByLevel[$level->value] as $i => $rec) { - if ((bool) $predicate($rec, $i)) { + foreach ($this->recordsByLevel[$level] as $i => $rec) { + if ($predicate($rec, $i)) { return true; } } @@ -166,22 +200,24 @@ class TestHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ - protected function write(LogRecord $record): void + protected function write(array $record): void { - $this->recordsByLevel[$record->level->value][] = $record; + $this->recordsByLevel[$record['level']][] = $record; $this->records[] = $record; } /** - * @param mixed[] $args + * @param string $method + * @param mixed[] $args + * @return bool */ - public function __call(string $method, array $args): bool + public function __call($method, $args) { if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; - $level = constant(Level::class.'::' . $matches[2]); + $level = constant('Monolog\Logger::' . strtoupper($matches[2])); $callback = [$this, $genericMethod]; if (is_callable($callback)) { $args[] = $level; diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/WebRequestRecognizerTrait.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/WebRequestRecognizerTrait.php index 9c12c3d5..c8183528 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/WebRequestRecognizerTrait.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/WebRequestRecognizerTrait.php @@ -15,6 +15,7 @@ trait WebRequestRecognizerTrait { /** * Checks if PHP's serving a web request + * @return bool */ protected function isWebRequest(): bool { diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php index 2dbc5fe8..b6d3d3b1 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/WhatFailureGroupHandler.php @@ -11,30 +11,30 @@ namespace Monolog\Handler; -use Monolog\LogRecord; -use Throwable; - /** * Forwards records to multiple handlers suppressing failures of each handler * and continuing through to give every handler a chance to succeed. * * @author Craig D'Amelio + * + * @phpstan-import-type Record from \Monolog\Logger */ class WhatFailureGroupHandler extends GroupHandler { /** - * @inheritDoc + * {@inheritDoc} */ - public function handle(LogRecord $record): bool + public function handle(array $record): bool { - if (\count($this->processors) > 0) { + if ($this->processors) { + /** @var Record $record */ $record = $this->processRecord($record); } foreach ($this->handlers as $handler) { try { $handler->handle($record); - } catch (Throwable) { + } catch (\Throwable $e) { // What failure? } } @@ -43,22 +43,37 @@ class WhatFailureGroupHandler extends GroupHandler } /** - * @inheritDoc + * {@inheritDoc} */ public function handleBatch(array $records): void { - if (\count($this->processors) > 0) { - $processed = []; + if ($this->processors) { + $processed = array(); foreach ($records as $record) { $processed[] = $this->processRecord($record); } + /** @var Record[] $records */ $records = $processed; } foreach ($this->handlers as $handler) { try { $handler->handleBatch($records); - } catch (Throwable) { + } catch (\Throwable $e) { + // What failure? + } + } + } + + /** + * {@inheritDoc} + */ + public function close(): void + { + foreach ($this->handlers as $handler) { + try { + $handler->close(); + } catch (\Throwable $e) { // What failure? } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php index 1e71194b..ddd46d8c 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Handler/ZendMonitorHandler.php @@ -13,67 +13,70 @@ namespace Monolog\Handler; use Monolog\Formatter\FormatterInterface; use Monolog\Formatter\NormalizerFormatter; -use Monolog\Level; -use Monolog\LogRecord; +use Monolog\Logger; /** * Handler sending logs to Zend Monitor * * @author Christian Bergau * @author Jason Davis + * + * @phpstan-import-type FormattedRecord from AbstractProcessingHandler */ class ZendMonitorHandler extends AbstractProcessingHandler { + /** + * Monolog level / ZendMonitor Custom Event priority map + * + * @var array + */ + protected $levelMap = []; + /** * @throws MissingExtensionException */ - public function __construct(int|string|Level $level = Level::Debug, bool $bubble = true) + public function __construct($level = Logger::DEBUG, bool $bubble = true) { if (!function_exists('zend_monitor_custom_event')) { throw new MissingExtensionException( 'You must have Zend Server installed with Zend Monitor enabled in order to use this handler' ); } - + //zend monitor constants are not defined if zend monitor is not enabled. + $this->levelMap = [ + Logger::DEBUG => \ZEND_MONITOR_EVENT_SEVERITY_INFO, + Logger::INFO => \ZEND_MONITOR_EVENT_SEVERITY_INFO, + Logger::NOTICE => \ZEND_MONITOR_EVENT_SEVERITY_INFO, + Logger::WARNING => \ZEND_MONITOR_EVENT_SEVERITY_WARNING, + Logger::ERROR => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, + Logger::CRITICAL => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, + Logger::ALERT => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, + Logger::EMERGENCY => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, + ]; parent::__construct($level, $bubble); } /** - * Translates Monolog log levels to ZendMonitor levels. + * {@inheritDoc} */ - protected function toZendMonitorLevel(Level $level): int - { - return match ($level) { - Level::Debug => \ZEND_MONITOR_EVENT_SEVERITY_INFO, - Level::Info => \ZEND_MONITOR_EVENT_SEVERITY_INFO, - Level::Notice => \ZEND_MONITOR_EVENT_SEVERITY_INFO, - Level::Warning => \ZEND_MONITOR_EVENT_SEVERITY_WARNING, - Level::Error => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, - Level::Critical => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, - Level::Alert => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, - Level::Emergency => \ZEND_MONITOR_EVENT_SEVERITY_ERROR, - }; - } - - /** - * @inheritDoc - */ - protected function write(LogRecord $record): void + protected function write(array $record): void { $this->writeZendMonitorCustomEvent( - $record->level->getName(), - $record->message, - $record->formatted, - $this->toZendMonitorLevel($record->level) + Logger::getLevelName($record['level']), + $record['message'], + $record['formatted'], + $this->levelMap[$record['level']] ); } /** * Write to Zend Monitor Events - * @param string $type Text displayed in "Class Name (custom)" field - * @param string $message Text displayed in "Error String" - * @param array $formatted Displayed in Custom Variables tab - * @param int $severity Set the event severity level (-1,0,1) + * @param string $type Text displayed in "Class Name (custom)" field + * @param string $message Text displayed in "Error String" + * @param array $formatted Displayed in Custom Variables tab + * @param int $severity Set the event severity level (-1,0,1) + * + * @phpstan-param FormattedRecord $formatted */ protected function writeZendMonitorCustomEvent(string $type, string $message, array $formatted, int $severity): void { @@ -81,10 +84,18 @@ class ZendMonitorHandler extends AbstractProcessingHandler } /** - * @inheritDoc + * {@inheritDoc} */ public function getDefaultFormatter(): FormatterInterface { return new NormalizerFormatter(); } + + /** + * @return array + */ + public function getLevelMap(): array + { + return $this->levelMap; + } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Level.php b/monolog/vendor/monolog/monolog/src/Monolog/Level.php deleted file mode 100644 index ab04cf4d..00000000 --- a/monolog/vendor/monolog/monolog/src/Monolog/Level.php +++ /dev/null @@ -1,209 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Monolog; - -use Psr\Log\LogLevel; - -/** - * Represents the log levels - * - * Monolog supports the logging levels described by RFC 5424 {@see https://datatracker.ietf.org/doc/html/rfc5424} - * but due to BC the severity values used internally are not 0-7. - * - * To get the level name out of a Level there are three options: - * - * - Use ->getName() to get the standard Monolog name which is full uppercased (e.g. "DEBUG") - * - Use ->toPsrLogLevel() to get the standard PSR-3 name which is full lowercased (e.g. "debug") - * - Use ->toRFC5424Level() to get the standard RFC 5424 value (e.g. 7 for debug, 0 for emergency) - * - Use ->name to get the enum case's name which is capitalized (e.g. "Debug") - * - * To get the value for filtering, if the includes/isLowerThan/isHigherThan methods are - * not enough, you can use ->value to get the enum case's integer value. - */ -enum Level: int -{ - /** - * Detailed debug information - */ - case Debug = 100; - - /** - * Interesting events - * - * Examples: User logs in, SQL logs. - */ - case Info = 200; - - /** - * Uncommon events - */ - case Notice = 250; - - /** - * Exceptional occurrences that are not errors - * - * Examples: Use of deprecated APIs, poor use of an API, - * undesirable things that are not necessarily wrong. - */ - case Warning = 300; - - /** - * Runtime errors - */ - case Error = 400; - - /** - * Critical conditions - * - * Example: Application component unavailable, unexpected exception. - */ - case Critical = 500; - - /** - * Action must be taken immediately - * - * Example: Entire website down, database unavailable, etc. - * This should trigger the SMS alerts and wake you up. - */ - case Alert = 550; - - /** - * Urgent alert. - */ - case Emergency = 600; - - /** - * @param value-of|LogLevel::*|'Debug'|'Info'|'Notice'|'Warning'|'Error'|'Critical'|'Alert'|'Emergency' $name - * @return static - */ - public static function fromName(string $name): self - { - return match ($name) { - 'debug', 'Debug', 'DEBUG' => self::Debug, - 'info', 'Info', 'INFO' => self::Info, - 'notice', 'Notice', 'NOTICE' => self::Notice, - 'warning', 'Warning', 'WARNING' => self::Warning, - 'error', 'Error', 'ERROR' => self::Error, - 'critical', 'Critical', 'CRITICAL' => self::Critical, - 'alert', 'Alert', 'ALERT' => self::Alert, - 'emergency', 'Emergency', 'EMERGENCY' => self::Emergency, - }; - } - - /** - * @param value-of $value - * @return static - */ - public static function fromValue(int $value): self - { - return self::from($value); - } - - /** - * Returns true if the passed $level is higher or equal to $this - */ - public function includes(Level $level): bool - { - return $this->value <= $level->value; - } - - public function isHigherThan(Level $level): bool - { - return $this->value > $level->value; - } - - public function isLowerThan(Level $level): bool - { - return $this->value < $level->value; - } - - /** - * Returns the monolog standardized all-capitals name of the level - * - * Use this instead of $level->name which returns the enum case name (e.g. Debug vs DEBUG if you use getName()) - * - * @return value-of - */ - public function getName(): string - { - return match ($this) { - self::Debug => 'DEBUG', - self::Info => 'INFO', - self::Notice => 'NOTICE', - self::Warning => 'WARNING', - self::Error => 'ERROR', - self::Critical => 'CRITICAL', - self::Alert => 'ALERT', - self::Emergency => 'EMERGENCY', - }; - } - - /** - * Returns the PSR-3 level matching this instance - * - * @phpstan-return \Psr\Log\LogLevel::* - */ - public function toPsrLogLevel(): string - { - return match ($this) { - self::Debug => LogLevel::DEBUG, - self::Info => LogLevel::INFO, - self::Notice => LogLevel::NOTICE, - self::Warning => LogLevel::WARNING, - self::Error => LogLevel::ERROR, - self::Critical => LogLevel::CRITICAL, - self::Alert => LogLevel::ALERT, - self::Emergency => LogLevel::EMERGENCY, - }; - } - - /** - * Returns the RFC 5424 level matching this instance - * - * @phpstan-return int<0, 7> - */ - public function toRFC5424Level(): int - { - return match ($this) { - self::Debug => 7, - self::Info => 6, - self::Notice => 5, - self::Warning => 4, - self::Error => 3, - self::Critical => 2, - self::Alert => 1, - self::Emergency => 0, - }; - } - - public const VALUES = [ - 100, - 200, - 250, - 300, - 400, - 500, - 550, - 600, - ]; - - public const NAMES = [ - 'DEBUG', - 'INFO', - 'NOTICE', - 'WARNING', - 'ERROR', - 'CRITICAL', - 'ALERT', - 'EMERGENCY', - ]; -} diff --git a/monolog/vendor/monolog/monolog/src/Monolog/LogRecord.php b/monolog/vendor/monolog/monolog/src/Monolog/LogRecord.php index df758c58..702807d7 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/LogRecord.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/LogRecord.php @@ -14,111 +14,21 @@ namespace Monolog; use ArrayAccess; /** - * Monolog log record + * Monolog log record interface for forward compatibility with Monolog 3.0 + * + * This is just present in Monolog 2.4+ to allow interoperable code to be written against + * both versions by type-hinting arguments as `array|\Monolog\LogRecord $record` + * + * Do not rely on this interface for other purposes, and do not implement it. * * @author Jordi Boggiano - * @template-implements ArrayAccess<'message'|'level'|'context'|'level_name'|'channel'|'datetime'|'extra', int|string|\DateTimeImmutable|array> + * @template-extends \ArrayAccess<'message'|'level'|'context'|'level_name'|'channel'|'datetime'|'extra'|'formatted', mixed> + * @phpstan-import-type Record from Logger */ -class LogRecord implements ArrayAccess +interface LogRecord extends \ArrayAccess { - private const MODIFIABLE_FIELDS = [ - 'extra' => true, - 'formatted' => true, - ]; - - public function __construct( - public readonly \DateTimeImmutable $datetime, - public readonly string $channel, - public readonly Level $level, - public readonly string $message, - /** @var array */ - public readonly array $context = [], - /** @var array */ - public array $extra = [], - public mixed $formatted = null, - ) { - } - - public function offsetSet(mixed $offset, mixed $value): void - { - if ($offset === 'extra') { - if (!is_array($value)) { - throw new \InvalidArgumentException('extra must be an array'); - } - - $this->extra = $value; - - return; - } - - if ($offset === 'formatted') { - $this->formatted = $value; - - return; - } - - throw new \LogicException('Unsupported operation: setting '.$offset); - } - - public function offsetExists(mixed $offset): bool - { - if ($offset === 'level_name') { - return true; - } - - return isset($this->{$offset}); - } - - public function offsetUnset(mixed $offset): void - { - throw new \LogicException('Unsupported operation'); - } - - public function &offsetGet(mixed $offset): mixed - { - if ($offset === 'level_name' || $offset === 'level') { - // avoid returning readonly props by ref as this is illegal - if ($offset === 'level_name') { - $copy = $this->level->getName(); - } else { - $copy = $this->level->value; - } - - return $copy; - } - - if (isset(self::MODIFIABLE_FIELDS[$offset])) { - return $this->{$offset}; - } - - // avoid returning readonly props by ref as this is illegal - $copy = $this->{$offset}; - - return $copy; - } - /** - * @phpstan-return array{message: string, context: mixed[], level: value-of, level_name: value-of, channel: string, datetime: \DateTimeImmutable, extra: mixed[]} + * @phpstan-return Record */ - public function toArray(): array - { - return [ - 'message' => $this->message, - 'context' => $this->context, - 'level' => $this->level->value, - 'level_name' => $this->level->getName(), - 'channel' => $this->channel, - 'datetime' => $this->datetime, - 'extra' => $this->extra, - ]; - } - - public function with(mixed ...$args): self - { - foreach (['message', 'context', 'level', 'channel', 'datetime', 'extra'] as $prop) { - $args[$prop] ??= $this->{$prop}; - } - - return new self(...$args); - } + public function toArray(): array; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Logger.php b/monolog/vendor/monolog/monolog/src/Monolog/Logger.php index 5aacc6f8..84a2f551 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Logger.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Logger.php @@ -11,10 +11,8 @@ namespace Monolog; -use Closure; use DateTimeZone; use Monolog\Handler\HandlerInterface; -use Monolog\Processor\ProcessorInterface; use Psr\Log\LoggerInterface; use Psr\Log\InvalidArgumentException; use Psr\Log\LogLevel; @@ -28,14 +26,15 @@ use Stringable; * and uses them to store records that are added to it. * * @author Jordi Boggiano - * @final + * + * @phpstan-type Level Logger::DEBUG|Logger::INFO|Logger::NOTICE|Logger::WARNING|Logger::ERROR|Logger::CRITICAL|Logger::ALERT|Logger::EMERGENCY + * @phpstan-type LevelName 'DEBUG'|'INFO'|'NOTICE'|'WARNING'|'ERROR'|'CRITICAL'|'ALERT'|'EMERGENCY' + * @phpstan-type Record array{message: string, context: mixed[], level: Level, level_name: LevelName, channel: string, datetime: \DateTimeImmutable, extra: mixed[]} */ class Logger implements LoggerInterface, ResettableInterface { /** * Detailed debug information - * - * @deprecated Use \Monolog\Level::Debug */ public const DEBUG = 100; @@ -43,15 +42,11 @@ class Logger implements LoggerInterface, ResettableInterface * Interesting events * * Examples: User logs in, SQL logs. - * - * @deprecated Use \Monolog\Level::Info */ public const INFO = 200; /** * Uncommon events - * - * @deprecated Use \Monolog\Level::Notice */ public const NOTICE = 250; @@ -60,15 +55,11 @@ class Logger implements LoggerInterface, ResettableInterface * * Examples: Use of deprecated APIs, poor use of an API, * undesirable things that are not necessarily wrong. - * - * @deprecated Use \Monolog\Level::Warning */ public const WARNING = 300; /** * Runtime errors - * - * @deprecated Use \Monolog\Level::Error */ public const ERROR = 400; @@ -76,8 +67,6 @@ class Logger implements LoggerInterface, ResettableInterface * Critical conditions * * Example: Application component unavailable, unexpected exception. - * - * @deprecated Use \Monolog\Level::Critical */ public const CRITICAL = 500; @@ -86,15 +75,11 @@ class Logger implements LoggerInterface, ResettableInterface * * Example: Entire website down, database unavailable, etc. * This should trigger the SMS alerts and wake you up. - * - * @deprecated Use \Monolog\Level::Alert */ public const ALERT = 550; /** * Urgent alert. - * - * @deprecated Use \Monolog\Level::Emergency */ public const EMERGENCY = 600; @@ -103,8 +88,28 @@ class Logger implements LoggerInterface, ResettableInterface * * This is only bumped when API breaks are done and should * follow the major version of the library + * + * @var int */ - public const API = 3; + public const API = 2; + + /** + * This is a static variable and not a constant to serve as an extension point for custom levels + * + * @var array $levels Logging levels with the levels as key + * + * @phpstan-var array $levels Logging levels with the levels as key + */ + protected static $levels = [ + self::DEBUG => 'DEBUG', + self::INFO => 'INFO', + self::NOTICE => 'NOTICE', + self::WARNING => 'WARNING', + self::ERROR => 'ERROR', + self::CRITICAL => 'CRITICAL', + self::ALERT => 'ALERT', + self::EMERGENCY => 'EMERGENCY', + ]; /** * Mapping between levels numbers defined in RFC 5424 and Monolog ones @@ -112,66 +117,90 @@ class Logger implements LoggerInterface, ResettableInterface * @phpstan-var array $rfc_5424_levels */ private const RFC_5424_LEVELS = [ - 7 => Level::Debug, - 6 => Level::Info, - 5 => Level::Notice, - 4 => Level::Warning, - 3 => Level::Error, - 2 => Level::Critical, - 1 => Level::Alert, - 0 => Level::Emergency, + 7 => self::DEBUG, + 6 => self::INFO, + 5 => self::NOTICE, + 4 => self::WARNING, + 3 => self::ERROR, + 2 => self::CRITICAL, + 1 => self::ALERT, + 0 => self::EMERGENCY, ]; - protected string $name; + /** + * @var string + */ + protected $name; /** * The handler stack * - * @var list + * @var HandlerInterface[] */ - protected array $handlers; + protected $handlers; /** * Processors that will process all log records * * To process records of a single handler instead, add the processor on that specific handler * - * @var array<(callable(LogRecord): LogRecord)|ProcessorInterface> + * @var callable[] */ - protected array $processors; - - protected bool $microsecondTimestamps = true; - - protected DateTimeZone $timezone; - - protected Closure|null $exceptionHandler = null; + protected $processors; /** - * Keeps track of depth to prevent infinite logging loops + * @var bool */ - private int $logDepth = 0; + protected $microsecondTimestamps = true; /** - * Whether to detect infinite logging loops + * @var DateTimeZone + */ + protected $timezone; + + /** + * @var callable|null + */ + protected $exceptionHandler; + + /** + * @var int Keeps track of depth to prevent infinite logging loops + */ + private $logDepth = 0; + + /** + * @var \WeakMap<\Fiber, int>|null Keeps track of depth inside fibers to prevent infinite logging loops + */ + private $fiberLogDepth; + + /** + * @var bool Whether to detect infinite logging loops * * This can be disabled via {@see useLoggingLoopDetection} if you have async handlers that do not play well with this */ - private bool $detectCycles = true; + private $detectCycles = true; /** + * @psalm-param array $processors + * * @param string $name The logging channel, a simple descriptive name that is attached to all log records * @param HandlerInterface[] $handlers Optional stack of handlers, the first one in the array is called first, etc. * @param callable[] $processors Optional array of processors * @param DateTimeZone|null $timezone Optional timezone, if not provided date_default_timezone_get() will be used - * - * @phpstan-param array<(callable(LogRecord): LogRecord)|ProcessorInterface> $processors */ - public function __construct(string $name, array $handlers = [], array $processors = [], DateTimeZone|null $timezone = null) + public function __construct(string $name, array $handlers = [], array $processors = [], ?DateTimeZone $timezone = null) { $this->name = $name; $this->setHandlers($handlers); $this->processors = $processors; - $this->timezone = $timezone ?? new DateTimeZone(date_default_timezone_get()); + $this->timezone = $timezone ?: new DateTimeZone(date_default_timezone_get() ?: 'UTC'); + + if (\PHP_VERSION_ID >= 80100) { + // Local variable for phpstan, see https://github.com/phpstan/phpstan/issues/6732#issuecomment-1111118412 + /** @var \WeakMap<\Fiber, int> $fiberLogDepth */ + $fiberLogDepth = new \WeakMap(); + $this->fiberLogDepth = $fiberLogDepth; + } } public function getName(): string @@ -207,7 +236,7 @@ class Logger implements LoggerInterface, ResettableInterface */ public function popHandler(): HandlerInterface { - if (0 === \count($this->handlers)) { + if (!$this->handlers) { throw new \LogicException('You tried to pop from an empty handler stack.'); } @@ -219,7 +248,7 @@ class Logger implements LoggerInterface, ResettableInterface * * If a map is passed, keys will be ignored. * - * @param list $handlers + * @param HandlerInterface[] $handlers */ public function setHandlers(array $handlers): self { @@ -232,7 +261,7 @@ class Logger implements LoggerInterface, ResettableInterface } /** - * @return list + * @return HandlerInterface[] */ public function getHandlers(): array { @@ -241,10 +270,8 @@ class Logger implements LoggerInterface, ResettableInterface /** * Adds a processor on to the stack. - * - * @phpstan-param ProcessorInterface|(callable(LogRecord): LogRecord) $callback */ - public function pushProcessor(ProcessorInterface|callable $callback): self + public function pushProcessor(callable $callback): self { array_unshift($this->processors, $callback); @@ -254,12 +281,12 @@ class Logger implements LoggerInterface, ResettableInterface /** * Removes the processor on top of the stack and returns it. * - * @phpstan-return ProcessorInterface|(callable(LogRecord): LogRecord) * @throws \LogicException If empty processor stack + * @return callable */ public function popProcessor(): callable { - if (0 === \count($this->processors)) { + if (!$this->processors) { throw new \LogicException('You tried to pop from an empty processor stack.'); } @@ -268,7 +295,6 @@ class Logger implements LoggerInterface, ResettableInterface /** * @return callable[] - * @phpstan-return array */ public function getProcessors(): array { @@ -309,49 +335,58 @@ class Logger implements LoggerInterface, ResettableInterface * @param DateTimeImmutable $datetime Optional log date to log into the past or future * @return bool Whether the record has been processed * - * @phpstan-param value-of|Level $level + * @phpstan-param Level $level */ - public function addRecord(int|Level $level, string $message, array $context = [], DateTimeImmutable $datetime = null): bool + public function addRecord(int $level, string $message, array $context = [], DateTimeImmutable $datetime = null): bool { - if (is_int($level) && isset(self::RFC_5424_LEVELS[$level])) { + if (isset(self::RFC_5424_LEVELS[$level])) { $level = self::RFC_5424_LEVELS[$level]; } if ($this->detectCycles) { - $this->logDepth += 1; + if (\PHP_VERSION_ID >= 80100 && $fiber = \Fiber::getCurrent()) { + $this->fiberLogDepth[$fiber] = $this->fiberLogDepth[$fiber] ?? 0; + $logDepth = ++$this->fiberLogDepth[$fiber]; + } else { + $logDepth = ++$this->logDepth; + } + } else { + $logDepth = 0; } - if ($this->logDepth === 3) { + + if ($logDepth === 3) { $this->warning('A possible infinite logging loop was detected and aborted. It appears some of your handler code is triggering logging, see the previous log record for a hint as to what may be the cause.'); return false; - } elseif ($this->logDepth >= 5) { // log depth 4 is let through so we can log the warning above + } elseif ($logDepth >= 5) { // log depth 4 is let through, so we can log the warning above return false; } try { - $recordInitialized = count($this->processors) === 0; - - $record = new LogRecord( - message: $message, - context: $context, - level: self::toMonologLevel($level), - channel: $this->name, - datetime: $datetime ?? new DateTimeImmutable($this->microsecondTimestamps, $this->timezone), - extra: [], - ); - $handled = false; + $record = null; foreach ($this->handlers as $handler) { - if (false === $recordInitialized) { - // skip initializing the record as long as no handler is going to handle it - if (!$handler->isHandling($record)) { + if (null === $record) { + // skip creating the record as long as no handler is going to handle it + if (!$handler->isHandling(['level' => $level])) { continue; } + $levelName = static::getLevelName($level); + + $record = [ + 'message' => $message, + 'context' => $context, + 'level' => $level, + 'level_name' => $levelName, + 'channel' => $this->name, + 'datetime' => $datetime ?? new DateTimeImmutable($this->microsecondTimestamps, $this->timezone), + 'extra' => [], + ]; + try { foreach ($this->processors as $processor) { $record = $processor($record); } - $recordInitialized = true; } catch (Throwable $e) { $this->handleException($e, $record); @@ -359,9 +394,8 @@ class Logger implements LoggerInterface, ResettableInterface } } - // once the record is initialized, send it to all handlers as long as the bubbling chain is not interrupted + // once the record exists, send it to all handlers as long as the bubbling chain is not interrupted try { - $handled = true; if (true === $handler->handle($record)) { break; } @@ -371,13 +405,17 @@ class Logger implements LoggerInterface, ResettableInterface return true; } } - - return $handled; } finally { if ($this->detectCycles) { - $this->logDepth--; + if (isset($fiber)) { + $this->fiberLogDepth[$fiber]--; + } else { + $this->logDepth--; + } } } + + return null !== $record; } /** @@ -423,77 +461,77 @@ class Logger implements LoggerInterface, ResettableInterface } /** - * Gets the name of the logging level as a string. + * Gets all supported logging levels. * - * This still returns a string instead of a Level for BC, but new code should not rely on this method. + * @return array Assoc array with human-readable level names => level codes. + * @phpstan-return array + */ + public static function getLevels(): array + { + return array_flip(static::$levels); + } + + /** + * Gets the name of the logging level. * * @throws \Psr\Log\InvalidArgumentException If level is not defined * - * @phpstan-param value-of|Level $level - * @phpstan-return value-of - * - * @deprecated Since 3.0, use {@see toMonologLevel} or {@see \Monolog\Level->getName()} instead + * @phpstan-param Level $level + * @phpstan-return LevelName */ - public static function getLevelName(int|Level $level): string + public static function getLevelName(int $level): string { - return self::toMonologLevel($level)->getName(); + if (!isset(static::$levels[$level])) { + throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels))); + } + + return static::$levels[$level]; } /** * Converts PSR-3 levels to Monolog ones if necessary * - * @param int|string|Level|LogLevel::* $level Level number (monolog) or name (PSR-3) - * @throws \Psr\Log\InvalidArgumentException If level is not defined + * @param string|int $level Level number (monolog) or name (PSR-3) + * @throws \Psr\Log\InvalidArgumentException If level is not defined * - * @phpstan-param value-of|value-of|Level|LogLevel::* $level + * @phpstan-param Level|LevelName|LogLevel::* $level + * @phpstan-return Level */ - public static function toMonologLevel(string|int|Level $level): Level + public static function toMonologLevel($level): int { - if ($level instanceof Level) { - return $level; - } - - if (\is_string($level)) { - if (\is_numeric($level)) { - $levelEnum = Level::tryFrom((int) $level); - if ($levelEnum === null) { - throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', Level::NAMES + Level::VALUES)); - } - - return $levelEnum; + if (is_string($level)) { + if (is_numeric($level)) { + /** @phpstan-ignore-next-line */ + return intval($level); } - // Contains first char of all log levels and avoids using strtoupper() which may have + // Contains chars of all log levels and avoids using strtoupper() which may have // strange results depending on locale (for example, "i" will become "İ" in Turkish locale) - $upper = strtr(substr($level, 0, 1), 'dinweca', 'DINWECA') . strtolower(substr($level, 1)); - if (defined(Level::class.'::'.$upper)) { - return constant(Level::class . '::' . $upper); + $upper = strtr($level, 'abcdefgilmnortuwy', 'ABCDEFGILMNORTUWY'); + if (defined(__CLASS__.'::'.$upper)) { + return constant(__CLASS__ . '::' . $upper); } - throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', Level::NAMES + Level::VALUES)); + throw new InvalidArgumentException('Level "'.$level.'" is not defined, use one of: '.implode(', ', array_keys(static::$levels) + static::$levels)); } - $levelEnum = Level::tryFrom($level); - if ($levelEnum === null) { - throw new InvalidArgumentException('Level "'.var_export($level, true).'" is not defined, use one of: '.implode(', ', Level::NAMES + Level::VALUES)); + if (!is_int($level)) { + throw new InvalidArgumentException('Level "'.var_export($level, true).'" is not defined, use one of: '.implode(', ', array_keys(static::$levels) + static::$levels)); } - return $levelEnum; + return $level; } /** * Checks whether the Logger has a handler that listens on the given level * - * @phpstan-param value-of|value-of|Level|LogLevel::* $level + * @phpstan-param Level $level */ - public function isHandling(int|string|Level $level): bool + public function isHandling(int $level): bool { - $record = new LogRecord( - datetime: new DateTimeImmutable($this->microsecondTimestamps, $this->timezone), - channel: $this->name, - message: '', - level: self::toMonologLevel($level), - ); + $record = [ + 'level' => $level, + ]; foreach ($this->handlers as $handler) { if ($handler->isHandling($record)) { @@ -507,16 +545,16 @@ class Logger implements LoggerInterface, ResettableInterface /** * Set a custom exception handler that will be called if adding a new record fails * - * The Closure will receive an exception object and the record that failed to be logged + * The callable will receive an exception object and the record that failed to be logged */ - public function setExceptionHandler(Closure|null $callback): self + public function setExceptionHandler(?callable $callback): self { $this->exceptionHandler = $callback; return $this; } - public function getExceptionHandler(): Closure|null + public function getExceptionHandler(): ?callable { return $this->exceptionHandler; } @@ -530,22 +568,20 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context * - * @phpstan-param Level|LogLevel::* $level + * @phpstan-param Level|LevelName|LogLevel::* $level */ - public function log($level, string|\Stringable $message, array $context = []): void + public function log($level, $message, array $context = []): void { - if (!$level instanceof Level) { - if (!is_string($level) && !is_int($level)) { - throw new \InvalidArgumentException('$level is expected to be a string, int or '.Level::class.' instance'); - } - - if (isset(self::RFC_5424_LEVELS[$level])) { - $level = self::RFC_5424_LEVELS[$level]; - } - - $level = static::toMonologLevel($level); + if (!is_int($level) && !is_string($level)) { + throw new \InvalidArgumentException('$level is expected to be a string or int'); } + if (isset(self::RFC_5424_LEVELS[$level])) { + $level = self::RFC_5424_LEVELS[$level]; + } + + $level = static::toMonologLevel($level); + $this->addRecord($level, (string) $message, $context); } @@ -557,9 +593,9 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context */ - public function debug(string|\Stringable $message, array $context = []): void + public function debug($message, array $context = []): void { - $this->addRecord(Level::Debug, (string) $message, $context); + $this->addRecord(static::DEBUG, (string) $message, $context); } /** @@ -570,9 +606,9 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context */ - public function info(string|\Stringable $message, array $context = []): void + public function info($message, array $context = []): void { - $this->addRecord(Level::Info, (string) $message, $context); + $this->addRecord(static::INFO, (string) $message, $context); } /** @@ -583,9 +619,9 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context */ - public function notice(string|\Stringable $message, array $context = []): void + public function notice($message, array $context = []): void { - $this->addRecord(Level::Notice, (string) $message, $context); + $this->addRecord(static::NOTICE, (string) $message, $context); } /** @@ -596,9 +632,9 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context */ - public function warning(string|\Stringable $message, array $context = []): void + public function warning($message, array $context = []): void { - $this->addRecord(Level::Warning, (string) $message, $context); + $this->addRecord(static::WARNING, (string) $message, $context); } /** @@ -609,9 +645,9 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context */ - public function error(string|\Stringable $message, array $context = []): void + public function error($message, array $context = []): void { - $this->addRecord(Level::Error, (string) $message, $context); + $this->addRecord(static::ERROR, (string) $message, $context); } /** @@ -622,9 +658,9 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context */ - public function critical(string|\Stringable $message, array $context = []): void + public function critical($message, array $context = []): void { - $this->addRecord(Level::Critical, (string) $message, $context); + $this->addRecord(static::CRITICAL, (string) $message, $context); } /** @@ -635,9 +671,9 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context */ - public function alert(string|\Stringable $message, array $context = []): void + public function alert($message, array $context = []): void { - $this->addRecord(Level::Alert, (string) $message, $context); + $this->addRecord(static::ALERT, (string) $message, $context); } /** @@ -648,9 +684,9 @@ class Logger implements LoggerInterface, ResettableInterface * @param string|Stringable $message The log message * @param mixed[] $context The log context */ - public function emergency(string|\Stringable $message, array $context = []): void + public function emergency($message, array $context = []): void { - $this->addRecord(Level::Emergency, (string) $message, $context); + $this->addRecord(static::EMERGENCY, (string) $message, $context); } /** @@ -674,13 +710,52 @@ class Logger implements LoggerInterface, ResettableInterface /** * Delegates exception management to the custom exception handler, * or throws the exception if no custom handler is set. + * + * @param array $record + * @phpstan-param Record $record */ - protected function handleException(Throwable $e, LogRecord $record): void + protected function handleException(Throwable $e, array $record): void { - if (null === $this->exceptionHandler) { + if (!$this->exceptionHandler) { throw $e; } ($this->exceptionHandler)($e, $record); } + + /** + * @return array + */ + public function __serialize(): array + { + return [ + 'name' => $this->name, + 'handlers' => $this->handlers, + 'processors' => $this->processors, + 'microsecondTimestamps' => $this->microsecondTimestamps, + 'timezone' => $this->timezone, + 'exceptionHandler' => $this->exceptionHandler, + 'logDepth' => $this->logDepth, + 'detectCycles' => $this->detectCycles, + ]; + } + + /** + * @param array $data + */ + public function __unserialize(array $data): void + { + foreach (['name', 'handlers', 'processors', 'microsecondTimestamps', 'timezone', 'exceptionHandler', 'logDepth', 'detectCycles'] as $property) { + if (isset($data[$property])) { + $this->$property = $data[$property]; + } + } + + if (\PHP_VERSION_ID >= 80100) { + // Local variable for phpstan, see https://github.com/phpstan/phpstan/issues/6732#issuecomment-1111118412 + /** @var \WeakMap<\Fiber, int> $fiberLogDepth */ + $fiberLogDepth = new \WeakMap(); + $this->fiberLogDepth = $fiberLogDepth; + } + } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php index 4cbd9c84..8166bdca 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/GitProcessor.php @@ -11,44 +11,46 @@ namespace Monolog\Processor; -use Monolog\Level; use Monolog\Logger; use Psr\Log\LogLevel; -use Monolog\LogRecord; /** * Injects Git branch and Git commit SHA in all records * * @author Nick Otter * @author Jordi Boggiano + * + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger */ class GitProcessor implements ProcessorInterface { - private Level $level; + /** @var int */ + private $level; /** @var array{branch: string, commit: string}|array|null */ private static $cache = null; /** - * @param int|string|Level|LogLevel::* $level The minimum logging level at which this Processor will be triggered + * @param string|int $level The minimum logging level at which this Processor will be triggered * - * @phpstan-param value-of|value-of|Level|LogLevel::* $level + * @phpstan-param Level|LevelName|LogLevel::* $level */ - public function __construct(int|string|Level $level = Level::Debug) + public function __construct($level = Logger::DEBUG) { $this->level = Logger::toMonologLevel($level); } /** - * @inheritDoc + * {@inheritDoc} */ - public function __invoke(LogRecord $record): LogRecord + public function __invoke(array $record): array { // return if the level is not high enough - if ($record->level < $this->level) { + if ($record['level'] < $this->level) { return $record; } - $record->extra['git'] = self::getGitInfo(); + $record['extra']['git'] = self::getGitInfo(); return $record; } @@ -58,12 +60,12 @@ class GitProcessor implements ProcessorInterface */ private static function getGitInfo(): array { - if (self::$cache !== null) { + if (self::$cache) { return self::$cache; } - $branches = shell_exec('git branch -v --no-abbrev'); - if (is_string($branches) && 1 === preg_match('{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m', $branches, $matches)) { + $branches = `git branch -v --no-abbrev`; + if ($branches && preg_match('{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m', $branches, $matches)) { return self::$cache = [ 'branch' => $matches[1], 'commit' => $matches[2], diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/HostnameProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/HostnameProcessor.php index cba6e096..91fda7d6 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/HostnameProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/HostnameProcessor.php @@ -11,14 +11,13 @@ namespace Monolog\Processor; -use Monolog\LogRecord; - /** * Injects value of gethostname in all records */ class HostnameProcessor implements ProcessorInterface { - private static string $host; + /** @var string */ + private static $host; public function __construct() { @@ -26,11 +25,11 @@ class HostnameProcessor implements ProcessorInterface } /** - * @inheritDoc + * {@inheritDoc} */ - public function __invoke(LogRecord $record): LogRecord + public function __invoke(array $record): array { - $record->extra['hostname'] = self::$host; + $record['extra']['hostname'] = self::$host; return $record; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php index 30e7dfed..a32e76b2 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/IntrospectionProcessor.php @@ -11,10 +11,8 @@ namespace Monolog\Processor; -use Monolog\Level; use Monolog\Logger; use Psr\Log\LogLevel; -use Monolog\LogRecord; /** * Injects line/file:class/function where the log message came from @@ -26,28 +24,31 @@ use Monolog\LogRecord; * triggered the FingersCrossedHandler. * * @author Jordi Boggiano + * + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger */ class IntrospectionProcessor implements ProcessorInterface { - private Level $level; - + /** @var int */ + private $level; /** @var string[] */ - private array $skipClassesPartials; - - private int $skipStackFramesCount; - - private const SKIP_FUNCTIONS = [ + private $skipClassesPartials; + /** @var int */ + private $skipStackFramesCount; + /** @var string[] */ + private $skipFunctions = [ 'call_user_func', 'call_user_func_array', ]; /** - * @param string|int|Level $level The minimum logging level at which this Processor will be triggered - * @param string[] $skipClassesPartials + * @param string|int $level The minimum logging level at which this Processor will be triggered + * @param string[] $skipClassesPartials * - * @phpstan-param value-of|value-of|Level|LogLevel::* $level + * @phpstan-param Level|LevelName|LogLevel::* $level */ - public function __construct(int|string|Level $level = Level::Debug, array $skipClassesPartials = [], int $skipStackFramesCount = 0) + public function __construct($level = Logger::DEBUG, array $skipClassesPartials = [], int $skipStackFramesCount = 0) { $this->level = Logger::toMonologLevel($level); $this->skipClassesPartials = array_merge(['Monolog\\'], $skipClassesPartials); @@ -55,12 +56,12 @@ class IntrospectionProcessor implements ProcessorInterface } /** - * @inheritDoc + * {@inheritDoc} */ - public function __invoke(LogRecord $record): LogRecord + public function __invoke(array $record): array { // return if the level is not high enough - if ($record->level->isLowerThan($this->level)) { + if ($record['level'] < $this->level) { return $record; } @@ -82,7 +83,7 @@ class IntrospectionProcessor implements ProcessorInterface continue 2; } } - } elseif (in_array($trace[$i]['function'], self::SKIP_FUNCTIONS, true)) { + } elseif (in_array($trace[$i]['function'], $this->skipFunctions)) { $i++; continue; @@ -94,8 +95,8 @@ class IntrospectionProcessor implements ProcessorInterface $i += $this->skipStackFramesCount; // we should have the call source now - $record->extra = array_merge( - $record->extra, + $record['extra'] = array_merge( + $record['extra'], [ 'file' => isset($trace[$i - 1]['file']) ? $trace[$i - 1]['file'] : null, 'line' => isset($trace[$i - 1]['line']) ? $trace[$i - 1]['line'] : null, @@ -109,7 +110,7 @@ class IntrospectionProcessor implements ProcessorInterface } /** - * @param array $trace + * @param array[] $trace */ private function isTraceClassOrSkippedFunction(array $trace, int $index): bool { @@ -117,6 +118,6 @@ class IntrospectionProcessor implements ProcessorInterface return false; } - return isset($trace[$index]['class']) || in_array($trace[$index]['function'], self::SKIP_FUNCTIONS, true); + return isset($trace[$index]['class']) || in_array($trace[$index]['function'], $this->skipFunctions); } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php index adc32c65..37c756fc 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryPeakUsageProcessor.php @@ -11,8 +11,6 @@ namespace Monolog\Processor; -use Monolog\LogRecord; - /** * Injects memory_get_peak_usage in all records * @@ -22,9 +20,9 @@ use Monolog\LogRecord; class MemoryPeakUsageProcessor extends MemoryProcessor { /** - * @inheritDoc + * {@inheritDoc} */ - public function __invoke(LogRecord $record): LogRecord + public function __invoke(array $record): array { $usage = memory_get_peak_usage($this->realUsage); @@ -32,7 +30,7 @@ class MemoryPeakUsageProcessor extends MemoryProcessor $usage = $this->formatBytes($usage); } - $record->extra['memory_peak_usage'] = $usage; + $record['extra']['memory_peak_usage'] = $usage; return $record; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php index f808e51b..227deb7c 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryProcessor.php @@ -21,12 +21,12 @@ abstract class MemoryProcessor implements ProcessorInterface /** * @var bool If true, get the real size of memory allocated from system. Else, only the memory used by emalloc() is reported. */ - protected bool $realUsage; + protected $realUsage; /** * @var bool If true, then format memory size to human readable string (MB, KB, B depending on size) */ - protected bool $useFormatting; + protected $useFormatting; /** * @param bool $realUsage Set this to true to get the real size of memory allocated from system. @@ -41,6 +41,7 @@ abstract class MemoryProcessor implements ProcessorInterface /** * Formats bytes into a human readable string if $this->useFormatting is true, otherwise return $bytes as is * + * @param int $bytes * @return string|int Formatted string if $this->useFormatting is true, otherwise return $bytes as int */ protected function formatBytes(int $bytes) diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php index a814b1df..e141921e 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/MemoryUsageProcessor.php @@ -11,8 +11,6 @@ namespace Monolog\Processor; -use Monolog\LogRecord; - /** * Injects memory_get_usage in all records * @@ -22,9 +20,9 @@ use Monolog\LogRecord; class MemoryUsageProcessor extends MemoryProcessor { /** - * @inheritDoc + * {@inheritDoc} */ - public function __invoke(LogRecord $record): LogRecord + public function __invoke(array $record): array { $usage = memory_get_usage($this->realUsage); @@ -32,7 +30,7 @@ class MemoryUsageProcessor extends MemoryProcessor $usage = $this->formatBytes($usage); } - $record->extra['memory_usage'] = $usage; + $record['extra']['memory_usage'] = $usage; return $record; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php index 47b1e64f..d4a628f5 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/MercurialProcessor.php @@ -11,43 +11,45 @@ namespace Monolog\Processor; -use Monolog\Level; use Monolog\Logger; use Psr\Log\LogLevel; -use Monolog\LogRecord; /** * Injects Hg branch and Hg revision number in all records * * @author Jonathan A. Schweder + * + * @phpstan-import-type LevelName from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger */ class MercurialProcessor implements ProcessorInterface { - private Level $level; + /** @var Level */ + private $level; /** @var array{branch: string, revision: string}|array|null */ private static $cache = null; /** - * @param int|string|Level $level The minimum logging level at which this Processor will be triggered + * @param int|string $level The minimum logging level at which this Processor will be triggered * - * @phpstan-param value-of|value-of|Level|LogLevel::* $level + * @phpstan-param Level|LevelName|LogLevel::* $level */ - public function __construct(int|string|Level $level = Level::Debug) + public function __construct($level = Logger::DEBUG) { $this->level = Logger::toMonologLevel($level); } /** - * @inheritDoc + * {@inheritDoc} */ - public function __invoke(LogRecord $record): LogRecord + public function __invoke(array $record): array { // return if the level is not high enough - if ($record->level->isLowerThan($this->level)) { + if ($record['level'] < $this->level) { return $record; } - $record->extra['hg'] = self::getMercurialInfo(); + $record['extra']['hg'] = self::getMercurialInfo(); return $record; } @@ -57,11 +59,11 @@ class MercurialProcessor implements ProcessorInterface */ private static function getMercurialInfo(): array { - if (self::$cache !== null) { + if (self::$cache) { return self::$cache; } - $result = explode(' ', trim((string) shell_exec('hg id -nb'))); + $result = explode(' ', trim(`hg id -nb`)); if (count($result) >= 3) { return self::$cache = [ diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php index bb9a5224..3b939a95 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/ProcessIdProcessor.php @@ -11,8 +11,6 @@ namespace Monolog\Processor; -use Monolog\LogRecord; - /** * Adds value of getmypid into records * @@ -21,11 +19,11 @@ use Monolog\LogRecord; class ProcessIdProcessor implements ProcessorInterface { /** - * @inheritDoc + * {@inheritDoc} */ - public function __invoke(LogRecord $record): LogRecord + public function __invoke(array $record): array { - $record->extra['process_id'] = getmypid(); + $record['extra']['process_id'] = getmypid(); return $record; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php index ebe41fc2..5defb7eb 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/ProcessorInterface.php @@ -11,17 +11,20 @@ namespace Monolog\Processor; -use Monolog\LogRecord; - /** * An optional interface to allow labelling Monolog processors. * * @author Nicolas Grekas + * + * @phpstan-import-type Record from \Monolog\Logger */ interface ProcessorInterface { /** - * @return LogRecord The processed record + * @return array The processed record + * + * @phpstan-param Record $record + * @phpstan-return Record */ - public function __invoke(LogRecord $record); + public function __invoke(array $record); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php index f2407d56..e7c12176 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/PsrLogMessageProcessor.php @@ -12,7 +12,6 @@ namespace Monolog\Processor; use Monolog\Utils; -use Monolog\LogRecord; /** * Processes a record's message according to PSR-3 rules @@ -25,9 +24,11 @@ class PsrLogMessageProcessor implements ProcessorInterface { public const SIMPLE_DATE = "Y-m-d\TH:i:s.uP"; - private ?string $dateFormat; + /** @var string|null */ + private $dateFormat; - private bool $removeUsedContextFields; + /** @var bool */ + private $removeUsedContextFields; /** * @param string|null $dateFormat The format of the timestamp: one supported by DateTime::format @@ -40,33 +41,33 @@ class PsrLogMessageProcessor implements ProcessorInterface } /** - * @inheritDoc + * {@inheritDoc} */ - public function __invoke(LogRecord $record): LogRecord + public function __invoke(array $record): array { - if (false === strpos($record->message, '{')) { + if (false === strpos($record['message'], '{')) { return $record; } $replacements = []; - $context = $record->context; - - foreach ($context as $key => $val) { + foreach ($record['context'] as $key => $val) { $placeholder = '{' . $key . '}'; - if (strpos($record->message, $placeholder) === false) { + if (strpos($record['message'], $placeholder) === false) { continue; } - if (null === $val || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) { + if (is_null($val) || is_scalar($val) || (is_object($val) && method_exists($val, "__toString"))) { $replacements[$placeholder] = $val; } elseif ($val instanceof \DateTimeInterface) { - if (null === $this->dateFormat && $val instanceof \Monolog\DateTimeImmutable) { + if (!$this->dateFormat && $val instanceof \Monolog\DateTimeImmutable) { // handle monolog dates using __toString if no specific dateFormat was asked for // so that it follows the useMicroseconds flag $replacements[$placeholder] = (string) $val; } else { - $replacements[$placeholder] = $val->format($this->dateFormat ?? static::SIMPLE_DATE); + $replacements[$placeholder] = $val->format($this->dateFormat ?: static::SIMPLE_DATE); } + } elseif ($val instanceof \UnitEnum) { + $replacements[$placeholder] = $val instanceof \BackedEnum ? $val->value : $val->name; } elseif (is_object($val)) { $replacements[$placeholder] = '[object '.Utils::getClass($val).']'; } elseif (is_array($val)) { @@ -76,10 +77,12 @@ class PsrLogMessageProcessor implements ProcessorInterface } if ($this->removeUsedContextFields) { - unset($context[$key]); + unset($record['context'][$key]); } } - return $record->with(message: strtr($record->message, $replacements), context: $context); + $record['message'] = strtr($record['message'], $replacements); + + return $record; } } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php index 4543ccf6..80f18747 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/TagProcessor.php @@ -11,8 +11,6 @@ namespace Monolog\Processor; -use Monolog\LogRecord; - /** * Adds a tags array into record * @@ -21,7 +19,7 @@ use Monolog\LogRecord; class TagProcessor implements ProcessorInterface { /** @var string[] */ - private array $tags; + private $tags; /** * @param string[] $tags @@ -52,11 +50,11 @@ class TagProcessor implements ProcessorInterface } /** - * @inheritDoc + * {@inheritDoc} */ - public function __invoke(LogRecord $record): LogRecord + public function __invoke(array $record): array { - $record->extra['tags'] = $this->tags; + $record['extra']['tags'] = $this->tags; return $record; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php index 3a0c128c..a27b74db 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/UidProcessor.php @@ -12,7 +12,6 @@ namespace Monolog\Processor; use Monolog\ResettableInterface; -use Monolog\LogRecord; /** * Adds a unique identifier into records @@ -21,12 +20,9 @@ use Monolog\LogRecord; */ class UidProcessor implements ProcessorInterface, ResettableInterface { - /** @var non-empty-string */ - private string $uid; + /** @var string */ + private $uid; - /** - * @param int<1, 32> $length - */ public function __construct(int $length = 7) { if ($length > 32 || $length < 1) { @@ -37,11 +33,11 @@ class UidProcessor implements ProcessorInterface, ResettableInterface } /** - * @inheritDoc + * {@inheritDoc} */ - public function __invoke(LogRecord $record): LogRecord + public function __invoke(array $record): array { - $record->extra['uid'] = $this->uid; + $record['extra']['uid'] = $this->uid; return $record; } @@ -51,15 +47,11 @@ class UidProcessor implements ProcessorInterface, ResettableInterface return $this->uid; } - public function reset(): void + public function reset() { $this->uid = $this->generateUid(strlen($this->uid)); } - /** - * @param positive-int $length - * @return non-empty-string - */ private function generateUid(int $length): string { return substr(bin2hex(random_bytes((int) ceil($length / 2))), 0, $length); diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php b/monolog/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php index 2088b180..51850e17 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Processor/WebProcessor.php @@ -11,9 +11,6 @@ namespace Monolog\Processor; -use ArrayAccess; -use Monolog\LogRecord; - /** * Injects url/method and remote IP of the current web request in all records * @@ -22,9 +19,9 @@ use Monolog\LogRecord; class WebProcessor implements ProcessorInterface { /** - * @var array|ArrayAccess + * @var array|\ArrayAccess */ - protected array|ArrayAccess $serverData; + protected $serverData; /** * Default fields @@ -33,7 +30,7 @@ class WebProcessor implements ProcessorInterface * * @var array */ - protected array $extraFields = [ + protected $extraFields = [ 'url' => 'REQUEST_URI', 'ip' => 'REMOTE_ADDR', 'http_method' => 'REQUEST_METHOD', @@ -43,15 +40,17 @@ class WebProcessor implements ProcessorInterface ]; /** - * @param array|ArrayAccess|null $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data - * @param array|array|null $extraFields Field names and the related key inside $serverData to be added (or just a list of field names to use the default configured $serverData mapping). If not provided it defaults to: [url, ip, http_method, server, referrer] + unique_id if present in server data + * @param array|\ArrayAccess|null $serverData Array or object w/ ArrayAccess that provides access to the $_SERVER data + * @param array|array|null $extraFields Field names and the related key inside $serverData to be added (or just a list of field names to use the default configured $serverData mapping). If not provided it defaults to: [url, ip, http_method, server, referrer] + unique_id if present in server data */ - public function __construct(array|ArrayAccess|null $serverData = null, array|null $extraFields = null) + public function __construct($serverData = null, array $extraFields = null) { if (null === $serverData) { $this->serverData = &$_SERVER; - } else { + } elseif (is_array($serverData) || $serverData instanceof \ArrayAccess) { $this->serverData = $serverData; + } else { + throw new \UnexpectedValueException('$serverData must be an array or object implementing ArrayAccess.'); } $defaultEnabled = ['url', 'ip', 'http_method', 'server', 'referrer']; @@ -65,7 +64,7 @@ class WebProcessor implements ProcessorInterface } if (isset($extraFields[0])) { foreach (array_keys($this->extraFields) as $fieldName) { - if (!in_array($fieldName, $extraFields, true)) { + if (!in_array($fieldName, $extraFields)) { unset($this->extraFields[$fieldName]); } } @@ -75,9 +74,9 @@ class WebProcessor implements ProcessorInterface } /** - * @inheritDoc + * {@inheritDoc} */ - public function __invoke(LogRecord $record): LogRecord + public function __invoke(array $record): array { // skip processing if for some reason request data // is not present (CLI or wonky SAPIs) @@ -85,7 +84,7 @@ class WebProcessor implements ProcessorInterface return $record; } - $record->extra = $this->appendExtraFields($record->extra); + $record['extra'] = $this->appendExtraFields($record['extra']); return $record; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Registry.php b/monolog/vendor/monolog/monolog/src/Monolog/Registry.php index 2ef2edce..ae94ae6c 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Registry.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Registry.php @@ -42,7 +42,7 @@ class Registry * * @var Logger[] */ - private static array $loggers = []; + private static $loggers = []; /** * Adds new logging channel to the registry @@ -51,10 +51,11 @@ class Registry * @param string|null $name Name of the logging channel ($logger->getName() by default) * @param bool $overwrite Overwrite instance in the registry if the given name already exists? * @throws \InvalidArgumentException If $overwrite set to false and named Logger instance already exists + * @return void */ - public static function addLogger(Logger $logger, ?string $name = null, bool $overwrite = false): void + public static function addLogger(Logger $logger, ?string $name = null, bool $overwrite = false) { - $name = $name ?? $logger->getName(); + $name = $name ?: $logger->getName(); if (isset(self::$loggers[$name]) && !$overwrite) { throw new InvalidArgumentException('Logger with the given name already exists'); @@ -109,7 +110,7 @@ class Registry * @param string $name Name of the requested Logger instance * @throws \InvalidArgumentException If named Logger instance is not in the registry */ - public static function getInstance(string $name): Logger + public static function getInstance($name): Logger { if (!isset(self::$loggers[$name])) { throw new InvalidArgumentException(sprintf('Requested "%s" logger instance is not in the registry', $name)); @@ -126,7 +127,7 @@ class Registry * @throws \InvalidArgumentException If named Logger instance is not in the registry * @return Logger Requested instance of Logger */ - public static function __callStatic(string $name, array $arguments): Logger + public static function __callStatic($name, $arguments) { return self::getInstance($name); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/ResettableInterface.php b/monolog/vendor/monolog/monolog/src/Monolog/ResettableInterface.php index 4983a6b3..2c5fd785 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/ResettableInterface.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/ResettableInterface.php @@ -27,5 +27,8 @@ namespace Monolog; */ interface ResettableInterface { - public function reset(): void; + /** + * @return void + */ + public function reset(); } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/SignalHandler.php b/monolog/vendor/monolog/monolog/src/Monolog/SignalHandler.php index e6b02b08..d730eea3 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/SignalHandler.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/SignalHandler.php @@ -19,17 +19,21 @@ use ReflectionExtension; * Monolog POSIX signal handler * * @author Robert Gust-Bardon + * + * @phpstan-import-type Level from \Monolog\Logger + * @phpstan-import-type LevelName from \Monolog\Logger */ class SignalHandler { - private LoggerInterface $logger; + /** @var LoggerInterface */ + private $logger; /** @var array SIG_DFL, SIG_IGN or previous callable */ - private array $previousSignalHandler = []; - /** @var array */ - private array $signalLevelMap = []; + private $previousSignalHandler = []; + /** @var array */ + private $signalLevelMap = []; /** @var array */ - private array $signalRestartSyscalls = []; + private $signalRestartSyscalls = []; public function __construct(LoggerInterface $logger) { @@ -37,18 +41,21 @@ class SignalHandler } /** - * @param int|string|Level $level Level or level name + * @param int|string $level Level or level name + * @param bool $callPrevious + * @param bool $restartSyscalls + * @param bool|null $async * @return $this * - * @phpstan-param value-of|value-of|Level|LogLevel::* $level + * @phpstan-param Level|LevelName|LogLevel::* $level */ - public function registerSignalHandler(int $signo, int|string|Level $level = LogLevel::CRITICAL, bool $callPrevious = true, bool $restartSyscalls = true, ?bool $async = true): self + public function registerSignalHandler(int $signo, $level = LogLevel::CRITICAL, bool $callPrevious = true, bool $restartSyscalls = true, ?bool $async = true): self { if (!extension_loaded('pcntl') || !function_exists('pcntl_signal')) { return $this; } - $level = Logger::toMonologLevel($level)->toPsrLogLevel(); + $level = Logger::toMonologLevel($level); if ($callPrevious) { $handler = pcntl_signal_get_handler($signo); @@ -77,7 +84,8 @@ class SignalHandler if (!$signals && extension_loaded('pcntl')) { $pcntl = new ReflectionExtension('pcntl'); - foreach ($pcntl->getConstants() as $name => $value) { + // HHVM 3.24.2 returns an empty array. + foreach ($pcntl->getConstants() ?: get_defined_constants(true)['Core'] as $name => $value) { if (substr($name, 0, 3) === 'SIG' && $name[3] !== '_' && is_int($value)) { $signals[$value] = $name; } diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Test/TestCase.php b/monolog/vendor/monolog/monolog/src/Monolog/Test/TestCase.php index 98204a95..bc0b425e 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Test/TestCase.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Test/TestCase.php @@ -11,18 +11,18 @@ namespace Monolog\Test; -use Monolog\Level; use Monolog\Logger; -use Monolog\LogRecord; use Monolog\DateTimeImmutable; use Monolog\Formatter\FormatterInterface; -use Psr\Log\LogLevel; /** * Lets you easily generate log records and a dummy formatter for testing purposes * * @author Jordi Boggiano * + * @phpstan-import-type Record from \Monolog\Logger + * @phpstan-import-type Level from \Monolog\Logger + * * @internal feel free to reuse this to test your own handlers, this is marked internal to avoid issues with PHPStorm https://github.com/Seldaek/monolog/issues/1677 */ class TestCase extends \PHPUnit\Framework\TestCase @@ -37,44 +37,47 @@ class TestCase extends \PHPUnit\Framework\TestCase } /** - * @param array $context - * @param array $extra + * @param mixed[] $context * - * @phpstan-param value-of|value-of|Level|LogLevel::* $level + * @return array Record + * + * @phpstan-param Level $level + * @phpstan-return Record */ - protected function getRecord(int|string|Level $level = Level::Warning, string|\Stringable $message = 'test', array $context = [], string $channel = 'test', \DateTimeImmutable $datetime = new DateTimeImmutable(true), array $extra = []): LogRecord + protected function getRecord(int $level = Logger::WARNING, string $message = 'test', array $context = []): array { - return new LogRecord( - message: (string) $message, - context: $context, - level: Logger::toMonologLevel($level), - channel: $channel, - datetime: $datetime, - extra: $extra, - ); + return [ + 'message' => (string) $message, + 'context' => $context, + 'level' => $level, + 'level_name' => Logger::getLevelName($level), + 'channel' => 'test', + 'datetime' => new DateTimeImmutable(true), + 'extra' => [], + ]; } /** - * @phpstan-return list + * @phpstan-return Record[] */ protected function getMultipleRecords(): array { return [ - $this->getRecord(Level::Debug, 'debug message 1'), - $this->getRecord(Level::Debug, 'debug message 2'), - $this->getRecord(Level::Info, 'information'), - $this->getRecord(Level::Warning, 'warning'), - $this->getRecord(Level::Error, 'error'), + $this->getRecord(Logger::DEBUG, 'debug message 1'), + $this->getRecord(Logger::DEBUG, 'debug message 2'), + $this->getRecord(Logger::INFO, 'information'), + $this->getRecord(Logger::WARNING, 'warning'), + $this->getRecord(Logger::ERROR, 'error'), ]; } protected function getIdentityFormatter(): FormatterInterface { $formatter = $this->createMock(FormatterInterface::class); - $formatter->expects(self::any()) + $formatter->expects($this->any()) ->method('format') - ->will(self::returnCallback(function ($record) { - return $record->message; + ->will($this->returnCallback(function ($record) { + return $record['message']; })); return $formatter; diff --git a/monolog/vendor/monolog/monolog/src/Monolog/Utils.php b/monolog/vendor/monolog/monolog/src/Monolog/Utils.php index 9dae2535..360c4219 100644 --- a/monolog/vendor/monolog/monolog/src/Monolog/Utils.php +++ b/monolog/vendor/monolog/monolog/src/Monolog/Utils.php @@ -122,7 +122,7 @@ final class Utils if (is_string($data)) { self::detectAndCleanUtf8($data); } elseif (is_array($data)) { - array_walk_recursive($data, ['Monolog\Utils', 'detectAndCleanUtf8']); + array_walk_recursive($data, array('Monolog\Utils', 'detectAndCleanUtf8')); } else { self::throwEncodeError($code, $data); } @@ -165,16 +165,27 @@ final class Utils * @param int $code return code of json_last_error function * @param mixed $data data that was meant to be encoded * @throws \RuntimeException + * + * @return never */ - private static function throwEncodeError(int $code, $data): never + private static function throwEncodeError(int $code, $data): void { - $msg = match ($code) { - JSON_ERROR_DEPTH => 'Maximum stack depth exceeded', - JSON_ERROR_STATE_MISMATCH => 'Underflow or the modes mismatch', - JSON_ERROR_CTRL_CHAR => 'Unexpected control character found', - JSON_ERROR_UTF8 => 'Malformed UTF-8 characters, possibly incorrectly encoded', - default => 'Unknown error', - }; + switch ($code) { + case JSON_ERROR_DEPTH: + $msg = 'Maximum stack depth exceeded'; + break; + case JSON_ERROR_STATE_MISMATCH: + $msg = 'Underflow or the modes mismatch'; + break; + case JSON_ERROR_CTRL_CHAR: + $msg = 'Unexpected control character found'; + break; + case JSON_ERROR_UTF8: + $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded'; + break; + default: + $msg = 'Unknown error'; + } throw new \RuntimeException('JSON encoding failed: '.$msg.'. Encoding: '.var_export($data, true)); } @@ -196,7 +207,7 @@ final class Utils */ private static function detectAndCleanUtf8(&$data): void { - if (is_string($data) && preg_match('//u', $data) !== 1) { + if (is_string($data) && !preg_match('//u', $data)) { $data = preg_replace_callback( '/[\x80-\xFF]+/', function ($m) { @@ -206,7 +217,6 @@ final class Utils ); if (!is_string($data)) { $pcreErrorCode = preg_last_error(); - throw new \RuntimeException('Failed to preg_replace_callback: ' . $pcreErrorCode . ' / ' . self::pcreLastErrorMessage($pcreErrorCode)); } $data = str_replace( @@ -220,8 +230,8 @@ final class Utils /** * Converts a string with a valid 'memory_limit' format, to bytes. * - * @param string|false $val - * @return int|false Returns an integer representing bytes. Returns FALSE in case of error. + * @param string|false $val + * @return int|false Returns an integer representing bytes. Returns FALSE in case of error. */ public static function expandIniShorthandBytes($val) { @@ -234,7 +244,7 @@ final class Utils return (int) $val; } - if (preg_match('/^\s*(?\d+)(?:\.\d+)?\s*(?[gmk]?)\s*$/i', $val, $match) !== 1) { + if (!preg_match('/^\s*(?\d+)(?:\.\d+)?\s*(?[gmk]?)\s*$/i', $val, $match)) { return false; } @@ -242,10 +252,8 @@ final class Utils switch (strtolower($match['unit'] ?? '')) { case 'g': $val *= 1024; - // no break case 'm': $val *= 1024; - // no break case 'k': $val *= 1024; } @@ -253,22 +261,24 @@ final class Utils return $val; } - public static function getRecordMessageForException(LogRecord $record): string + /** + * @param array $record + */ + public static function getRecordMessageForException(array $record): string { $context = ''; $extra = ''; - try { - if (\count($record->context) > 0) { - $context = "\nContext: " . json_encode($record->context, JSON_THROW_ON_ERROR); + if ($record['context']) { + $context = "\nContext: " . json_encode($record['context']); } - if (\count($record->extra) > 0) { - $extra = "\nExtra: " . json_encode($record->extra, JSON_THROW_ON_ERROR); + if ($record['extra']) { + $extra = "\nExtra: " . json_encode($record['extra']); } } catch (\Throwable $e) { // noop } - return "\nThe exception occurred while attempting to log: " . $record->message . $context . $extra; + return "\nThe exception occurred while attempting to log: " . $record['message'] . $context . $extra; } } diff --git a/monolog/vendor/psr/log/composer.json b/monolog/vendor/psr/log/composer.json index 879fc6f5..ca056953 100644 --- a/monolog/vendor/psr/log/composer.json +++ b/monolog/vendor/psr/log/composer.json @@ -11,16 +11,16 @@ } ], "require": { - "php": ">=8.0.0" + "php": ">=5.3.0" }, "autoload": { "psr-4": { - "Psr\\Log\\": "src" + "Psr\\Log\\": "Psr/Log/" } }, "extra": { "branch-alias": { - "dev-master": "3.x-dev" + "dev-master": "1.1.x-dev" } } } diff --git a/monolog/vendor/psr/log/src/AbstractLogger.php b/monolog/vendor/psr/log/src/AbstractLogger.php deleted file mode 100644 index d60a091a..00000000 --- a/monolog/vendor/psr/log/src/AbstractLogger.php +++ /dev/null @@ -1,15 +0,0 @@ -logger = $logger; - } -} diff --git a/monolog/vendor/psr/log/src/LoggerInterface.php b/monolog/vendor/psr/log/src/LoggerInterface.php deleted file mode 100644 index b3a24b5f..00000000 --- a/monolog/vendor/psr/log/src/LoggerInterface.php +++ /dev/null @@ -1,125 +0,0 @@ -log(LogLevel::EMERGENCY, $message, $context); - } - - /** - * Action must be taken immediately. - * - * Example: Entire website down, database unavailable, etc. This should - * trigger the SMS alerts and wake you up. - * - * @param string|\Stringable $message - * @param array $context - * - * @return void - */ - public function alert(string|\Stringable $message, array $context = []): void - { - $this->log(LogLevel::ALERT, $message, $context); - } - - /** - * Critical conditions. - * - * Example: Application component unavailable, unexpected exception. - * - * @param string|\Stringable $message - * @param array $context - * - * @return void - */ - public function critical(string|\Stringable $message, array $context = []): void - { - $this->log(LogLevel::CRITICAL, $message, $context); - } - - /** - * Runtime errors that do not require immediate action but should typically - * be logged and monitored. - * - * @param string|\Stringable $message - * @param array $context - * - * @return void - */ - public function error(string|\Stringable $message, array $context = []): void - { - $this->log(LogLevel::ERROR, $message, $context); - } - - /** - * Exceptional occurrences that are not errors. - * - * Example: Use of deprecated APIs, poor use of an API, undesirable things - * that are not necessarily wrong. - * - * @param string|\Stringable $message - * @param array $context - * - * @return void - */ - public function warning(string|\Stringable $message, array $context = []): void - { - $this->log(LogLevel::WARNING, $message, $context); - } - - /** - * Normal but significant events. - * - * @param string|\Stringable $message - * @param array $context - * - * @return void - */ - public function notice(string|\Stringable $message, array $context = []): void - { - $this->log(LogLevel::NOTICE, $message, $context); - } - - /** - * Interesting events. - * - * Example: User logs in, SQL logs. - * - * @param string|\Stringable $message - * @param array $context - * - * @return void - */ - public function info(string|\Stringable $message, array $context = []): void - { - $this->log(LogLevel::INFO, $message, $context); - } - - /** - * Detailed debug information. - * - * @param string|\Stringable $message - * @param array $context - * - * @return void - */ - public function debug(string|\Stringable $message, array $context = []): void - { - $this->log(LogLevel::DEBUG, $message, $context); - } - - /** - * Logs with an arbitrary level. - * - * @param mixed $level - * @param string|\Stringable $message - * @param array $context - * - * @return void - * - * @throws \Psr\Log\InvalidArgumentException - */ - abstract public function log($level, string|\Stringable $message, array $context = []): void; -} diff --git a/monolog/vendor/psr/log/src/NullLogger.php b/monolog/vendor/psr/log/src/NullLogger.php deleted file mode 100644 index c1cc3c06..00000000 --- a/monolog/vendor/psr/log/src/NullLogger.php +++ /dev/null @@ -1,30 +0,0 @@ -logger) { }` - * blocks. - */ -class NullLogger extends AbstractLogger -{ - /** - * Logs with an arbitrary level. - * - * @param mixed $level - * @param string|\Stringable $message - * @param array $context - * - * @return void - * - * @throws \Psr\Log\InvalidArgumentException - */ - public function log($level, string|\Stringable $message, array $context = []): void - { - // noop - } -} diff --git a/morechoice/morechoice.php b/morechoice/morechoice.php index fe726d27..fbb88ce1 100644 --- a/morechoice/morechoice.php +++ b/morechoice/morechoice.php @@ -8,7 +8,6 @@ * Status: Deprecated */ -use Friendica\App; use Friendica\Core\Hook; use Friendica\DI; diff --git a/morepokes/morepokes.php b/morepokes/morepokes.php index abe59a6e..2ac09a73 100644 --- a/morepokes/morepokes.php +++ b/morepokes/morepokes.php @@ -7,7 +7,6 @@ * */ -use Friendica\App; use Friendica\Core\Hook; use Friendica\DI; diff --git a/newmemberwidget/README.md b/newmemberwidget/README.md index 39522238..e467708e 100644 --- a/newmemberwidget/README.md +++ b/newmemberwidget/README.md @@ -5,8 +5,8 @@ With this addon you can enable a widget for the sidebar of the network tab, which will be displayed for new members. It contains a linkt to friendicas introduction pages at /newmember and optionally - * a link to the global support forum - * a link to an eventually existing local support forum + * a link to the global support group + * a link to an eventually existing local support group * a welcome message you might want to send to your new members. There is no extra styling added for this added, so it should work with any diff --git a/newmemberwidget/lang/C/messages.po b/newmemberwidget/lang/C/messages.po index 1e7d608a..0dc91e13 100644 --- a/newmemberwidget/lang/C/messages.po +++ b/newmemberwidget/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -26,48 +26,48 @@ msgid "Tips for New Members" msgstr "" #: newmemberwidget.php:33 -msgid "Global Support Forum" +msgid "Global Support Group" msgstr "" #: newmemberwidget.php:37 -msgid "Local Support Forum" +msgid "Local Support Group" msgstr "" -#: newmemberwidget.php:65 +#: newmemberwidget.php:62 msgid "Save Settings" msgstr "" -#: newmemberwidget.php:66 +#: newmemberwidget.php:63 msgid "Message" msgstr "" -#: newmemberwidget.php:66 +#: newmemberwidget.php:63 msgid "Your message for new members. You can use bbcode here." msgstr "" -#: newmemberwidget.php:67 -msgid "Add a link to global support forum" +#: newmemberwidget.php:64 +msgid "Add a link to global support group" msgstr "" -#: newmemberwidget.php:67 -msgid "Should a link to the global support forum be displayed?" +#: newmemberwidget.php:64 +msgid "Should a link to the global support group be displayed?" msgstr "" -#: newmemberwidget.php:68 -msgid "Add a link to the local support forum" +#: newmemberwidget.php:65 +msgid "Add a link to the local support group" msgstr "" -#: newmemberwidget.php:68 +#: newmemberwidget.php:65 msgid "" -"If you have a local support forum and want to have a link displayed in the " +"If you have a local support group and want to have a link displayed in the " "widget, check this box." msgstr "" -#: newmemberwidget.php:69 +#: newmemberwidget.php:66 msgid "Name of the local support group" msgstr "" -#: newmemberwidget.php:69 +#: newmemberwidget.php:66 msgid "" "If you checked the above, specify the nickname of the local support " "group here (i.e. helpers)" diff --git a/newmemberwidget/lang/bg/messages.po b/newmemberwidget/lang/bg/messages.po new file mode 100644 index 00000000..40cc435e --- /dev/null +++ b/newmemberwidget/lang/bg/messages.po @@ -0,0 +1,75 @@ +# ADDON newmemberwidget +# Copyright (C) +# This file is distributed under the same license as the Friendica newmemberwidget addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" +"PO-Revision-Date: 2014-06-23 10:26+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: newmemberwidget.php:29 +msgid "New Member" +msgstr "" + +#: newmemberwidget.php:30 +msgid "Tips for New Members" +msgstr "" + +#: newmemberwidget.php:33 +msgid "Global Support Group" +msgstr "" + +#: newmemberwidget.php:37 +msgid "Local Support Group" +msgstr "" + +#: newmemberwidget.php:62 +msgid "Save Settings" +msgstr "" + +#: newmemberwidget.php:63 +msgid "Message" +msgstr "" + +#: newmemberwidget.php:63 +msgid "Your message for new members. You can use bbcode here." +msgstr "" + +#: newmemberwidget.php:64 +msgid "Add a link to global support group" +msgstr "" + +#: newmemberwidget.php:64 +msgid "Should a link to the global support group be displayed?" +msgstr "" + +#: newmemberwidget.php:65 +msgid "Add a link to the local support group" +msgstr "" + +#: newmemberwidget.php:65 +msgid "" +"If you have a local support group and want to have a link displayed in the " +"widget, check this box." +msgstr "" + +#: newmemberwidget.php:66 +msgid "Name of the local support group" +msgstr "" + +#: newmemberwidget.php:66 +msgid "" +"If you checked the above, specify the nickname of the local support" +" group here (i.e. helpers)" +msgstr "" diff --git a/newmemberwidget/lang/bg/strings.php b/newmemberwidget/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/newmemberwidget/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: newmemberwidget.php:29 +msgid "New Member" +msgstr "" + +#: newmemberwidget.php:30 +msgid "Tips for New Members" +msgstr "" + +#: newmemberwidget.php:33 +msgid "Global Support Group" +msgstr "" + +#: newmemberwidget.php:37 +msgid "Local Support Group" +msgstr "" + +#: newmemberwidget.php:62 +msgid "Save Settings" +msgstr "" + +#: newmemberwidget.php:63 +msgid "Message" +msgstr "" + +#: newmemberwidget.php:63 +msgid "Your message for new members. You can use bbcode here." +msgstr "" + +#: newmemberwidget.php:64 +msgid "Add a link to global support group" +msgstr "" + +#: newmemberwidget.php:64 +msgid "Should a link to the global support group be displayed?" +msgstr "" + +#: newmemberwidget.php:65 +msgid "Add a link to the local support group" +msgstr "" + +#: newmemberwidget.php:65 +msgid "" +"If you have a local support group and want to have a link displayed in the " +"widget, check this box." +msgstr "" + +#: newmemberwidget.php:66 +msgid "Name of the local support group" +msgstr "" + +#: newmemberwidget.php:66 +msgid "" +"If you checked the above, specify the nickname of the local support" +" group here (i.e. helpers)" +msgstr "" diff --git a/newmemberwidget/lang/ca/strings.php b/newmemberwidget/lang/ca/strings.php new file mode 100644 index 00000000..d34874f6 --- /dev/null +++ b/newmemberwidget/lang/ca/strings.php @@ -0,0 +1,7 @@ +nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/cs/strings.php b/newmemberwidget/lang/cs/strings.php index 3b6dc272..2f150466 100644 --- a/newmemberwidget/lang/cs/strings.php +++ b/newmemberwidget/lang/cs/strings.php @@ -7,13 +7,8 @@ function string_plural_select_cs($n){ }} $a->strings['New Member'] = 'Nový člen'; $a->strings['Tips for New Members'] = 'Tipy pro nové členy'; -$a->strings['Global Support Forum'] = 'Globální fórum podpory'; -$a->strings['Local Support Forum'] = 'Místní fórum podpory'; $a->strings['Save Settings'] = 'Uložit nastavení'; $a->strings['Message'] = 'Zpráva'; $a->strings['Your message for new members. You can use bbcode here.'] = 'Vaše zpráva pro nové členy. Zde můžete použít BBCode.'; -$a->strings['Add a link to global support forum'] = 'Přidejte odkaz na globální fórum podpory'; -$a->strings['Should a link to the global support forum be displayed?'] = 'Má být zobrazen odkaz na globální fórum podpory?'; -$a->strings['Add a link to the local support forum'] = 'Přidejte odkaz na místní fórum podpory'; $a->strings['Name of the local support group'] = 'Název místního fóra podpory'; $a->strings['If you checked the above, specify the nickname of the local support group here (i.e. helpers)'] = 'Pokud jste zaškrtl/a výše uvedenou možnost, specifikujte zde přezdívku místní skupiny podpory (např. pomocnici)'; diff --git a/newmemberwidget/lang/de/messages.po b/newmemberwidget/lang/de/messages.po index 851dfdce..87289e3e 100644 --- a/newmemberwidget/lang/de/messages.po +++ b/newmemberwidget/lang/de/messages.po @@ -4,15 +4,16 @@ # # # Translators: +# Raroun, 2023 # Tobias Diekershoff , 2021 # Ulf Rompe , 2019 msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" "PO-Revision-Date: 2014-06-23 10:26+0000\n" -"Last-Translator: Tobias Diekershoff , 2021\n" +"Last-Translator: Raroun, 2023\n" "Language-Team: German (http://app.transifex.com/Friendica/friendica/language/de/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -29,48 +30,48 @@ msgid "Tips for New Members" msgstr "Tipps für neue Nutzer" #: newmemberwidget.php:33 -msgid "Global Support Forum" -msgstr "Globales Forum für Hilfsanfragen" +msgid "Global Support Group" +msgstr "Globale Support-Gruppe" #: newmemberwidget.php:37 -msgid "Local Support Forum" -msgstr "Lokales Forum für Hilfsanfragen" +msgid "Local Support Group" +msgstr "Lokale Support-Gruppe" -#: newmemberwidget.php:65 +#: newmemberwidget.php:62 msgid "Save Settings" msgstr "Einstellungen speichern" -#: newmemberwidget.php:66 +#: newmemberwidget.php:63 msgid "Message" msgstr "Nachricht" -#: newmemberwidget.php:66 +#: newmemberwidget.php:63 msgid "Your message for new members. You can use bbcode here." msgstr "Deine Nachricht für neue Nutzer. BBCode kann verwendet werden." -#: newmemberwidget.php:67 -msgid "Add a link to global support forum" -msgstr "Link zum globalen Support-Forum anzeigen" +#: newmemberwidget.php:64 +msgid "Add a link to global support group" +msgstr "Fügen Sie einen Link der globalen Support-Gruppe hinzu" -#: newmemberwidget.php:67 -msgid "Should a link to the global support forum be displayed?" -msgstr "Soll ein Link zum globalen Support-Forum angezeigt werden?" +#: newmemberwidget.php:64 +msgid "Should a link to the global support group be displayed?" +msgstr "Soll ein Link zur globalen Support-Gruppe angezeigt werden?" -#: newmemberwidget.php:68 -msgid "Add a link to the local support forum" -msgstr "Link zum lokalen Support-Forum anzeigen" +#: newmemberwidget.php:65 +msgid "Add a link to the local support group" +msgstr "Fügen Sie einen Link der lokalen Support-Gruppe hinzu" -#: newmemberwidget.php:68 +#: newmemberwidget.php:65 msgid "" -"If you have a local support forum and want to have a link displayed in the " +"If you have a local support group and want to have a link displayed in the " "widget, check this box." -msgstr "Wenn du ein lokales Support-Forum eingerichtet hast und ein Link darauf angezeigt werden soll, schalte dies ein." +msgstr "Wenn Sie eine lokale Support-Gruppe haben und einen Link im Widget anzeigen lassen möchten, markieren Sie dieses Feld." -#: newmemberwidget.php:69 +#: newmemberwidget.php:66 msgid "Name of the local support group" msgstr "Name des lokalen Support-Forums" -#: newmemberwidget.php:69 +#: newmemberwidget.php:66 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/de/strings.php b/newmemberwidget/lang/de/strings.php index c7dc503c..aa3e0f88 100644 --- a/newmemberwidget/lang/de/strings.php +++ b/newmemberwidget/lang/de/strings.php @@ -7,14 +7,14 @@ function string_plural_select_de($n){ }} $a->strings['New Member'] = 'Neue Nutzer'; $a->strings['Tips for New Members'] = 'Tipps für neue Nutzer'; -$a->strings['Global Support Forum'] = 'Globales Forum für Hilfsanfragen'; -$a->strings['Local Support Forum'] = 'Lokales Forum für Hilfsanfragen'; +$a->strings['Global Support Group'] = 'Globale Support-Gruppe'; +$a->strings['Local Support Group'] = 'Lokale Support-Gruppe'; $a->strings['Save Settings'] = 'Einstellungen speichern'; $a->strings['Message'] = 'Nachricht'; $a->strings['Your message for new members. You can use bbcode here.'] = 'Deine Nachricht für neue Nutzer. BBCode kann verwendet werden.'; -$a->strings['Add a link to global support forum'] = 'Link zum globalen Support-Forum anzeigen'; -$a->strings['Should a link to the global support forum be displayed?'] = 'Soll ein Link zum globalen Support-Forum angezeigt werden?'; -$a->strings['Add a link to the local support forum'] = 'Link zum lokalen Support-Forum anzeigen'; -$a->strings['If you have a local support forum and want to have a link displayed in the widget, check this box.'] = 'Wenn du ein lokales Support-Forum eingerichtet hast und ein Link darauf angezeigt werden soll, schalte dies ein.'; +$a->strings['Add a link to global support group'] = 'Fügen Sie einen Link der globalen Support-Gruppe hinzu'; +$a->strings['Should a link to the global support group be displayed?'] = 'Soll ein Link zur globalen Support-Gruppe angezeigt werden?'; +$a->strings['Add a link to the local support group'] = 'Fügen Sie einen Link der lokalen Support-Gruppe hinzu'; +$a->strings['If you have a local support group and want to have a link displayed in the widget, check this box.'] = 'Wenn Sie eine lokale Support-Gruppe haben und einen Link im Widget anzeigen lassen möchten, markieren Sie dieses Feld.'; $a->strings['Name of the local support group'] = 'Name des lokalen Support-Forums'; $a->strings['If you checked the above, specify the nickname of the local support group here (i.e. helpers)'] = 'Wenn der Link angezeigt werden soll, dann trage hier den Spitznamen des Forums ein (z.B. helpers)'; diff --git a/newmemberwidget/lang/eo/messages.po b/newmemberwidget/lang/eo/messages.po new file mode 100644 index 00000000..5619131c --- /dev/null +++ b/newmemberwidget/lang/eo/messages.po @@ -0,0 +1,75 @@ +# ADDON newmemberwidget +# Copyright (C) +# This file is distributed under the same license as the Friendica newmemberwidget addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" +"PO-Revision-Date: 2014-06-23 10:26+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: newmemberwidget.php:29 +msgid "New Member" +msgstr "" + +#: newmemberwidget.php:30 +msgid "Tips for New Members" +msgstr "" + +#: newmemberwidget.php:33 +msgid "Global Support Group" +msgstr "" + +#: newmemberwidget.php:37 +msgid "Local Support Group" +msgstr "" + +#: newmemberwidget.php:62 +msgid "Save Settings" +msgstr "" + +#: newmemberwidget.php:63 +msgid "Message" +msgstr "" + +#: newmemberwidget.php:63 +msgid "Your message for new members. You can use bbcode here." +msgstr "" + +#: newmemberwidget.php:64 +msgid "Add a link to global support group" +msgstr "" + +#: newmemberwidget.php:64 +msgid "Should a link to the global support group be displayed?" +msgstr "" + +#: newmemberwidget.php:65 +msgid "Add a link to the local support group" +msgstr "" + +#: newmemberwidget.php:65 +msgid "" +"If you have a local support group and want to have a link displayed in the " +"widget, check this box." +msgstr "" + +#: newmemberwidget.php:66 +msgid "Name of the local support group" +msgstr "" + +#: newmemberwidget.php:66 +msgid "" +"If you checked the above, specify the nickname of the local support" +" group here (i.e. helpers)" +msgstr "" diff --git a/newmemberwidget/lang/eo/strings.php b/newmemberwidget/lang/eo/strings.php new file mode 100644 index 00000000..68e8a64c --- /dev/null +++ b/newmemberwidget/lang/eo/strings.php @@ -0,0 +1,7 @@ +\n" -"Language-Team: Spanish (http://www.transifex.com/Friendica/friendica/language/es/)\n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" +"PO-Revision-Date: 2014-06-23 10:26+0000\n" +"Last-Translator: Senex Petrovic , 2021\n" +"Language-Team: Spanish (http://app.transifex.com/Friendica/friendica/language/es/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: es\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" +"Plural-Forms: nplurals=3; plural=n == 1 ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n" #: newmemberwidget.php:29 msgid "New Member" @@ -29,48 +29,48 @@ msgid "Tips for New Members" msgstr "Consejos para Nuevos Miembros" #: newmemberwidget.php:33 -msgid "Global Support Forum" -msgstr "Foro de Soporte Global" +msgid "Global Support Group" +msgstr "" #: newmemberwidget.php:37 -msgid "Local Support Forum" -msgstr "Foro de Soporte Local" +msgid "Local Support Group" +msgstr "" -#: newmemberwidget.php:65 +#: newmemberwidget.php:62 msgid "Save Settings" msgstr "Guardar Ajustes" -#: newmemberwidget.php:66 +#: newmemberwidget.php:63 msgid "Message" msgstr "Mensaje" -#: newmemberwidget.php:66 +#: newmemberwidget.php:63 msgid "Your message for new members. You can use bbcode here." msgstr "Su mensaje para los nuevos miembros. Puede usar bbcode aquí" -#: newmemberwidget.php:67 -msgid "Add a link to global support forum" -msgstr "Añadir un enlace al foro de soporte global" +#: newmemberwidget.php:64 +msgid "Add a link to global support group" +msgstr "" -#: newmemberwidget.php:67 -msgid "Should a link to the global support forum be displayed?" -msgstr "¿Debería mostrarse un enlace al foro de soporte global?" +#: newmemberwidget.php:64 +msgid "Should a link to the global support group be displayed?" +msgstr "" -#: newmemberwidget.php:68 -msgid "Add a link to the local support forum" -msgstr "Añadir un enlace al foro de soporte local" +#: newmemberwidget.php:65 +msgid "Add a link to the local support group" +msgstr "" -#: newmemberwidget.php:68 +#: newmemberwidget.php:65 msgid "" -"If you have a local support forum and want to have a link displayed in the " +"If you have a local support group and want to have a link displayed in the " "widget, check this box." -msgstr "Si tiene foro de soporte local y desea que se muestre un enlace en el widget, marque esta casilla." +msgstr "" -#: newmemberwidget.php:69 +#: newmemberwidget.php:66 msgid "Name of the local support group" msgstr "Nombre del grupo de soporte local" -#: newmemberwidget.php:69 +#: newmemberwidget.php:66 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/es/strings.php b/newmemberwidget/lang/es/strings.php index 28253b73..8798813a 100644 --- a/newmemberwidget/lang/es/strings.php +++ b/newmemberwidget/lang/es/strings.php @@ -3,18 +3,12 @@ if(! function_exists("string_plural_select_es")) { function string_plural_select_es($n){ $n = intval($n); - return intval($n != 1); + if ($n == 1) { return 0; } else if ($n != 0 && $n % 1000000 == 0) { return 1; } else { return 2; } }} $a->strings['New Member'] = 'Nuevo Miembro'; $a->strings['Tips for New Members'] = 'Consejos para Nuevos Miembros'; -$a->strings['Global Support Forum'] = 'Foro de Soporte Global'; -$a->strings['Local Support Forum'] = 'Foro de Soporte Local'; $a->strings['Save Settings'] = 'Guardar Ajustes'; $a->strings['Message'] = 'Mensaje'; $a->strings['Your message for new members. You can use bbcode here.'] = 'Su mensaje para los nuevos miembros. Puede usar bbcode aquí'; -$a->strings['Add a link to global support forum'] = 'Añadir un enlace al foro de soporte global'; -$a->strings['Should a link to the global support forum be displayed?'] = '¿Debería mostrarse un enlace al foro de soporte global?'; -$a->strings['Add a link to the local support forum'] = 'Añadir un enlace al foro de soporte local'; -$a->strings['If you have a local support forum and want to have a link displayed in the widget, check this box.'] = 'Si tiene foro de soporte local y desea que se muestre un enlace en el widget, marque esta casilla.'; $a->strings['Name of the local support group'] = 'Nombre del grupo de soporte local'; $a->strings['If you checked the above, specify the nickname of the local support group here (i.e. helpers)'] = 'Si chequeó arriba, especifique el apodo del grupo de soporte local aquí (asistentes)'; diff --git a/newmemberwidget/lang/et/messages.po b/newmemberwidget/lang/et/messages.po index 969efad9..6f52dff8 100644 --- a/newmemberwidget/lang/et/messages.po +++ b/newmemberwidget/lang/et/messages.po @@ -9,67 +9,67 @@ msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-06-01 14:12+0200\n" -"PO-Revision-Date: 2019-04-16 05:07+0000\n" -"Last-Translator: Rain Hawk\n" -"Language-Team: Estonian (http://www.transifex.com/Friendica/friendica/language/et/)\n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" +"PO-Revision-Date: 2014-06-23 10:26+0000\n" +"Last-Translator: Rain Hawk, 2019\n" +"Language-Team: Estonian (http://app.transifex.com/Friendica/friendica/language/et/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: et\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -#: newmemberwidget.php:21 +#: newmemberwidget.php:29 msgid "New Member" msgstr "Uus liige" -#: newmemberwidget.php:22 +#: newmemberwidget.php:30 msgid "Tips for New Members" msgstr "Nippe uutele liikmetele" -#: newmemberwidget.php:24 -msgid "Global Support Forum" -msgstr "Globaalne tugifoorum" +#: newmemberwidget.php:33 +msgid "Global Support Group" +msgstr "" -#: newmemberwidget.php:26 -msgid "Local Support Forum" -msgstr "Lokaalne tugifoorum" +#: newmemberwidget.php:37 +msgid "Local Support Group" +msgstr "" -#: newmemberwidget.php:49 +#: newmemberwidget.php:62 msgid "Save Settings" msgstr "Salvesta sätted" -#: newmemberwidget.php:50 +#: newmemberwidget.php:63 msgid "Message" msgstr "Sõnum" -#: newmemberwidget.php:50 +#: newmemberwidget.php:63 msgid "Your message for new members. You can use bbcode here." msgstr "" -#: newmemberwidget.php:51 -msgid "Add a link to global support forum" +#: newmemberwidget.php:64 +msgid "Add a link to global support group" msgstr "" -#: newmemberwidget.php:51 -msgid "Should a link to the global support forum be displayed?" +#: newmemberwidget.php:64 +msgid "Should a link to the global support group be displayed?" msgstr "" -#: newmemberwidget.php:52 -msgid "Add a link to the local support forum" +#: newmemberwidget.php:65 +msgid "Add a link to the local support group" msgstr "" -#: newmemberwidget.php:52 +#: newmemberwidget.php:65 msgid "" -"If you have a local support forum and wand to have a link displayed in the " +"If you have a local support group and want to have a link displayed in the " "widget, check this box." msgstr "" -#: newmemberwidget.php:53 +#: newmemberwidget.php:66 msgid "Name of the local support group" msgstr "" -#: newmemberwidget.php:53 +#: newmemberwidget.php:66 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/et/strings.php b/newmemberwidget/lang/et/strings.php index 3d4f8167..e4465d99 100644 --- a/newmemberwidget/lang/et/strings.php +++ b/newmemberwidget/lang/et/strings.php @@ -7,7 +7,5 @@ function string_plural_select_et($n){ }} $a->strings['New Member'] = 'Uus liige'; $a->strings['Tips for New Members'] = 'Nippe uutele liikmetele'; -$a->strings['Global Support Forum'] = 'Globaalne tugifoorum'; -$a->strings['Local Support Forum'] = 'Lokaalne tugifoorum'; $a->strings['Save Settings'] = 'Salvesta sätted'; $a->strings['Message'] = 'Sõnum'; diff --git a/newmemberwidget/lang/fr/messages.po b/newmemberwidget/lang/fr/messages.po index 296c2755..fe50a027 100644 --- a/newmemberwidget/lang/fr/messages.po +++ b/newmemberwidget/lang/fr/messages.po @@ -4,6 +4,8 @@ # # # Translators: +# cracrayol, 2025 +# cracrayol, 2023 # Hypolite Petovan , 2022 # Nicolas Derive, 2022 # StefOfficiel , 2015 @@ -11,10 +13,10 @@ msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" "PO-Revision-Date: 2014-06-23 10:26+0000\n" -"Last-Translator: Nicolas Derive, 2022\n" -"Language-Team: French (http://www.transifex.com/Friendica/friendica/language/fr/)\n" +"Last-Translator: cracrayol, 2025\n" +"Language-Team: French (http://app.transifex.com/Friendica/friendica/language/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -30,48 +32,48 @@ msgid "Tips for New Members" msgstr "Conseils aux nouveaux venus" #: newmemberwidget.php:33 -msgid "Global Support Forum" -msgstr "Forum de support global" +msgid "Global Support Group" +msgstr "Groupe de support global" #: newmemberwidget.php:37 -msgid "Local Support Forum" -msgstr "Forum de support local" +msgid "Local Support Group" +msgstr "Groupe de support local" -#: newmemberwidget.php:65 +#: newmemberwidget.php:62 msgid "Save Settings" -msgstr "Enregistrer les paramètres" +msgstr "Sauvegarder les paramètres" -#: newmemberwidget.php:66 +#: newmemberwidget.php:63 msgid "Message" msgstr "Message" -#: newmemberwidget.php:66 +#: newmemberwidget.php:63 msgid "Your message for new members. You can use bbcode here." msgstr "Votre messages aux nouveaux venus. Vous pouvez utiliser des BBCodes." -#: newmemberwidget.php:67 -msgid "Add a link to global support forum" -msgstr "Ajouter un lien vers le forum de support global" +#: newmemberwidget.php:64 +msgid "Add a link to global support group" +msgstr "Ajouter un lien vers le groupe de support global" -#: newmemberwidget.php:67 -msgid "Should a link to the global support forum be displayed?" -msgstr "Montrer un lien vers le forum de support global?" +#: newmemberwidget.php:64 +msgid "Should a link to the global support group be displayed?" +msgstr "Montrer un lien vers le groupe de support global ?" -#: newmemberwidget.php:68 -msgid "Add a link to the local support forum" -msgstr "Ajouter un lien vers le forum de support local" +#: newmemberwidget.php:65 +msgid "Add a link to the local support group" +msgstr "Ajouter un lien vers le groupe de support local" -#: newmemberwidget.php:68 +#: newmemberwidget.php:65 msgid "" -"If you have a local support forum and want to have a link displayed in the " +"If you have a local support group and want to have a link displayed in the " "widget, check this box." -msgstr "Si vous avez un forum d'assistance local et désirez avoir un lien affiché dans l'appliquette/widget, cochez cette case." +msgstr "Si vous avez un groupe de support local et désirez avoir un lien affiché dans l'appliquette/widget, cochez cette case." -#: newmemberwidget.php:69 +#: newmemberwidget.php:66 msgid "Name of the local support group" msgstr "Nom du groupe de support local" -#: newmemberwidget.php:69 +#: newmemberwidget.php:66 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/fr/strings.php b/newmemberwidget/lang/fr/strings.php index 8de178f2..ce6d6598 100644 --- a/newmemberwidget/lang/fr/strings.php +++ b/newmemberwidget/lang/fr/strings.php @@ -7,14 +7,14 @@ function string_plural_select_fr($n){ }} $a->strings['New Member'] = 'Nouveau Membre'; $a->strings['Tips for New Members'] = 'Conseils aux nouveaux venus'; -$a->strings['Global Support Forum'] = 'Forum de support global'; -$a->strings['Local Support Forum'] = 'Forum de support local'; -$a->strings['Save Settings'] = 'Enregistrer les paramètres'; +$a->strings['Global Support Group'] = 'Groupe de support global'; +$a->strings['Local Support Group'] = 'Groupe de support local'; +$a->strings['Save Settings'] = 'Sauvegarder les paramètres'; $a->strings['Message'] = 'Message'; $a->strings['Your message for new members. You can use bbcode here.'] = 'Votre messages aux nouveaux venus. Vous pouvez utiliser des BBCodes.'; -$a->strings['Add a link to global support forum'] = 'Ajouter un lien vers le forum de support global'; -$a->strings['Should a link to the global support forum be displayed?'] = 'Montrer un lien vers le forum de support global?'; -$a->strings['Add a link to the local support forum'] = 'Ajouter un lien vers le forum de support local'; -$a->strings['If you have a local support forum and want to have a link displayed in the widget, check this box.'] = 'Si vous avez un forum d\'assistance local et désirez avoir un lien affiché dans l\'appliquette/widget, cochez cette case.'; +$a->strings['Add a link to global support group'] = 'Ajouter un lien vers le groupe de support global'; +$a->strings['Should a link to the global support group be displayed?'] = 'Montrer un lien vers le groupe de support global ?'; +$a->strings['Add a link to the local support group'] = 'Ajouter un lien vers le groupe de support local'; +$a->strings['If you have a local support group and want to have a link displayed in the widget, check this box.'] = 'Si vous avez un groupe de support local et désirez avoir un lien affiché dans l\'appliquette/widget, cochez cette case.'; $a->strings['Name of the local support group'] = 'Nom du groupe de support local'; $a->strings['If you checked the above, specify the nickname of the local support group here (i.e. helpers)'] = 'Si vous avez coché la case ci-dessus, spécifiez le nom d\'utilisateur du groupe de support local (par ex. "helpers")'; diff --git a/newmemberwidget/lang/gd/messages.po b/newmemberwidget/lang/gd/messages.po new file mode 100644 index 00000000..aa34a3ca --- /dev/null +++ b/newmemberwidget/lang/gd/messages.po @@ -0,0 +1,75 @@ +# ADDON newmemberwidget +# Copyright (C) +# This file is distributed under the same license as the Friendica newmemberwidget addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" +"PO-Revision-Date: 2014-06-23 10:26+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: newmemberwidget.php:29 +msgid "New Member" +msgstr "" + +#: newmemberwidget.php:30 +msgid "Tips for New Members" +msgstr "" + +#: newmemberwidget.php:33 +msgid "Global Support Group" +msgstr "" + +#: newmemberwidget.php:37 +msgid "Local Support Group" +msgstr "" + +#: newmemberwidget.php:62 +msgid "Save Settings" +msgstr "" + +#: newmemberwidget.php:63 +msgid "Message" +msgstr "" + +#: newmemberwidget.php:63 +msgid "Your message for new members. You can use bbcode here." +msgstr "" + +#: newmemberwidget.php:64 +msgid "Add a link to global support group" +msgstr "" + +#: newmemberwidget.php:64 +msgid "Should a link to the global support group be displayed?" +msgstr "" + +#: newmemberwidget.php:65 +msgid "Add a link to the local support group" +msgstr "" + +#: newmemberwidget.php:65 +msgid "" +"If you have a local support group and want to have a link displayed in the " +"widget, check this box." +msgstr "" + +#: newmemberwidget.php:66 +msgid "Name of the local support group" +msgstr "" + +#: newmemberwidget.php:66 +msgid "" +"If you checked the above, specify the nickname of the local support" +" group here (i.e. helpers)" +msgstr "" diff --git a/newmemberwidget/lang/gd/strings.php b/newmemberwidget/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/newmemberwidget/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/newmemberwidget/lang/hu/messages.po b/newmemberwidget/lang/hu/messages.po index 41453463..f3babd21 100644 --- a/newmemberwidget/lang/hu/messages.po +++ b/newmemberwidget/lang/hu/messages.po @@ -4,15 +4,15 @@ # # # Translators: -# Balázs Úr, 2020-2021 +# Balázs Úr, 2020-2021,2023 msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" "PO-Revision-Date: 2014-06-23 10:26+0000\n" -"Last-Translator: Balázs Úr, 2020-2021\n" -"Language-Team: Hungarian (http://www.transifex.com/Friendica/friendica/language/hu/)\n" +"Last-Translator: Balázs Úr, 2020-2021,2023\n" +"Language-Team: Hungarian (http://app.transifex.com/Friendica/friendica/language/hu/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -28,48 +28,48 @@ msgid "Tips for New Members" msgstr "Tippek új tagoknak" #: newmemberwidget.php:33 -msgid "Global Support Forum" -msgstr "Globális támogató fórum" +msgid "Global Support Group" +msgstr "Globális támogatási csoport" #: newmemberwidget.php:37 -msgid "Local Support Forum" -msgstr "Helyi támogató fórum" +msgid "Local Support Group" +msgstr "Helyi támogatási csoport" -#: newmemberwidget.php:65 +#: newmemberwidget.php:62 msgid "Save Settings" msgstr "Beállítások mentése" -#: newmemberwidget.php:66 +#: newmemberwidget.php:63 msgid "Message" msgstr "Üzenet" -#: newmemberwidget.php:66 +#: newmemberwidget.php:63 msgid "Your message for new members. You can use bbcode here." msgstr "Az Ön üzenete az új tagoknak. Itt használhat BBCode-ot." -#: newmemberwidget.php:67 -msgid "Add a link to global support forum" -msgstr "A globális támogató fórumra mutató hivatkozás hozzáadása" +#: newmemberwidget.php:64 +msgid "Add a link to global support group" +msgstr "A globális támogatási csoportra mutató hivatkozás hozzáadása" -#: newmemberwidget.php:67 -msgid "Should a link to the global support forum be displayed?" -msgstr "Meg kell jeleníteni a globális támogató fórumra mutató hivatkozást?" +#: newmemberwidget.php:64 +msgid "Should a link to the global support group be displayed?" +msgstr "Meg kell jeleníteni a globális támogatási csoportra mutató hivatkozást?" -#: newmemberwidget.php:68 -msgid "Add a link to the local support forum" -msgstr "A helyi támogató fórumra mutató hivatkozás hozzáadása" +#: newmemberwidget.php:65 +msgid "Add a link to the local support group" +msgstr "A helyi támogatási csoportra mutató hivatkozás hozzáadása" -#: newmemberwidget.php:68 +#: newmemberwidget.php:65 msgid "" -"If you have a local support forum and want to have a link displayed in the " +"If you have a local support group and want to have a link displayed in the " "widget, check this box." -msgstr "Ha van helyi támogató fóruma és szeretne egy hivatkozást megjeleníteni a felületi elemben, akkor jelölje be azt a négyzetet." +msgstr "Ha van helyi támogatási csoportja és meg szeretne jeleníteni egy hivatkozást a felületi elemben, akkor jelölje be ezt a négyzetet." -#: newmemberwidget.php:69 +#: newmemberwidget.php:66 msgid "Name of the local support group" msgstr "A helyi támogató csoport neve" -#: newmemberwidget.php:69 +#: newmemberwidget.php:66 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/hu/strings.php b/newmemberwidget/lang/hu/strings.php index edf2a003..2f0066cd 100644 --- a/newmemberwidget/lang/hu/strings.php +++ b/newmemberwidget/lang/hu/strings.php @@ -7,14 +7,14 @@ function string_plural_select_hu($n){ }} $a->strings['New Member'] = 'Új tag'; $a->strings['Tips for New Members'] = 'Tippek új tagoknak'; -$a->strings['Global Support Forum'] = 'Globális támogató fórum'; -$a->strings['Local Support Forum'] = 'Helyi támogató fórum'; +$a->strings['Global Support Group'] = 'Globális támogatási csoport'; +$a->strings['Local Support Group'] = 'Helyi támogatási csoport'; $a->strings['Save Settings'] = 'Beállítások mentése'; $a->strings['Message'] = 'Üzenet'; $a->strings['Your message for new members. You can use bbcode here.'] = 'Az Ön üzenete az új tagoknak. Itt használhat BBCode-ot.'; -$a->strings['Add a link to global support forum'] = 'A globális támogató fórumra mutató hivatkozás hozzáadása'; -$a->strings['Should a link to the global support forum be displayed?'] = 'Meg kell jeleníteni a globális támogató fórumra mutató hivatkozást?'; -$a->strings['Add a link to the local support forum'] = 'A helyi támogató fórumra mutató hivatkozás hozzáadása'; -$a->strings['If you have a local support forum and want to have a link displayed in the widget, check this box.'] = 'Ha van helyi támogató fóruma és szeretne egy hivatkozást megjeleníteni a felületi elemben, akkor jelölje be azt a négyzetet.'; +$a->strings['Add a link to global support group'] = 'A globális támogatási csoportra mutató hivatkozás hozzáadása'; +$a->strings['Should a link to the global support group be displayed?'] = 'Meg kell jeleníteni a globális támogatási csoportra mutató hivatkozást?'; +$a->strings['Add a link to the local support group'] = 'A helyi támogatási csoportra mutató hivatkozás hozzáadása'; +$a->strings['If you have a local support group and want to have a link displayed in the widget, check this box.'] = 'Ha van helyi támogatási csoportja és meg szeretne jeleníteni egy hivatkozást a felületi elemben, akkor jelölje be ezt a négyzetet.'; $a->strings['Name of the local support group'] = 'A helyi támogató csoport neve'; $a->strings['If you checked the above, specify the nickname of the local support group here (i.e. helpers)'] = 'Ha bejelölte a fentit, akkor itt adja meg a helyi támogató csoport becenevét (például segítők)'; diff --git a/newmemberwidget/lang/is/messages.po b/newmemberwidget/lang/is/messages.po new file mode 100644 index 00000000..c740a42b --- /dev/null +++ b/newmemberwidget/lang/is/messages.po @@ -0,0 +1,75 @@ +# ADDON newmemberwidget +# Copyright (C) +# This file is distributed under the same license as the Friendica newmemberwidget addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" +"PO-Revision-Date: 2014-06-23 10:26+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: newmemberwidget.php:29 +msgid "New Member" +msgstr "" + +#: newmemberwidget.php:30 +msgid "Tips for New Members" +msgstr "" + +#: newmemberwidget.php:33 +msgid "Global Support Group" +msgstr "" + +#: newmemberwidget.php:37 +msgid "Local Support Group" +msgstr "" + +#: newmemberwidget.php:62 +msgid "Save Settings" +msgstr "" + +#: newmemberwidget.php:63 +msgid "Message" +msgstr "" + +#: newmemberwidget.php:63 +msgid "Your message for new members. You can use bbcode here." +msgstr "" + +#: newmemberwidget.php:64 +msgid "Add a link to global support group" +msgstr "" + +#: newmemberwidget.php:64 +msgid "Should a link to the global support group be displayed?" +msgstr "" + +#: newmemberwidget.php:65 +msgid "Add a link to the local support group" +msgstr "" + +#: newmemberwidget.php:65 +msgid "" +"If you have a local support group and want to have a link displayed in the " +"widget, check this box." +msgstr "" + +#: newmemberwidget.php:66 +msgid "Name of the local support group" +msgstr "" + +#: newmemberwidget.php:66 +msgid "" +"If you checked the above, specify the nickname of the local support" +" group here (i.e. helpers)" +msgstr "" diff --git a/newmemberwidget/lang/is/strings.php b/newmemberwidget/lang/is/strings.php new file mode 100644 index 00000000..975c341e --- /dev/null +++ b/newmemberwidget/lang/is/strings.php @@ -0,0 +1,7 @@ +, 2020-2021\n" "Language-Team: Italian (http://app.transifex.com/Friendica/friendica/language/it/)\n" @@ -29,48 +29,48 @@ msgid "Tips for New Members" msgstr "Consigli per i Nuovi Utenti" #: newmemberwidget.php:33 -msgid "Global Support Forum" -msgstr "Forum Globale di Supporto" +msgid "Global Support Group" +msgstr "" #: newmemberwidget.php:37 -msgid "Local Support Forum" -msgstr "Forum Locale di Supporto" +msgid "Local Support Group" +msgstr "" -#: newmemberwidget.php:65 +#: newmemberwidget.php:62 msgid "Save Settings" msgstr "Salva Impostazioni" -#: newmemberwidget.php:66 +#: newmemberwidget.php:63 msgid "Message" msgstr "Messaggio" -#: newmemberwidget.php:66 +#: newmemberwidget.php:63 msgid "Your message for new members. You can use bbcode here." msgstr "Il tuo messaggio per i nuovi utenti. Puoi usare BBCode" -#: newmemberwidget.php:67 -msgid "Add a link to global support forum" -msgstr "Aggiunge un collegamento al forum di supporto globale" +#: newmemberwidget.php:64 +msgid "Add a link to global support group" +msgstr "" -#: newmemberwidget.php:67 -msgid "Should a link to the global support forum be displayed?" -msgstr "Mostrare il collegamento al forum di supporto globale?" +#: newmemberwidget.php:64 +msgid "Should a link to the global support group be displayed?" +msgstr "" -#: newmemberwidget.php:68 -msgid "Add a link to the local support forum" -msgstr "Aggiunge un collegamento al forum di supporto locale" +#: newmemberwidget.php:65 +msgid "Add a link to the local support group" +msgstr "" -#: newmemberwidget.php:68 +#: newmemberwidget.php:65 msgid "" -"If you have a local support forum and want to have a link displayed in the " +"If you have a local support group and want to have a link displayed in the " "widget, check this box." -msgstr "Se hai un forum di supporto locale e vuoi che sia mostrato il collegamento nel widget, seleziona questo box." +msgstr "" -#: newmemberwidget.php:69 +#: newmemberwidget.php:66 msgid "Name of the local support group" msgstr "Nome del gruppo locale di supporto" -#: newmemberwidget.php:69 +#: newmemberwidget.php:66 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/it/strings.php b/newmemberwidget/lang/it/strings.php index f459f79e..56798c2a 100644 --- a/newmemberwidget/lang/it/strings.php +++ b/newmemberwidget/lang/it/strings.php @@ -7,14 +7,8 @@ function string_plural_select_it($n){ }} $a->strings['New Member'] = 'Nuovi Utenti'; $a->strings['Tips for New Members'] = 'Consigli per i Nuovi Utenti'; -$a->strings['Global Support Forum'] = 'Forum Globale di Supporto'; -$a->strings['Local Support Forum'] = 'Forum Locale di Supporto'; $a->strings['Save Settings'] = 'Salva Impostazioni'; $a->strings['Message'] = 'Messaggio'; $a->strings['Your message for new members. You can use bbcode here.'] = 'Il tuo messaggio per i nuovi utenti. Puoi usare BBCode'; -$a->strings['Add a link to global support forum'] = 'Aggiunge un collegamento al forum di supporto globale'; -$a->strings['Should a link to the global support forum be displayed?'] = 'Mostrare il collegamento al forum di supporto globale?'; -$a->strings['Add a link to the local support forum'] = 'Aggiunge un collegamento al forum di supporto locale'; -$a->strings['If you have a local support forum and want to have a link displayed in the widget, check this box.'] = 'Se hai un forum di supporto locale e vuoi che sia mostrato il collegamento nel widget, seleziona questo box.'; $a->strings['Name of the local support group'] = 'Nome del gruppo locale di supporto'; $a->strings['If you checked the above, specify the nickname of the local support group here (i.e. helpers)'] = 'Se hai selezionato il box sopra, specifica qui il nome utente del gruppo locale di supporto (e.s. \'supporto\')'; diff --git a/newmemberwidget/lang/pl/messages.po b/newmemberwidget/lang/pl/messages.po index 3f1838b5..4d95d214 100644 --- a/newmemberwidget/lang/pl/messages.po +++ b/newmemberwidget/lang/pl/messages.po @@ -4,16 +4,17 @@ # # # Translators: -# Piotr Strębski , 2022 +# Bartosz Kozień, 2025 +# Piotr Strebski , 2022 # Waldemar Stoczkowski, 2018 msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" "PO-Revision-Date: 2014-06-23 10:26+0000\n" -"Last-Translator: Piotr Strębski , 2022\n" -"Language-Team: Polish (http://www.transifex.com/Friendica/friendica/language/pl/)\n" +"Last-Translator: Bartosz Kozień, 2025\n" +"Language-Team: Polish (http://app.transifex.com/Friendica/friendica/language/pl/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -29,49 +30,49 @@ msgid "Tips for New Members" msgstr "Wskazówki dla nowych użytkowników" #: newmemberwidget.php:33 -msgid "Global Support Forum" -msgstr "Globalne forum pomocy technicznej" +msgid "Global Support Group" +msgstr "Globalna Grupa Pomocy" #: newmemberwidget.php:37 -msgid "Local Support Forum" -msgstr "Lokalne Forum Wsparcia" +msgid "Local Support Group" +msgstr "Lokalna Grupa Pomocy" -#: newmemberwidget.php:65 +#: newmemberwidget.php:62 msgid "Save Settings" msgstr "Zapisz ustawienia" -#: newmemberwidget.php:66 +#: newmemberwidget.php:63 msgid "Message" msgstr "Wiadomość" -#: newmemberwidget.php:66 +#: newmemberwidget.php:63 msgid "Your message for new members. You can use bbcode here." msgstr "Twoja wiadomość dla nowych członków. Możesz tutaj użyć bbcode." -#: newmemberwidget.php:67 -msgid "Add a link to global support forum" -msgstr "Dodaj odnośnik do globalnego forum pomocy technicznej" +#: newmemberwidget.php:64 +msgid "Add a link to global support group" +msgstr "Dodaj link do globalnej grupy pomocy" -#: newmemberwidget.php:67 -msgid "Should a link to the global support forum be displayed?" -msgstr "Czy powinien być wyświetlany odnośnik do globalnego forum pomocy technicznej?" +#: newmemberwidget.php:64 +msgid "Should a link to the global support group be displayed?" +msgstr "Czy link do globalnej grupy pomocy powinien być wyświetlany?" -#: newmemberwidget.php:68 -msgid "Add a link to the local support forum" -msgstr "Dodaj odnośnik do lokalnego forum pomocy technicznej" +#: newmemberwidget.php:65 +msgid "Add a link to the local support group" +msgstr "Dodaj link do lokalnej grupy pomocy" -#: newmemberwidget.php:68 +#: newmemberwidget.php:65 msgid "" -"If you have a local support forum and want to have a link displayed in the " +"If you have a local support group and want to have a link displayed in the " "widget, check this box." -msgstr "Jeżeli masz lokalne wsparcie forum i chcesz mieć łącze wyświetlane w widżecie, zaznacz to pole wyboru." +msgstr "Jeśli posiadasz lokalną grupę pomocy i chcesz wyświetlać link do niej na widżecie, zaznacz tę opcję." -#: newmemberwidget.php:69 +#: newmemberwidget.php:66 msgid "Name of the local support group" -msgstr "Nazwa grupy lokalnej pomocy technicznej" +msgstr "Alias lokalnej grupy pomocy" -#: newmemberwidget.php:69 +#: newmemberwidget.php:66 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" -msgstr "Jeśli zaznaczyłeś powyższe, określ tutaj pseudonim lokalnej grupy wsparcia (np. Pomocnicy)" +msgstr "Jeśli zaznaczyłeś powyższe, podaj tutaj alias lokalnej grupy pomocy (np. pomocnicy)" diff --git a/newmemberwidget/lang/pl/strings.php b/newmemberwidget/lang/pl/strings.php index 97103add..d46c671e 100644 --- a/newmemberwidget/lang/pl/strings.php +++ b/newmemberwidget/lang/pl/strings.php @@ -7,14 +7,14 @@ function string_plural_select_pl($n){ }} $a->strings['New Member'] = 'Nowy użytkownik'; $a->strings['Tips for New Members'] = 'Wskazówki dla nowych użytkowników'; -$a->strings['Global Support Forum'] = 'Globalne forum pomocy technicznej'; -$a->strings['Local Support Forum'] = 'Lokalne Forum Wsparcia'; +$a->strings['Global Support Group'] = 'Globalna Grupa Pomocy'; +$a->strings['Local Support Group'] = 'Lokalna Grupa Pomocy'; $a->strings['Save Settings'] = 'Zapisz ustawienia'; $a->strings['Message'] = 'Wiadomość'; $a->strings['Your message for new members. You can use bbcode here.'] = 'Twoja wiadomość dla nowych członków. Możesz tutaj użyć bbcode.'; -$a->strings['Add a link to global support forum'] = 'Dodaj odnośnik do globalnego forum pomocy technicznej'; -$a->strings['Should a link to the global support forum be displayed?'] = 'Czy powinien być wyświetlany odnośnik do globalnego forum pomocy technicznej?'; -$a->strings['Add a link to the local support forum'] = 'Dodaj odnośnik do lokalnego forum pomocy technicznej'; -$a->strings['If you have a local support forum and want to have a link displayed in the widget, check this box.'] = 'Jeżeli masz lokalne wsparcie forum i chcesz mieć łącze wyświetlane w widżecie, zaznacz to pole wyboru.'; -$a->strings['Name of the local support group'] = 'Nazwa grupy lokalnej pomocy technicznej'; -$a->strings['If you checked the above, specify the nickname of the local support group here (i.e. helpers)'] = 'Jeśli zaznaczyłeś powyższe, określ tutaj pseudonim lokalnej grupy wsparcia (np. Pomocnicy)'; +$a->strings['Add a link to global support group'] = 'Dodaj link do globalnej grupy pomocy'; +$a->strings['Should a link to the global support group be displayed?'] = 'Czy link do globalnej grupy pomocy powinien być wyświetlany?'; +$a->strings['Add a link to the local support group'] = 'Dodaj link do lokalnej grupy pomocy'; +$a->strings['If you have a local support group and want to have a link displayed in the widget, check this box.'] = 'Jeśli posiadasz lokalną grupę pomocy i chcesz wyświetlać link do niej na widżecie, zaznacz tę opcję.'; +$a->strings['Name of the local support group'] = 'Alias lokalnej grupy pomocy'; +$a->strings['If you checked the above, specify the nickname of the local support group here (i.e. helpers)'] = 'Jeśli zaznaczyłeś powyższe, podaj tutaj alias lokalnej grupy pomocy (np. pomocnicy)'; diff --git a/newmemberwidget/lang/ru/messages.po b/newmemberwidget/lang/ru/messages.po index 94d61e3f..1fe611e9 100644 --- a/newmemberwidget/lang/ru/messages.po +++ b/newmemberwidget/lang/ru/messages.po @@ -9,67 +9,67 @@ msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-06-01 14:12+0200\n" -"PO-Revision-Date: 2020-04-23 14:23+0000\n" -"Last-Translator: Alexander An \n" -"Language-Team: Russian (http://www.transifex.com/Friendica/friendica/language/ru/)\n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" +"PO-Revision-Date: 2014-06-23 10:26+0000\n" +"Last-Translator: Alexander An , 2020\n" +"Language-Team: Russian (http://app.transifex.com/Friendica/friendica/language/ru/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ru\n" "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" -#: newmemberwidget.php:21 +#: newmemberwidget.php:29 msgid "New Member" msgstr "Новичок" -#: newmemberwidget.php:22 +#: newmemberwidget.php:30 msgid "Tips for New Members" msgstr "Советы новичкам" -#: newmemberwidget.php:24 -msgid "Global Support Forum" -msgstr "Общий форум поддержки" +#: newmemberwidget.php:33 +msgid "Global Support Group" +msgstr "" -#: newmemberwidget.php:26 -msgid "Local Support Forum" -msgstr "Местный форум поддержки" +#: newmemberwidget.php:37 +msgid "Local Support Group" +msgstr "" -#: newmemberwidget.php:49 +#: newmemberwidget.php:62 msgid "Save Settings" msgstr "Сохранить настройки" -#: newmemberwidget.php:50 +#: newmemberwidget.php:63 msgid "Message" msgstr "Сообщение" -#: newmemberwidget.php:50 +#: newmemberwidget.php:63 msgid "Your message for new members. You can use bbcode here." msgstr "Ваше сообщение новичкам. Вы можете использовать BBCode." -#: newmemberwidget.php:51 -msgid "Add a link to global support forum" -msgstr "Добавить ссылку на общий форум поддержки" +#: newmemberwidget.php:64 +msgid "Add a link to global support group" +msgstr "" -#: newmemberwidget.php:51 -msgid "Should a link to the global support forum be displayed?" -msgstr "Показывать ссылку на общий форум поддержки?" +#: newmemberwidget.php:64 +msgid "Should a link to the global support group be displayed?" +msgstr "" -#: newmemberwidget.php:52 -msgid "Add a link to the local support forum" -msgstr "Добавить ссылку на местный форум поддержки" +#: newmemberwidget.php:65 +msgid "Add a link to the local support group" +msgstr "" -#: newmemberwidget.php:52 +#: newmemberwidget.php:65 msgid "" -"If you have a local support forum and wand to have a link displayed in the " +"If you have a local support group and want to have a link displayed in the " "widget, check this box." -msgstr "Если у вас есть местный форум поддержки и вы хотите добавить ссылку на него, включите это." +msgstr "" -#: newmemberwidget.php:53 +#: newmemberwidget.php:66 msgid "Name of the local support group" msgstr "Название местной группы поддержки" -#: newmemberwidget.php:53 +#: newmemberwidget.php:66 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/ru/strings.php b/newmemberwidget/lang/ru/strings.php index 7992e64b..6f27bb1a 100644 --- a/newmemberwidget/lang/ru/strings.php +++ b/newmemberwidget/lang/ru/strings.php @@ -7,14 +7,8 @@ function string_plural_select_ru($n){ }} $a->strings['New Member'] = 'Новичок'; $a->strings['Tips for New Members'] = 'Советы новичкам'; -$a->strings['Global Support Forum'] = 'Общий форум поддержки'; -$a->strings['Local Support Forum'] = 'Местный форум поддержки'; $a->strings['Save Settings'] = 'Сохранить настройки'; $a->strings['Message'] = 'Сообщение'; $a->strings['Your message for new members. You can use bbcode here.'] = 'Ваше сообщение новичкам. Вы можете использовать BBCode.'; -$a->strings['Add a link to global support forum'] = 'Добавить ссылку на общий форум поддержки'; -$a->strings['Should a link to the global support forum be displayed?'] = 'Показывать ссылку на общий форум поддержки?'; -$a->strings['Add a link to the local support forum'] = 'Добавить ссылку на местный форум поддержки'; -$a->strings['If you have a local support forum and wand to have a link displayed in the widget, check this box.'] = 'Если у вас есть местный форум поддержки и вы хотите добавить ссылку на него, включите это.'; $a->strings['Name of the local support group'] = 'Название местной группы поддержки'; $a->strings['If you checked the above, specify the nickname of the local support group here (i.e. helpers)'] = 'Если вы включили настройку выше, укажите никместной группы поддержки пользователей.'; diff --git a/newmemberwidget/lang/sv/messages.po b/newmemberwidget/lang/sv/messages.po index 0d6171b2..a1a6167a 100644 --- a/newmemberwidget/lang/sv/messages.po +++ b/newmemberwidget/lang/sv/messages.po @@ -9,10 +9,10 @@ msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-02-01 18:15+0100\n" -"PO-Revision-Date: 2022-01-16 00:48+0000\n" -"Last-Translator: Kristoffer Grundström \n" -"Language-Team: Swedish (http://www.transifex.com/Friendica/friendica/language/sv/)\n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" +"PO-Revision-Date: 2014-06-23 10:26+0000\n" +"Last-Translator: Kristoffer Grundström , 2022\n" +"Language-Team: Swedish (http://app.transifex.com/Friendica/friendica/language/sv/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -28,48 +28,48 @@ msgid "Tips for New Members" msgstr "Tips för nya medlemmar" #: newmemberwidget.php:33 -msgid "Global Support Forum" +msgid "Global Support Group" msgstr "" #: newmemberwidget.php:37 -msgid "Local Support Forum" -msgstr "Lokalt hjälpforum" +msgid "Local Support Group" +msgstr "" -#: newmemberwidget.php:65 +#: newmemberwidget.php:62 msgid "Save Settings" msgstr "Spara inställningar" -#: newmemberwidget.php:66 +#: newmemberwidget.php:63 msgid "Message" msgstr "Meddelande" -#: newmemberwidget.php:66 +#: newmemberwidget.php:63 msgid "Your message for new members. You can use bbcode here." msgstr "" -#: newmemberwidget.php:67 -msgid "Add a link to global support forum" +#: newmemberwidget.php:64 +msgid "Add a link to global support group" msgstr "" -#: newmemberwidget.php:67 -msgid "Should a link to the global support forum be displayed?" +#: newmemberwidget.php:64 +msgid "Should a link to the global support group be displayed?" msgstr "" -#: newmemberwidget.php:68 -msgid "Add a link to the local support forum" +#: newmemberwidget.php:65 +msgid "Add a link to the local support group" msgstr "" -#: newmemberwidget.php:68 +#: newmemberwidget.php:65 msgid "" -"If you have a local support forum and want to have a link displayed in the " +"If you have a local support group and want to have a link displayed in the " "widget, check this box." msgstr "" -#: newmemberwidget.php:69 +#: newmemberwidget.php:66 msgid "Name of the local support group" msgstr "" -#: newmemberwidget.php:69 +#: newmemberwidget.php:66 msgid "" "If you checked the above, specify the nickname of the local support" " group here (i.e. helpers)" diff --git a/newmemberwidget/lang/sv/strings.php b/newmemberwidget/lang/sv/strings.php index 38292306..e92a428f 100644 --- a/newmemberwidget/lang/sv/strings.php +++ b/newmemberwidget/lang/sv/strings.php @@ -7,6 +7,5 @@ function string_plural_select_sv($n){ }} $a->strings['New Member'] = 'Ny medlem'; $a->strings['Tips for New Members'] = 'Tips för nya medlemmar'; -$a->strings['Local Support Forum'] = 'Lokalt hjälpforum'; $a->strings['Save Settings'] = 'Spara inställningar'; $a->strings['Message'] = 'Meddelande'; diff --git a/newmemberwidget/newmemberwidget.php b/newmemberwidget/newmemberwidget.php index 356597b7..ba7dfb39 100644 --- a/newmemberwidget/newmemberwidget.php +++ b/newmemberwidget/newmemberwidget.php @@ -6,17 +6,16 @@ * Author: Tobias Diekershoff ***/ -use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; +use Friendica\Model\User; function newmemberwidget_install() { Hook::register( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init'); - Logger::notice('newmemberwidget installed'); + DI::logger()->notice('newmemberwidget installed'); } function newmemberwidget_network_mod_init ($b) @@ -30,16 +29,16 @@ function newmemberwidget_network_mod_init ($b) $t .= '' . DI::l10n()->t('Tips for New Members') . '
'; if (DI::config()->get('newmemberwidget','linkglobalsupport', false)) { - $t .= ''.DI::l10n()->t('Global Support Forum').'
'; + $t .= '' . DI::l10n()->t('Global Support Group') . '
'; } if (DI::config()->get('newmemberwidget','linklocalsupport', false)) { - $t .= ''.DI::l10n()->t('Local Support Forum').'
'; + $t .= '' . DI::l10n()->t('Local Support Group') . '
'; } $ft = DI::config()->get('newmemberwidget','freetext', ''); if (!empty($ft)) { - $t .= '

'.BBCode::convert(trim($ft)).'

'; + $t .= '

'.BBCode::convertForUriId(User::getSystemUriId(), trim($ft)).'

'; } $t .= '
'; @@ -61,8 +60,8 @@ function newmemberwidget_addon_admin(string &$o) $o = Renderer::replaceMacros($t, [ '$submit' => DI::l10n()->t('Save Settings'), '$freetext' => ["freetext", DI::l10n()->t("Message"), DI::config()->get("newmemberwidget", "freetext"), DI::l10n()->t("Your message for new members. You can use bbcode here.")], - '$linkglobalsupport' => ["linkglobalsupport", DI::l10n()->t('Add a link to global support forum'), DI::config()->get('newmemberwidget', 'linkglobalsupport'), DI::l10n()->t('Should a link to the global support forum be displayed?')." (@helpers)"], - '$linklocalsupport' => ["linklocalsupport", DI::l10n()->t('Add a link to the local support forum'), DI::config()->get('newmemberwidget', 'linklocalsupport'), DI::l10n()->t('If you have a local support forum and want to have a link displayed in the widget, check this box.')], + '$linkglobalsupport' => ["linkglobalsupport", DI::l10n()->t('Add a link to global support group'), DI::config()->get('newmemberwidget', 'linkglobalsupport'), DI::l10n()->t('Should a link to the global support group be displayed?')." (@helpers)"], + '$linklocalsupport' => ["linklocalsupport", DI::l10n()->t('Add a link to the local support group'), DI::config()->get('newmemberwidget', 'linklocalsupport'), DI::l10n()->t('If you have a local support group and want to have a link displayed in the widget, check this box.')], '$localsupportname' => ["localsupportname", DI::l10n()->t('Name of the local support group'), DI::config()->get('newmemberwidget', 'localsupport'), DI::l10n()->t('If you checked the above, specify the nickname of the local support group here (i.e. helpers)')], ]); } diff --git a/nitter/nitter.php b/nitter/nitter.php index e9454c5d..adbfd6b0 100644 --- a/nitter/nitter.php +++ b/nitter/nitter.php @@ -4,18 +4,20 @@ * Description: Replaces links to twitter.com to a nitter server in all displays of postings on a node. * Version: 2.0 * Author: Tobias Diekershoff + * Status: Unsupported + * Note: Please use the URL Replace addon instead * * Copyright (c) 2020 Tobias Diekershoff * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and + * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and * associated documentation files (the "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to * the following conditions: - * + * * The above copyright notice and this permission notice shall be included in all copies or substantial * portions of the Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, @@ -23,7 +25,6 @@ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -use Friendica\App; use Friendica\Core\Hook; use Friendica\Core\Renderer; use Friendica\DI; @@ -49,7 +50,7 @@ function nitter_addon_admin(string &$o) $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/nitter/'); $o = Renderer::replaceMacros($t, [ '$settingdescription' => DI::l10n()->t('Which nitter server shall be used for the replacements in the post bodies? Use the URL with servername and protocol. See %s for a list of available public Nitter servers.', 'https://github.com/zedeus/nitter/wiki/Instances'), - '$nitterserver' => ['nitterserver', DI::l10n()->t('Nitter server'), $nitterserver, 'https://example.com'], + '$nitterserver' => ['nitterserver', DI::l10n()->t('Nitter server'), $nitterserver, 'https://example.com'], '$submit' => DI::l10n()->t('Save Settings'), ]); } diff --git a/nominatim/nominatim.php b/nominatim/nominatim.php index 6ad4a8a3..3a567b7b 100644 --- a/nominatim/nominatim.php +++ b/nominatim/nominatim.php @@ -6,9 +6,7 @@ * Author: Michael Vogel */ -use Friendica\App; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; @@ -46,19 +44,19 @@ function nominatim_resolve_item(array &$item) $s = DI::httpClient()->fetch('https://nominatim.openstreetmap.org/reverse?lat=' . $coords[0] . '&lon=' . $coords[1] . '&format=json&addressdetails=0&accept-language=' . $language); if (empty($s)) { - Logger::info('API could not be queried'); + DI::logger()->info('API could not be queried'); return; } $data = json_decode($s, true); if (empty($data['display_name'])) { - Logger::info('No results found for coordinates', ['coordinates' => $item['coord'], 'data' => $data]); + DI::logger()->info('No results found for coordinates', ['coordinates' => $item['coord'], 'data' => $data]); return; } $item['location'] = $data['display_name']; - Logger::info('Got location', ['lat' => $coords[0], 'long' => $coords[1], 'location' => $item['location']]); + DI::logger()->info('Got location', ['lat' => $coords[0], 'long' => $coords[1], 'location' => $item['location']]); if (!empty($item['location'])) { DI::cache()->set('nominatim:' . $language . ':' . $coords[0] . '-' . $coords[1], $item['location']); diff --git a/notifyall/NotifyAllEmail.php b/notifyall/NotifyAllEmail.php index 3bb16f27..7a00a2c9 100644 --- a/notifyall/NotifyAllEmail.php +++ b/notifyall/NotifyAllEmail.php @@ -25,6 +25,7 @@ use Friendica\App\BaseURL; use Friendica\Content\Text\BBCode; use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\L10n; +use Friendica\Model\User; use Friendica\Object\Email; /** @@ -50,9 +51,9 @@ class NotifyAllEmail extends Email $subject = $_REQUEST['subject']; - $textversion = strip_tags(html_entity_decode(BBCode::convert(stripslashes(str_replace(["\\r", "\\n"], ["", "\n"], $text))), ENT_QUOTES, 'UTF-8')); + $textversion = strip_tags(html_entity_decode(BBCode::convertForUriId(User::getSystemUriId(), stripslashes(str_replace(["\\r", "\\n"], ["", "\n"], $text))), ENT_QUOTES, 'UTF-8')); - $htmlversion = BBCode::convert(stripslashes(str_replace(["\\r", "\\n"], ["", "
\n"], $text))); + $htmlversion = BBCode::convertForUriId(User::getSystemUriId(), stripslashes(str_replace(["\\r", "\\n"], ["", "
\n"], $text))); parent::__construct($sender_name, $sender_email, $sender_email, '', $subject, $htmlversion, $textversion); } diff --git a/notifyall/lang/bg/messages.po b/notifyall/lang/bg/messages.po new file mode 100644 index 00000000..fcb0ddec --- /dev/null +++ b/notifyall/lang/bg/messages.po @@ -0,0 +1,56 @@ +# ADDON notifyall +# Copyright (C) +# This file is distributed under the same license as the Friendica notifyall addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2016-08-14 19:29+0000\n" +"Language-Team: Bulgarian (https://app.transifex.com/Friendica/teams/12172/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: NotifyAllEmail.php:40 +#, php-format +msgid "%s Administrator" +msgstr "" + +#: NotifyAllEmail.php:42 +#, php-format +msgid "%1$s, %2$s Administrator" +msgstr "" + +#: notifyall.php:22 +msgid "Send email to all members" +msgstr "" + +#: notifyall.php:49 +msgid "No recipients found." +msgstr "" + +#: notifyall.php:59 +msgid "Emails sent" +msgstr "" + +#: notifyall.php:69 +msgid "Send email to all members of this Friendica instance." +msgstr "" + +#: notifyall.php:74 +msgid "Message subject" +msgstr "" + +#: notifyall.php:75 +msgid "Test mode (only send to administrator)" +msgstr "" + +#: notifyall.php:76 +msgid "Submit" +msgstr "" diff --git a/notifyall/lang/bg/strings.php b/notifyall/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/notifyall/lang/bg/strings.php @@ -0,0 +1,7 @@ +strings['Submit'] = 'Saada'; diff --git a/notifyall/lang/gd/messages.po b/notifyall/lang/gd/messages.po new file mode 100644 index 00000000..e4b216b4 --- /dev/null +++ b/notifyall/lang/gd/messages.po @@ -0,0 +1,56 @@ +# ADDON notifyall +# Copyright (C) +# This file is distributed under the same license as the Friendica notifyall addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2016-08-14 19:29+0000\n" +"Language-Team: Gaelic, Scottish (https://app.transifex.com/Friendica/teams/12172/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: NotifyAllEmail.php:40 +#, php-format +msgid "%s Administrator" +msgstr "" + +#: NotifyAllEmail.php:42 +#, php-format +msgid "%1$s, %2$s Administrator" +msgstr "" + +#: notifyall.php:22 +msgid "Send email to all members" +msgstr "" + +#: notifyall.php:49 +msgid "No recipients found." +msgstr "" + +#: notifyall.php:59 +msgid "Emails sent" +msgstr "" + +#: notifyall.php:69 +msgid "Send email to all members of this Friendica instance." +msgstr "" + +#: notifyall.php:74 +msgid "Message subject" +msgstr "" + +#: notifyall.php:75 +msgid "Test mode (only send to administrator)" +msgstr "" + +#: notifyall.php:76 +msgid "Submit" +msgstr "" diff --git a/notifyall/lang/gd/strings.php b/notifyall/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/notifyall/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/notifyall/lang/is/messages.po b/notifyall/lang/is/messages.po new file mode 100644 index 00000000..bfe6c822 --- /dev/null +++ b/notifyall/lang/is/messages.po @@ -0,0 +1,56 @@ +# ADDON notifyall +# Copyright (C) +# This file is distributed under the same license as the Friendica notifyall addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2016-08-14 19:29+0000\n" +"Language-Team: Icelandic (https://app.transifex.com/Friendica/teams/12172/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: NotifyAllEmail.php:40 +#, php-format +msgid "%s Administrator" +msgstr "" + +#: NotifyAllEmail.php:42 +#, php-format +msgid "%1$s, %2$s Administrator" +msgstr "" + +#: notifyall.php:22 +msgid "Send email to all members" +msgstr "" + +#: notifyall.php:49 +msgid "No recipients found." +msgstr "" + +#: notifyall.php:59 +msgid "Emails sent" +msgstr "" + +#: notifyall.php:69 +msgid "Send email to all members of this Friendica instance." +msgstr "" + +#: notifyall.php:74 +msgid "Message subject" +msgstr "" + +#: notifyall.php:75 +msgid "Test mode (only send to administrator)" +msgstr "" + +#: notifyall.php:76 +msgid "Submit" +msgstr "" diff --git a/notifyall/lang/is/strings.php b/notifyall/lang/is/strings.php new file mode 100644 index 00000000..975c341e --- /dev/null +++ b/notifyall/lang/is/strings.php @@ -0,0 +1,7 @@ +send($notifyEmail->withRecipient($recipient['email'])); } diff --git a/nsfw/lang/bg/messages.po b/nsfw/lang/bg/messages.po new file mode 100644 index 00000000..e53d0c5f --- /dev/null +++ b/nsfw/lang/bg/messages.po @@ -0,0 +1,60 @@ +# ADDON nsfw +# Copyright (C) +# This file is distributed under the same license as the Friendica nsfw addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-12-10 14:42-0500\n" +"PO-Revision-Date: 2014-06-23 10:34+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: nsfw.php:65 +msgid "" +"This addon searches for specified words/text in posts and collapses them. It" +" can be used to filter content tagged with for instance #NSFW that may be " +"deemed inappropriate at certain times or places, such as being at work. It " +"is also useful for hiding irrelevant or annoying content from direct view." +msgstr "" + +#: nsfw.php:66 +msgid "Enable Content filter" +msgstr "" + +#: nsfw.php:67 +msgid "Comma separated list of keywords to hide" +msgstr "" + +#: nsfw.php:67 +msgid "" +"Use /expression/ to provide regular expressions, #tag to specfically match " +"hashtags (case-insensitive), or regular words (case-sensitive)" +msgstr "" + +#: nsfw.php:72 +msgid "Content Filter (NSFW and more)" +msgstr "" + +#: nsfw.php:96 +#, php-format +msgid "Regular expression \"%s\" fails to compile" +msgstr "" + +#: nsfw.php:154 +#, php-format +msgid "Filtered tag: %s" +msgstr "" + +#: nsfw.php:156 +#, php-format +msgid "Filtered word: %s" +msgstr "" diff --git a/nsfw/lang/bg/strings.php b/nsfw/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/nsfw/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: nsfw.php:65 +msgid "" +"This addon searches for specified words/text in posts and collapses them. It" +" can be used to filter content tagged with for instance #NSFW that may be " +"deemed inappropriate at certain times or places, such as being at work. It " +"is also useful for hiding irrelevant or annoying content from direct view." +msgstr "" + +#: nsfw.php:66 +msgid "Enable Content filter" +msgstr "" + +#: nsfw.php:67 +msgid "Comma separated list of keywords to hide" +msgstr "" + +#: nsfw.php:67 +msgid "" +"Use /expression/ to provide regular expressions, #tag to specfically match " +"hashtags (case-insensitive), or regular words (case-sensitive)" +msgstr "" + +#: nsfw.php:72 +msgid "Content Filter (NSFW and more)" +msgstr "" + +#: nsfw.php:96 +#, php-format +msgid "Regular expression \"%s\" fails to compile" +msgstr "" + +#: nsfw.php:154 +#, php-format +msgid "Filtered tag: %s" +msgstr "" + +#: nsfw.php:156 +#, php-format +msgid "Filtered word: %s" +msgstr "" diff --git a/nsfw/lang/ca/strings.php b/nsfw/lang/ca/strings.php index 349ffefd..d34874f6 100644 --- a/nsfw/lang/ca/strings.php +++ b/nsfw/lang/ca/strings.php @@ -1,10 +1,7 @@ -strings["Not Safe For Work (General Purpose Content Filter) settings"] = "Ajustos, Not Safe For Work (Filtre de Contingut de Propòsit General)"; -$a->strings["This addon looks in posts for the words/text you specify below, and collapses any content containing those keywords so it is not displayed at inappropriate times, such as sexual innuendo that may be improper in a work setting. It is polite and recommended to tag any content containing nudity with #NSFW. This filter can also match any other word/text you specify, and can thereby be used as a general purpose content filter."] = "Aquest addon es veu en enviaments amb les paraules/text que s'especifiquen a continuació , i amagarà qualsevol contingut que contingui les paraules clau de manera que no apareguin en moments inapropiats, com ara insinuacions sexuals que poden ser inadequades en un entorn de treball. És de bona educació i es recomana etiquetar qualsevol contingut que contingui nus amb #NSFW. Aquest filtre també es pot fer coincidir amb qualsevol paraula/text que especifiqueu, i per tant pot ser utilitzat com un filtre general de contingut."; -$a->strings["Enable Content filter"] = "Activat el filtre de Contingut"; -$a->strings["Comma separated list of keywords to hide"] = "Llista separada per comes de paraules clau per ocultar"; -$a->strings["Submit"] = "Enviar"; -$a->strings["Use /expression/ to provide regular expressions"] = "Emprar /expressió/ per a proporcionar expressions regulars"; -$a->strings["NSFW Settings saved."] = "Configuració NSFW guardada."; -$a->strings["%s - Click to open/close"] = "%s - Clicar per obrir/tancar"; +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: nsfw.php:65 +msgid "" +"This addon searches for specified words/text in posts and collapses them. It" +" can be used to filter content tagged with for instance #NSFW that may be " +"deemed inappropriate at certain times or places, such as being at work. It " +"is also useful for hiding irrelevant or annoying content from direct view." +msgstr "" + +#: nsfw.php:66 +msgid "Enable Content filter" +msgstr "" + +#: nsfw.php:67 +msgid "Comma separated list of keywords to hide" +msgstr "" + +#: nsfw.php:67 +msgid "" +"Use /expression/ to provide regular expressions, #tag to specfically match " +"hashtags (case-insensitive), or regular words (case-sensitive)" +msgstr "" + +#: nsfw.php:72 +msgid "Content Filter (NSFW and more)" +msgstr "" + +#: nsfw.php:96 +#, php-format +msgid "Regular expression \"%s\" fails to compile" +msgstr "" + +#: nsfw.php:154 +#, php-format +msgid "Filtered tag: %s" +msgstr "" + +#: nsfw.php:156 +#, php-format +msgid "Filtered word: %s" +msgstr "" diff --git a/nsfw/lang/eo/strings.php b/nsfw/lang/eo/strings.php index 13da052a..68e8a64c 100644 --- a/nsfw/lang/eo/strings.php +++ b/nsfw/lang/eo/strings.php @@ -1,10 +1,7 @@ -strings["Not Safe For Work (General Purpose Content Filter) settings"] = "Not Safe For Work (ĝenerala filtrilo por enhavoj) agordoj"; -$a->strings["This addon looks in posts for the words/text you specify below, and collapses any content containing those keywords so it is not displayed at inappropriate times, such as sexual innuendo that may be improper in a work setting. It is polite and recommended to tag any content containing nudity with #NSFW. This filter can also match any other word/text you specify, and can thereby be used as a general purpose content filter."] = "Tiu kromprogramo serĉas la malsupre agordatajn vortojn en afiŝoj kaj malvidebligis ilin se ili enhavas iun vorton. Tiel, afiŝoj ne montriĝis kiuj enhavas maladekvatan enhavon, ekzemple seksumaj aferoj, kiuj ne estas adekvata, ekzemple en la laborejo. En la reto, oni kutime markas tiajn afiŝojn #NSFW - Not Safe For Work - ne adekvata por la laborejo. La filtrilo ankaŭ serĉas ĉiujn vortojn kiujn vi agordas kaj tial funkcias kiel ĝenerala filtrilo."; -$a->strings["Enable Content filter"] = "Ŝalti la filtrilo por la enhavo"; -$a->strings["Comma separated list of keywords to hide"] = "Perkome disigita listo da kaŝontaj ŝlosilvortoj"; -$a->strings["Submit"] = "Sendi"; -$a->strings["Use /expression/ to provide regular expressions"] = "Uzu /expr/ por provizi regulajn esprimojn."; -$a->strings["NSFW Settings saved."] = "NSFW agordoj konservitaj."; -$a->strings["%s - Click to open/close"] = "%s - Klaku por malfermi/fermi"; +\n" +"Language-Team: Estonian (http://app.transifex.com/Friendica/friendica/language/et/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: et\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: nsfw.php:65 +msgid "" +"This addon searches for specified words/text in posts and collapses them. It" +" can be used to filter content tagged with for instance #NSFW that may be " +"deemed inappropriate at certain times or places, such as being at work. It " +"is also useful for hiding irrelevant or annoying content from direct view." +msgstr "" + +#: nsfw.php:66 +msgid "Enable Content filter" +msgstr "" + +#: nsfw.php:67 +msgid "Comma separated list of keywords to hide" +msgstr "" + +#: nsfw.php:67 +msgid "" +"Use /expression/ to provide regular expressions, #tag to specfically match " +"hashtags (case-insensitive), or regular words (case-sensitive)" +msgstr "" + +#: nsfw.php:72 +msgid "Content Filter (NSFW and more)" +msgstr "" + +#: nsfw.php:96 +#, php-format +msgid "Regular expression \"%s\" fails to compile" +msgstr "" + +#: nsfw.php:154 +#, php-format +msgid "Filtered tag: %s" +msgstr "" + +#: nsfw.php:156 +#, php-format +msgid "Filtered word: %s" +msgstr "" diff --git a/nsfw/lang/et/strings.php b/nsfw/lang/et/strings.php new file mode 100644 index 00000000..dfe78358 --- /dev/null +++ b/nsfw/lang/et/strings.php @@ -0,0 +1,7 @@ +, 2015 # Vincent Vindarel , 2018 @@ -13,7 +14,7 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2022-12-10 14:42-0500\n" "PO-Revision-Date: 2014-06-23 10:34+0000\n" -"Last-Translator: Nicolas Derive, 2022-2023\n" +"Last-Translator: cracrayol, 2023-2024\n" "Language-Team: French (http://app.transifex.com/Friendica/friendica/language/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -41,7 +42,7 @@ msgstr "Liste de mots-clés - séparés par des virgules - à cacher" msgid "" "Use /expression/ to provide regular expressions, #tag to specfically match " "hashtags (case-insensitive), or regular words (case-sensitive)" -msgstr "Utiliser /expression/ pour fournir des expressions régulières, #tag pour correspondre à un mot-dièse (hashtag, insensible à la casse), ou des mots classiques (sensible à la casse)" +msgstr "Utiliser /expression/ pour fournir des expressions régulières, #etiquette pour correspondre à une étiquette (insensible à la casse), ou des mots classiques (sensible à la casse)" #: nsfw.php:72 msgid "Content Filter (NSFW and more)" @@ -55,7 +56,7 @@ msgstr "La compilation de l'expression régulière \"%s\" a échoué" #: nsfw.php:154 #, php-format msgid "Filtered tag: %s" -msgstr "Tag filtré: %s" +msgstr "Tag filtré : %s" #: nsfw.php:156 #, php-format diff --git a/nsfw/lang/fr/strings.php b/nsfw/lang/fr/strings.php index ee3734ec..0f717797 100644 --- a/nsfw/lang/fr/strings.php +++ b/nsfw/lang/fr/strings.php @@ -8,8 +8,8 @@ function string_plural_select_fr($n){ $a->strings['This addon searches for specified words/text in posts and collapses them. It can be used to filter content tagged with for instance #NSFW that may be deemed inappropriate at certain times or places, such as being at work. It is also useful for hiding irrelevant or annoying content from direct view.'] = 'Cette extension recherche des mots/textes spécifiés dans les publications et les masque. Elle peut être utilisée pour filtrer le contenu étiqueté par exemple avec #NSFW qui peut être considéré comme inapproprié à certains moments ou endroits, comme par exemple au travail. Elle est aussi utile pour cacher du contenu non pertinent ou ennuyeux d\'une vue directe.'; $a->strings['Enable Content filter'] = 'Activer le filtrage de contenu'; $a->strings['Comma separated list of keywords to hide'] = 'Liste de mots-clés - séparés par des virgules - à cacher'; -$a->strings['Use /expression/ to provide regular expressions, #tag to specfically match hashtags (case-insensitive), or regular words (case-sensitive)'] = 'Utiliser /expression/ pour fournir des expressions régulières, #tag pour correspondre à un mot-dièse (hashtag, insensible à la casse), ou des mots classiques (sensible à la casse)'; +$a->strings['Use /expression/ to provide regular expressions, #tag to specfically match hashtags (case-insensitive), or regular words (case-sensitive)'] = 'Utiliser /expression/ pour fournir des expressions régulières, #etiquette pour correspondre à une étiquette (insensible à la casse), ou des mots classiques (sensible à la casse)'; $a->strings['Content Filter (NSFW and more)'] = 'Filtre de contenu (NSFW et autres)'; $a->strings['Regular expression "%s" fails to compile'] = 'La compilation de l\'expression régulière "%s" a échoué'; -$a->strings['Filtered tag: %s'] = 'Tag filtré: %s'; +$a->strings['Filtered tag: %s'] = 'Tag filtré : %s'; $a->strings['Filtered word: %s'] = 'Mot filtré: %s'; diff --git a/nsfw/lang/gd/messages.po b/nsfw/lang/gd/messages.po new file mode 100644 index 00000000..a6f6691e --- /dev/null +++ b/nsfw/lang/gd/messages.po @@ -0,0 +1,60 @@ +# ADDON nsfw +# Copyright (C) +# This file is distributed under the same license as the Friendica nsfw addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-12-10 14:42-0500\n" +"PO-Revision-Date: 2014-06-23 10:34+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: nsfw.php:65 +msgid "" +"This addon searches for specified words/text in posts and collapses them. It" +" can be used to filter content tagged with for instance #NSFW that may be " +"deemed inappropriate at certain times or places, such as being at work. It " +"is also useful for hiding irrelevant or annoying content from direct view." +msgstr "" + +#: nsfw.php:66 +msgid "Enable Content filter" +msgstr "" + +#: nsfw.php:67 +msgid "Comma separated list of keywords to hide" +msgstr "" + +#: nsfw.php:67 +msgid "" +"Use /expression/ to provide regular expressions, #tag to specfically match " +"hashtags (case-insensitive), or regular words (case-sensitive)" +msgstr "" + +#: nsfw.php:72 +msgid "Content Filter (NSFW and more)" +msgstr "" + +#: nsfw.php:96 +#, php-format +msgid "Regular expression \"%s\" fails to compile" +msgstr "" + +#: nsfw.php:154 +#, php-format +msgid "Filtered tag: %s" +msgstr "" + +#: nsfw.php:156 +#, php-format +msgid "Filtered word: %s" +msgstr "" diff --git a/nsfw/lang/gd/strings.php b/nsfw/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/nsfw/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/nsfw/lang/is/messages.po b/nsfw/lang/is/messages.po new file mode 100644 index 00000000..56c26ced --- /dev/null +++ b/nsfw/lang/is/messages.po @@ -0,0 +1,60 @@ +# ADDON nsfw +# Copyright (C) +# This file is distributed under the same license as the Friendica nsfw addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2022-12-10 14:42-0500\n" +"PO-Revision-Date: 2014-06-23 10:34+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: nsfw.php:65 +msgid "" +"This addon searches for specified words/text in posts and collapses them. It" +" can be used to filter content tagged with for instance #NSFW that may be " +"deemed inappropriate at certain times or places, such as being at work. It " +"is also useful for hiding irrelevant or annoying content from direct view." +msgstr "" + +#: nsfw.php:66 +msgid "Enable Content filter" +msgstr "" + +#: nsfw.php:67 +msgid "Comma separated list of keywords to hide" +msgstr "" + +#: nsfw.php:67 +msgid "" +"Use /expression/ to provide regular expressions, #tag to specfically match " +"hashtags (case-insensitive), or regular words (case-sensitive)" +msgstr "" + +#: nsfw.php:72 +msgid "Content Filter (NSFW and more)" +msgstr "" + +#: nsfw.php:96 +#, php-format +msgid "Regular expression \"%s\" fails to compile" +msgstr "" + +#: nsfw.php:154 +#, php-format +msgid "Filtered tag: %s" +msgstr "" + +#: nsfw.php:156 +#, php-format +msgid "Filtered word: %s" +msgstr "" diff --git a/nsfw/lang/is/strings.php b/nsfw/lang/is/strings.php index 534f19c2..975c341e 100644 --- a/nsfw/lang/is/strings.php +++ b/nsfw/lang/is/strings.php @@ -1,10 +1,7 @@ -strings["Not Safe For Work (General Purpose Content Filter) settings"] = ""; -$a->strings["This addon looks in posts for the words/text you specify below, and collapses any content containing those keywords so it is not displayed at inappropriate times, such as sexual innuendo that may be improper in a work setting. It is polite and recommended to tag any content containing nudity with #NSFW. This filter can also match any other word/text you specify, and can thereby be used as a general purpose content filter."] = ""; -$a->strings["Enable Content filter"] = ""; -$a->strings["Comma separated list of keywords to hide"] = ""; -$a->strings["Submit"] = "Senda inn"; -$a->strings["Use /expression/ to provide regular expressions"] = ""; -$a->strings["NSFW Settings saved."] = "NSFW stillingar vistað."; -$a->strings["%s - Click to open/close"] = "%s - Smelltu til að opna/loka"; +, 2022 +# Bartosz Kozień, 2025 +# Piotr Strebski , 2022 # Waldemar Stoczkowski, 2018 msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-11-18 11:57-0500\n" +"POT-Creation-Date: 2022-12-10 14:42-0500\n" "PO-Revision-Date: 2014-06-23 10:34+0000\n" -"Last-Translator: Piotr Strębski , 2022\n" -"Language-Team: Polish (http://www.transifex.com/Friendica/friendica/language/pl/)\n" +"Last-Translator: Bartosz Kozień, 2025\n" +"Language-Team: Polish (http://app.transifex.com/Friendica/friendica/language/pl/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -40,18 +41,23 @@ msgstr "Rozdzielana przecinkami lista słów kluczowych do ukrycia" msgid "" "Use /expression/ to provide regular expressions, #tag to specfically match " "hashtags (case-insensitive), or regular words (case-sensitive)" -msgstr "" +msgstr "Użyj /wyrażenie/ dla wyrażenia regularnego, #tag by dopasować konkretne tagi (bez rozróżniania wielkości liter), lub zwykłych słów (z rozróżnianiem wielkości liter)" #: nsfw.php:72 msgid "Content Filter (NSFW and more)" msgstr "Filtr zawartości (NSFW i więcej)" -#: nsfw.php:140 +#: nsfw.php:96 +#, php-format +msgid "Regular expression \"%s\" fails to compile" +msgstr "Błąd kompilacji wyrażenia regularnego \"%s\"" + +#: nsfw.php:154 #, php-format msgid "Filtered tag: %s" msgstr "Filtrowane znaczników: %s" -#: nsfw.php:142 +#: nsfw.php:156 #, php-format msgid "Filtered word: %s" msgstr "Filtrowane słowo: %s" diff --git a/nsfw/lang/pl/strings.php b/nsfw/lang/pl/strings.php index 3fc65a76..6e6124f6 100644 --- a/nsfw/lang/pl/strings.php +++ b/nsfw/lang/pl/strings.php @@ -8,6 +8,8 @@ function string_plural_select_pl($n){ $a->strings['This addon searches for specified words/text in posts and collapses them. It can be used to filter content tagged with for instance #NSFW that may be deemed inappropriate at certain times or places, such as being at work. It is also useful for hiding irrelevant or annoying content from direct view.'] = 'Ten dodatek szuka określonych słów/tekstów w postach i zwija je. Może służyć do filtrowania treści oznaczonych np. NSFW, które mogą zostać uznane za nieodpowiednie w określonych momentach lub miejscach, na przykład w pracy. Jest to również przydatne do ukrywania nieistotnych lub irytujących treści z bezpośredniego widoku.'; $a->strings['Enable Content filter'] = 'Włącz filtr treści'; $a->strings['Comma separated list of keywords to hide'] = 'Rozdzielana przecinkami lista słów kluczowych do ukrycia'; +$a->strings['Use /expression/ to provide regular expressions, #tag to specfically match hashtags (case-insensitive), or regular words (case-sensitive)'] = 'Użyj /wyrażenie/ dla wyrażenia regularnego, #tag by dopasować konkretne tagi (bez rozróżniania wielkości liter), lub zwykłych słów (z rozróżnianiem wielkości liter)'; $a->strings['Content Filter (NSFW and more)'] = 'Filtr zawartości (NSFW i więcej)'; +$a->strings['Regular expression "%s" fails to compile'] = 'Błąd kompilacji wyrażenia regularnego "%s"'; $a->strings['Filtered tag: %s'] = 'Filtrowane znaczników: %s'; $a->strings['Filtered word: %s'] = 'Filtrowane słowo: %s'; diff --git a/nsfw/nsfw.php b/nsfw/nsfw.php index 2c8235dd..37d34d7d 100644 --- a/nsfw/nsfw.php +++ b/nsfw/nsfw.php @@ -8,7 +8,6 @@ * */ -use Friendica\App; use Friendica\Core\Hook; use Friendica\Core\Renderer; use Friendica\DI; @@ -88,7 +87,7 @@ function nsfw_addon_settings_post(array &$b) $word_list = explode(',', $words); foreach ($word_list as $word) { $word = trim($word); - if (!$words || $word[0] != '/') { + if (!$words || strpos($word, '/') !== 0) { continue; } @@ -105,12 +104,13 @@ function nsfw_addon_settings_post(array &$b) function nsfw_prepare_body_content_filter(&$hook_data) { $words = null; - if (DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'nsfw', 'disable')) { + $uid = $hook_data['uid'] ?? DI::userSession()->getLocalUserId(); + if (DI::pConfig()->get($uid, 'nsfw', 'disable')) { return; } - if (DI::userSession()->getLocalUserId()) { - $words = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'nsfw', 'words'); + if ($uid) { + $words = DI::pConfig()->get($uid, 'nsfw', 'words'); } if ($words) { @@ -119,7 +119,9 @@ function nsfw_prepare_body_content_filter(&$hook_data) $word_list = ['nsfw']; } - $found = false; + $found = false; + $tag_search = false; + if (count($word_list)) { $body = $hook_data['item']['title'] . "\n" . nsfw_extract_photos($hook_data['item']['body']); @@ -129,17 +131,16 @@ function nsfw_prepare_body_content_filter(&$hook_data) continue; } - $tag_search = false; switch ($word[0]) { case '/'; // Regular expression $found = @preg_match($word, $body); break; case '#': // Hashtag-only search $tag_search = true; - $found = nsfw_find_word_in_item_tags($hook_data['item']['hashtags'], substr($word, 1)); + $found = nsfw_find_word_in_item_tags($hook_data['item']['hashtags'] ?? [], substr($word, 1)); break; default: - $found = strpos($body, $word) !== false || nsfw_find_word_in_item_tags($hook_data['item']['tags'], $word); + $found = strpos($body, $word) !== false || nsfw_find_word_in_item_tags($hook_data['item']['tags'] ?? [], $word); break; } diff --git a/numfriends/lang/bg/messages.po b/numfriends/lang/bg/messages.po new file mode 100644 index 00000000..19f86de0 --- /dev/null +++ b/numfriends/lang/bg/messages.po @@ -0,0 +1,27 @@ +# ADDON numfriends +# Copyright (C) +# This file is distributed under the same license as the Friendica numfriends addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:15-0500\n" +"PO-Revision-Date: 2014-06-23 10:58+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: numfriends.php:55 +msgid "How many contacts to display on profile sidebar" +msgstr "" + +#: numfriends.php:60 +msgid "Numfriends Settings" +msgstr "" diff --git a/numfriends/lang/bg/strings.php b/numfriends/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/numfriends/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: numfriends.php:55 +msgid "How many contacts to display on profile sidebar" +msgstr "" + +#: numfriends.php:60 +msgid "Numfriends Settings" +msgstr "" diff --git a/numfriends/lang/ca/strings.php b/numfriends/lang/ca/strings.php index 6e4bea3c..d34874f6 100644 --- a/numfriends/lang/ca/strings.php +++ b/numfriends/lang/ca/strings.php @@ -1,6 +1,7 @@ -strings["Numfriends settings updated."] = "Actualitzar la configuració de Numfriends."; -$a->strings["Numfriends Settings"] = "Configuració de Numfriends"; -$a->strings["How many contacts to display on profile sidebar"] = "Quants contactes per mostrar a la barra lateral el perfil"; -$a->strings["Submit"] = "Enviar"; +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: numfriends.php:55 +msgid "How many contacts to display on profile sidebar" +msgstr "" + +#: numfriends.php:60 +msgid "Numfriends Settings" +msgstr "" diff --git a/numfriends/lang/eo/strings.php b/numfriends/lang/eo/strings.php index 6ad728c1..68e8a64c 100644 --- a/numfriends/lang/eo/strings.php +++ b/numfriends/lang/eo/strings.php @@ -1,6 +1,7 @@ -strings["Numfriends settings updated."] = "Ĝisdatigis agordojn por Numfriends."; -$a->strings["Numfriends Settings"] = "Agordoj por Numfriends"; -$a->strings["How many contacts to display on profile sidebar"] = "Kiom da kontaktoj mi montru en la flanka strio"; -$a->strings["Submit"] = "Sendi"; +\n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: numfriends.php:55 +msgid "How many contacts to display on profile sidebar" +msgstr "" + +#: numfriends.php:60 +msgid "Numfriends Settings" +msgstr "" diff --git a/numfriends/lang/gd/strings.php b/numfriends/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/numfriends/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/numfriends/lang/is/messages.po b/numfriends/lang/is/messages.po new file mode 100644 index 00000000..3fb035b4 --- /dev/null +++ b/numfriends/lang/is/messages.po @@ -0,0 +1,27 @@ +# ADDON numfriends +# Copyright (C) +# This file is distributed under the same license as the Friendica numfriends addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:15-0500\n" +"PO-Revision-Date: 2014-06-23 10:58+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: numfriends.php:55 +msgid "How many contacts to display on profile sidebar" +msgstr "" + +#: numfriends.php:60 +msgid "Numfriends Settings" +msgstr "" diff --git a/numfriends/lang/is/strings.php b/numfriends/lang/is/strings.php index ea23b9d5..975c341e 100644 --- a/numfriends/lang/is/strings.php +++ b/numfriends/lang/is/strings.php @@ -1,6 +1,7 @@ -strings["Numfriends settings updated."] = ""; -$a->strings["Numfriends Settings"] = ""; -$a->strings["How many contacts to display on profile sidebar"] = ""; -$a->strings["Submit"] = "Senda inn"; + */ -use Friendica\App; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; @@ -17,7 +15,7 @@ function numfriends_install() { Hook::register('addon_settings', 'addon/numfriends/numfriends.php', 'numfriends_settings'); Hook::register('addon_settings_post', 'addon/numfriends/numfriends.php', 'numfriends_settings_post'); - Logger::notice("installed numfriends"); + DI::logger()->notice("installed numfriends"); } /** @@ -39,7 +37,7 @@ function numfriends_settings_post($post) { /** * - * Called from the Addon Setting form. + * Called from the Addon Setting form. * Add our own settings info to the page. * */ @@ -50,7 +48,7 @@ function numfriends_settings(array &$data) } $numfriends = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'system', 'display_friend_count', 24); - + $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/numfriends/'); $html = Renderer::replaceMacros($t, [ '$numfriends' => ['numfriends', DI::l10n()->t('How many contacts to display on profile sidebar'), $numfriends], diff --git a/openstreetmap/config/openstreetmap.config.php b/openstreetmap/config/openstreetmap.config.php index c649da5f..d633fd26 100644 --- a/openstreetmap/config/openstreetmap.config.php +++ b/openstreetmap/config/openstreetmap.config.php @@ -10,7 +10,7 @@ return [ 'tmsserver' => 'https://www.openstreetmap.org', // nomserver (String) - 'nomserver' => 'https://nominatim.openstreetmap.org/search.php', + 'nomserver' => 'https://nominatim.openstreetmap.org/search', // zoom (Integer) // The default zoom level on the map. diff --git a/openstreetmap/lang/bg/messages.po b/openstreetmap/lang/bg/messages.po new file mode 100644 index 00000000..e04a56f5 --- /dev/null +++ b/openstreetmap/lang/bg/messages.po @@ -0,0 +1,64 @@ +# ADDON openstreetmap +# Copyright (C) +# This file is distributed under the same license as the Friendica openstreetmap addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2014-06-23 11:01+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: openstreetmap.php:167 +msgid "View Larger" +msgstr "" + +#: openstreetmap.php:194 +msgid "Submit" +msgstr "" + +#: openstreetmap.php:195 +msgid "Tile Server URL" +msgstr "" + +#: openstreetmap.php:195 +msgid "" +"A list of public tile servers" +msgstr "" + +#: openstreetmap.php:196 +msgid "Nominatim (reverse geocoding) Server URL" +msgstr "" + +#: openstreetmap.php:196 +msgid "" +"A list of Nominatim servers" +msgstr "" + +#: openstreetmap.php:197 +msgid "Default zoom" +msgstr "" + +#: openstreetmap.php:197 +msgid "" +"The default zoom level. (1:world, 18:highest, also depends on tile server)" +msgstr "" + +#: openstreetmap.php:198 +msgid "Include marker on map" +msgstr "" + +#: openstreetmap.php:198 +msgid "Include a marker on the map." +msgstr "" diff --git a/openstreetmap/lang/bg/strings.php b/openstreetmap/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/openstreetmap/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: openstreetmap.php:167 +msgid "View Larger" +msgstr "" + +#: openstreetmap.php:194 +msgid "Submit" +msgstr "" + +#: openstreetmap.php:195 +msgid "Tile Server URL" +msgstr "" + +#: openstreetmap.php:195 +msgid "" +"A list of public tile servers" +msgstr "" + +#: openstreetmap.php:196 +msgid "Nominatim (reverse geocoding) Server URL" +msgstr "" + +#: openstreetmap.php:196 +msgid "" +"A list of Nominatim servers" +msgstr "" + +#: openstreetmap.php:197 +msgid "Default zoom" +msgstr "" + +#: openstreetmap.php:197 +msgid "" +"The default zoom level. (1:world, 18:highest, also depends on tile server)" +msgstr "" + +#: openstreetmap.php:198 +msgid "Include marker on map" +msgstr "" + +#: openstreetmap.php:198 +msgid "Include a marker on the map." +msgstr "" diff --git a/openstreetmap/lang/ca/strings.php b/openstreetmap/lang/ca/strings.php index 3c7eeee2..d34874f6 100644 --- a/openstreetmap/lang/ca/strings.php +++ b/openstreetmap/lang/ca/strings.php @@ -1,8 +1,7 @@ -strings["Submit"] = "Enviar"; -$a->strings["Tile Server URL"] = "URL del servidor, del mosaico de servidores"; -$a->strings["A list of public tile servers"] = "Una llista de un mosaic de servidors públics"; -$a->strings["Default zoom"] = "Zoom per defecte"; -$a->strings["The default zoom level. (1:world, 18:highest)"] = "Nivell de zoom per defecte. (1: el món, 18: el més alt)"; -$a->strings["Settings updated."] = "Ajustos actualitzats."; +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: openstreetmap.php:167 +msgid "View Larger" +msgstr "" + +#: openstreetmap.php:194 +msgid "Submit" +msgstr "" + +#: openstreetmap.php:195 +msgid "Tile Server URL" +msgstr "" + +#: openstreetmap.php:195 +msgid "" +"A list of public tile servers" +msgstr "" + +#: openstreetmap.php:196 +msgid "Nominatim (reverse geocoding) Server URL" +msgstr "" + +#: openstreetmap.php:196 +msgid "" +"A list of Nominatim servers" +msgstr "" + +#: openstreetmap.php:197 +msgid "Default zoom" +msgstr "" + +#: openstreetmap.php:197 +msgid "" +"The default zoom level. (1:world, 18:highest, also depends on tile server)" +msgstr "" + +#: openstreetmap.php:198 +msgid "Include marker on map" +msgstr "" + +#: openstreetmap.php:198 +msgid "Include a marker on the map." +msgstr "" diff --git a/openstreetmap/lang/eo/strings.php b/openstreetmap/lang/eo/strings.php index 5f256dd6..68e8a64c 100644 --- a/openstreetmap/lang/eo/strings.php +++ b/openstreetmap/lang/eo/strings.php @@ -1,8 +1,7 @@ -strings["Submit"] = "Sendi"; -$a->strings["Tile Server URL"] = "Adreso de Kahelservilo"; -$a->strings["A list of public tile servers"] = "Listo de publikaj kahelserviloj"; -$a->strings["Default zoom"] = "Defaŭlta zoma faktoro"; -$a->strings["The default zoom level. (1:world, 18:highest)"] = "La defaŭlta zoma faktoro. (1:tutmonda, 18:plej proksima)"; -$a->strings["Settings updated."] = "Agordoj ĝisdatigita."; +public tile servers" +msgstr "" + +#: openstreetmap.php:196 +msgid "Nominatim (reverse geocoding) Server URL" +msgstr "" + +#: openstreetmap.php:196 +msgid "" +"A list of Nominatim servers" +msgstr "" + +#: openstreetmap.php:197 +msgid "Default zoom" +msgstr "" + +#: openstreetmap.php:197 +msgid "" +"The default zoom level. (1:world, 18:highest, also depends on tile server)" +msgstr "" + +#: openstreetmap.php:198 +msgid "Include marker on map" +msgstr "" + +#: openstreetmap.php:198 +msgid "Include a marker on the map." +msgstr "" diff --git a/openstreetmap/lang/et/strings.php b/openstreetmap/lang/et/strings.php new file mode 100644 index 00000000..04ee22e7 --- /dev/null +++ b/openstreetmap/lang/et/strings.php @@ -0,0 +1,8 @@ +strings['Submit'] = 'Saada'; diff --git a/openstreetmap/lang/gd/messages.po b/openstreetmap/lang/gd/messages.po new file mode 100644 index 00000000..2800943e --- /dev/null +++ b/openstreetmap/lang/gd/messages.po @@ -0,0 +1,64 @@ +# ADDON openstreetmap +# Copyright (C) +# This file is distributed under the same license as the Friendica openstreetmap addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2014-06-23 11:01+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: openstreetmap.php:167 +msgid "View Larger" +msgstr "" + +#: openstreetmap.php:194 +msgid "Submit" +msgstr "" + +#: openstreetmap.php:195 +msgid "Tile Server URL" +msgstr "" + +#: openstreetmap.php:195 +msgid "" +"A list of public tile servers" +msgstr "" + +#: openstreetmap.php:196 +msgid "Nominatim (reverse geocoding) Server URL" +msgstr "" + +#: openstreetmap.php:196 +msgid "" +"A list of Nominatim servers" +msgstr "" + +#: openstreetmap.php:197 +msgid "Default zoom" +msgstr "" + +#: openstreetmap.php:197 +msgid "" +"The default zoom level. (1:world, 18:highest, also depends on tile server)" +msgstr "" + +#: openstreetmap.php:198 +msgid "Include marker on map" +msgstr "" + +#: openstreetmap.php:198 +msgid "Include a marker on the map." +msgstr "" diff --git a/openstreetmap/lang/gd/strings.php b/openstreetmap/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/openstreetmap/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/openstreetmap/lang/ru/messages.po b/openstreetmap/lang/ru/messages.po new file mode 100644 index 00000000..3dc8cc2a --- /dev/null +++ b/openstreetmap/lang/ru/messages.po @@ -0,0 +1,64 @@ +# ADDON openstreetmap +# Copyright (C) +# This file is distributed under the same license as the Friendica openstreetmap addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2014-06-23 11:01+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Russian (http://app.transifex.com/Friendica/friendica/language/ru/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ru\n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" + +#: openstreetmap.php:167 +msgid "View Larger" +msgstr "" + +#: openstreetmap.php:194 +msgid "Submit" +msgstr "Добавить" + +#: openstreetmap.php:195 +msgid "Tile Server URL" +msgstr "" + +#: openstreetmap.php:195 +msgid "" +"A list of public tile servers" +msgstr "" + +#: openstreetmap.php:196 +msgid "Nominatim (reverse geocoding) Server URL" +msgstr "" + +#: openstreetmap.php:196 +msgid "" +"A list of Nominatim servers" +msgstr "" + +#: openstreetmap.php:197 +msgid "Default zoom" +msgstr "" + +#: openstreetmap.php:197 +msgid "" +"The default zoom level. (1:world, 18:highest, also depends on tile server)" +msgstr "" + +#: openstreetmap.php:198 +msgid "Include marker on map" +msgstr "" + +#: openstreetmap.php:198 +msgid "Include a marker on the map." +msgstr "" diff --git a/openstreetmap/lang/ru/strings.php b/openstreetmap/lang/ru/strings.php index e249d2dc..0b7afb84 100644 --- a/openstreetmap/lang/ru/strings.php +++ b/openstreetmap/lang/ru/strings.php @@ -1,8 +1,8 @@ -strings["Submit"] = "Подтвердить"; -$a->strings["Tile Server URL"] = ""; -$a->strings["A list of public tile servers"] = "Список общедоступных серверов"; -$a->strings["Default zoom"] = "zoom по умолчанию"; -$a->strings["The default zoom level. (1:world, 18:highest)"] = ""; -$a->strings["Settings updated."] = "Настройки обновлены."; +=2 && $n%10<=4 && ($n%100<12 || $n%100>14)) { return 1; } else if ($n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)) { return 2; } else { return 3; } +}} +$a->strings['Submit'] = 'Добавить'; diff --git a/openstreetmap/openstreetmap.php b/openstreetmap/openstreetmap.php index 3b7c4a58..bf0f54b6 100644 --- a/openstreetmap/openstreetmap.php +++ b/openstreetmap/openstreetmap.php @@ -9,10 +9,8 @@ * */ -use Friendica\App; use Friendica\Core\Cache\Enum\Duration; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; use Friendica\Core\Config\Util\ConfigFileManager; @@ -32,12 +30,12 @@ function openstreetmap_install() Hook::register('Map::getCoordinates', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_get_coordinates'); Hook::register('page_header', 'addon/openstreetmap/openstreetmap.php', 'openstreetmap_alterheader'); - Logger::notice("installed openstreetmap"); + DI::logger()->notice("installed openstreetmap"); } function openstreetmap_load_config(ConfigFileManager $loader) { - DI::app()->getConfigCache()->load($loader->loadAddonConfig('openstreetmap'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); + DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('openstreetmap'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); } function openstreetmap_alterheader(&$navHtml) @@ -121,7 +119,7 @@ function openstreetmap_get_coordinates(array &$b) if (is_null($j)) { $curlResult = DI::httpClient()->get($nomserver . $args); if ($curlResult->isSuccess()) { - $j = json_decode($curlResult->getBody(), true); + $j = json_decode($curlResult->getBodyString(), true); DI::cache()->set($cachekey, $j, Duration::MONTH); } } @@ -155,8 +153,8 @@ function openstreetmap_generate_map(array &$b) $lat = $b['lat']; // round($b['lat'], 5); $lon = $b['lon']; // round($b['lon'], 5); - Logger::debug('lat: ' . $lat); - Logger::debug('lon: ' . $lon); + DI::logger()->debug('lat: ' . $lat); + DI::logger()->debug('lon: ' . $lon); $cardlink = '\n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: pageheader.php:36 +msgid "\"pageheader\" Settings" +msgstr "" + +#: pageheader.php:37 +msgid "Message" +msgstr "" + +#: pageheader.php:37 +msgid "" +"Message to display on every page on this server (or put a pageheader.html " +"file in your docroot)" +msgstr "" + +#: pageheader.php:38 +msgid "Save Settings" +msgstr "" diff --git a/pageheader/lang/bg/strings.php b/pageheader/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/pageheader/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: pageheader.php:36 +msgid "\"pageheader\" Settings" +msgstr "" + +#: pageheader.php:37 +msgid "Message" +msgstr "" + +#: pageheader.php:37 +msgid "" +"Message to display on every page on this server (or put a pageheader.html " +"file in your docroot)" +msgstr "" + +#: pageheader.php:38 +msgid "Save Settings" +msgstr "" diff --git a/pageheader/lang/ca/strings.php b/pageheader/lang/ca/strings.php index 389bdc27..d34874f6 100644 --- a/pageheader/lang/ca/strings.php +++ b/pageheader/lang/ca/strings.php @@ -1,5 +1,7 @@ -strings["\"pageheader\" Settings"] = "Configuració de la capçalera de pàgina."; -$a->strings["Submit"] = "Enviar"; -$a->strings["pageheader Settings saved."] = "guardada la configuració de la capçalera de pàgina."; +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: pageheader.php:36 +msgid "\"pageheader\" Settings" +msgstr "" + +#: pageheader.php:37 +msgid "Message" +msgstr "" + +#: pageheader.php:37 +msgid "" +"Message to display on every page on this server (or put a pageheader.html " +"file in your docroot)" +msgstr "" + +#: pageheader.php:38 +msgid "Save Settings" +msgstr "" diff --git a/pageheader/lang/eo/strings.php b/pageheader/lang/eo/strings.php index 5a23c2af..68e8a64c 100644 --- a/pageheader/lang/eo/strings.php +++ b/pageheader/lang/eo/strings.php @@ -1,5 +1,7 @@ -strings["\"pageheader\" Settings"] = "\"pageheader\" Agordoj"; -$a->strings["Submit"] = "Sendi"; -$a->strings["pageheader Settings saved."] = "Konservis Agordojn de pageheader."; +\n" +"Language-Team: Estonian (http://app.transifex.com/Friendica/friendica/language/et/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: et\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: pageheader.php:36 +msgid "\"pageheader\" Settings" +msgstr "" + +#: pageheader.php:37 +msgid "Message" +msgstr "" + +#: pageheader.php:37 +msgid "" +"Message to display on every page on this server (or put a pageheader.html " +"file in your docroot)" +msgstr "" + +#: pageheader.php:38 +msgid "Save Settings" +msgstr "" diff --git a/pageheader/lang/et/strings.php b/pageheader/lang/et/strings.php new file mode 100644 index 00000000..dfe78358 --- /dev/null +++ b/pageheader/lang/et/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: pageheader.php:36 +msgid "\"pageheader\" Settings" +msgstr "" + +#: pageheader.php:37 +msgid "Message" +msgstr "" + +#: pageheader.php:37 +msgid "" +"Message to display on every page on this server (or put a pageheader.html " +"file in your docroot)" +msgstr "" + +#: pageheader.php:38 +msgid "Save Settings" +msgstr "" diff --git a/pageheader/lang/gd/strings.php b/pageheader/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/pageheader/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/pageheader/lang/is/messages.po b/pageheader/lang/is/messages.po new file mode 100644 index 00000000..c2eb5d5c --- /dev/null +++ b/pageheader/lang/is/messages.po @@ -0,0 +1,37 @@ +# ADDON pageheader +# Copyright (C) +# This file is distributed under the same license as the Friendica pageheader addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2014-06-23 11:17+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: pageheader.php:36 +msgid "\"pageheader\" Settings" +msgstr "" + +#: pageheader.php:37 +msgid "Message" +msgstr "" + +#: pageheader.php:37 +msgid "" +"Message to display on every page on this server (or put a pageheader.html " +"file in your docroot)" +msgstr "" + +#: pageheader.php:38 +msgid "Save Settings" +msgstr "" diff --git a/pageheader/lang/is/strings.php b/pageheader/lang/is/strings.php index 86c571ee..975c341e 100644 --- a/pageheader/lang/is/strings.php +++ b/pageheader/lang/is/strings.php @@ -1,5 +1,7 @@ -strings["\"pageheader\" Settings"] = "Stillingar \"pageheader\""; -$a->strings["Submit"] = "Senda inn"; -$a->strings["pageheader Settings saved."] = "Stillingar pageheader vistaðar."; + * Hauke Altmann - * + * */ -use Friendica\App; use Friendica\Core\Hook; use Friendica\Core\Renderer; use Friendica\DI; diff --git a/phpmailer/composer.json b/phpmailer/composer.json index 5779773a..84d18543 100644 --- a/phpmailer/composer.json +++ b/phpmailer/composer.json @@ -1,22 +1,22 @@ { - "name": "friendica-addons/phpmailer", - "description": "Replaces the default `mail()` function by the `PHPMailer` library", - "type": "friendica-addon", - "authors": [ - { - "name": "Marcus Mueller", - "role": "Developer" - } - ], - "require": { - "php": ">=7.0", - "phpmailer/phpmailer": "^6.1" - }, - "license": "3-clause BSD license", - "minimum-stability": "stable", - "config": { - "optimize-autoloader": true, - "autoloader-suffix": "PhpMailerAddon", - "preferred-install": "dist" - } + "name": "friendica-addons/phpmailer", + "description": "Replaces the default `mail()` function by the `PHPMailer` library", + "type": "friendica-addon", + "authors": [ + { + "name": "Marcus Mueller", + "role": "Developer" + } + ], + "require": { + "php": ">=7.0", + "phpmailer/phpmailer": "^6.1" + }, + "license": "3-clause BSD license", + "minimum-stability": "stable", + "config": { + "optimize-autoloader": true, + "autoloader-suffix": "PhpMailerAddon", + "preferred-install": "dist" + } } diff --git a/phpmailer/composer.lock b/phpmailer/composer.lock index b1f2a5d9..7cd1afd5 100644 --- a/phpmailer/composer.lock +++ b/phpmailer/composer.lock @@ -8,16 +8,16 @@ "packages": [ { "name": "phpmailer/phpmailer", - "version": "v6.5.0", + "version": "v6.10.0", "source": { "type": "git", "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "a5b5c43e50b7fba655f793ad27303cd74c57363c" + "reference": "bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/a5b5c43e50b7fba655f793ad27303cd74c57363c", - "reference": "a5b5c43e50b7fba655f793ad27303cd74c57363c", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144", + "reference": "bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144", "shasum": "" }, "require": { @@ -27,20 +27,25 @@ "php": ">=5.5.0" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "doctrine/annotations": "^1.2", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "doctrine/annotations": "^1.2.6 || ^1.13.3", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.3.5", "roave/security-advisories": "dev-latest", - "squizlabs/php_codesniffer": "^3.5.6", - "yoast/phpunit-polyfills": "^0.2.0" + "squizlabs/php_codesniffer": "^3.7.2", + "yoast/phpunit-polyfills": "^1.0.4" }, "suggest": { + "decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication", "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", + "ext-openssl": "Needed for secure SMTP sending and DKIM signing", + "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication", "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", "league/oauth2-google": "Needed for Google XOAUTH2 authentication", "psr/log": "For optional PSR-3 debug logging", - "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication", - "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)" + "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)", + "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication" }, "type": "library", "autoload": { @@ -72,7 +77,7 @@ "description": "PHPMailer is a full-featured email creation and transfer class for PHP", "support": { "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.5.0" + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.10.0" }, "funding": [ { @@ -80,18 +85,18 @@ "type": "github" } ], - "time": "2021-06-16T14:33:43+00:00" + "time": "2025-04-24T15:19:31+00:00" } ], "packages-dev": [], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { "php": ">=7.0" }, - "platform-dev": [], - "plugin-api-version": "2.1.0" + "platform-dev": {}, + "plugin-api-version": "2.6.0" } diff --git a/phpmailer/phpmailer.php b/phpmailer/phpmailer.php index 4c12709d..10287a04 100644 --- a/phpmailer/phpmailer.php +++ b/phpmailer/phpmailer.php @@ -7,7 +7,6 @@ * Maintainer: Hypolite Petovan */ -use Friendica\App; use Friendica\Core\Hook; use Friendica\DI; use Friendica\Object\EMail\IEmail; @@ -25,14 +24,18 @@ function phpmailer_install() function phpmailer_load_config(ConfigFileManager $loader) { - DI::app()->getConfigCache()->load($loader->loadAddonConfig('phpmailer'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); + DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('phpmailer'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); } /** - * @param IEmail $email + * @param null|IEmail $email */ -function phpmailer_emailer_send_prepare(IEmail &$email) +function phpmailer_emailer_send_prepare(?IEmail &$email) { + if ($email === null) { + return; + } + // Passing `true` enables exceptions $mailer = new PHPMailer(true); try { diff --git a/phpmailer/vendor/autoload.php b/phpmailer/vendor/autoload.php index 60925835..1d45b283 100644 --- a/phpmailer/vendor/autoload.php +++ b/phpmailer/vendor/autoload.php @@ -2,6 +2,24 @@ // autoload.php @generated by Composer +if (PHP_VERSION_ID < 50600) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + $err = 'Composer 2.3.0 dropped support for autoloading on PHP <5.6 and you are running '.PHP_VERSION.', please upgrade PHP or use Composer 2.2 LTS via "composer self-update --2.2". Aborting.'.PHP_EOL; + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, $err); + } elseif (!headers_sent()) { + echo $err; + } + } + trigger_error( + $err, + E_USER_ERROR + ); +} + require_once __DIR__ . '/composer/autoload_real.php'; return ComposerAutoloaderInitPhpMailerAddon::getLoader(); diff --git a/phpmailer/vendor/composer/ClassLoader.php b/phpmailer/vendor/composer/ClassLoader.php index 03b9bb9c..7824d8f7 100644 --- a/phpmailer/vendor/composer/ClassLoader.php +++ b/phpmailer/vendor/composer/ClassLoader.php @@ -37,26 +37,81 @@ namespace Composer\Autoload; * * @author Fabien Potencier * @author Jordi Boggiano - * @see http://www.php-fig.org/psr/psr-0/ - * @see http://www.php-fig.org/psr/psr-4/ + * @see https://www.php-fig.org/psr/psr-0/ + * @see https://www.php-fig.org/psr/psr-4/ */ class ClassLoader { + /** @var \Closure(string):void */ + private static $includeFile; + + /** @var string|null */ + private $vendorDir; + // PSR-4 + /** + * @var array> + */ private $prefixLengthsPsr4 = array(); + /** + * @var array> + */ private $prefixDirsPsr4 = array(); + /** + * @var list + */ private $fallbackDirsPsr4 = array(); // PSR-0 + /** + * List of PSR-0 prefixes + * + * Structured as array('F (first letter)' => array('Foo\Bar (full prefix)' => array('path', 'path2'))) + * + * @var array>> + */ private $prefixesPsr0 = array(); + /** + * @var list + */ private $fallbackDirsPsr0 = array(); + /** @var bool */ private $useIncludePath = false; + + /** + * @var array + */ private $classMap = array(); + + /** @var bool */ private $classMapAuthoritative = false; + + /** + * @var array + */ private $missingClasses = array(); + + /** @var string|null */ private $apcuPrefix; + /** + * @var array + */ + private static $registeredLoaders = array(); + + /** + * @param string|null $vendorDir + */ + public function __construct($vendorDir = null) + { + $this->vendorDir = $vendorDir; + self::initializeIncludeClosure(); + } + + /** + * @return array> + */ public function getPrefixes() { if (!empty($this->prefixesPsr0)) { @@ -66,28 +121,42 @@ class ClassLoader return array(); } + /** + * @return array> + */ public function getPrefixesPsr4() { return $this->prefixDirsPsr4; } + /** + * @return list + */ public function getFallbackDirs() { return $this->fallbackDirsPsr0; } + /** + * @return list + */ public function getFallbackDirsPsr4() { return $this->fallbackDirsPsr4; } + /** + * @return array Array of classname => path + */ public function getClassMap() { return $this->classMap; } /** - * @param array $classMap Class to filename map + * @param array $classMap Class to filename map + * + * @return void */ public function addClassMap(array $classMap) { @@ -102,22 +171,25 @@ class ClassLoader * Registers a set of PSR-0 directories for a given prefix, either * appending or prepending to the ones previously set for this prefix. * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 root directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + * + * @return void */ public function add($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { if ($prepend) { $this->fallbackDirsPsr0 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr0 ); } else { $this->fallbackDirsPsr0 = array_merge( $this->fallbackDirsPsr0, - (array) $paths + $paths ); } @@ -126,19 +198,19 @@ class ClassLoader $first = $prefix[0]; if (!isset($this->prefixesPsr0[$first][$prefix])) { - $this->prefixesPsr0[$first][$prefix] = (array) $paths; + $this->prefixesPsr0[$first][$prefix] = $paths; return; } if ($prepend) { $this->prefixesPsr0[$first][$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixesPsr0[$first][$prefix] ); } else { $this->prefixesPsr0[$first][$prefix] = array_merge( $this->prefixesPsr0[$first][$prefix], - (array) $paths + $paths ); } } @@ -147,25 +219,28 @@ class ClassLoader * Registers a set of PSR-4 directories for a given namespace, either * appending or prepending to the ones previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories - * @param bool $prepend Whether to prepend the directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories * * @throws \InvalidArgumentException + * + * @return void */ public function addPsr4($prefix, $paths, $prepend = false) { + $paths = (array) $paths; if (!$prefix) { // Register directories for the root namespace. if ($prepend) { $this->fallbackDirsPsr4 = array_merge( - (array) $paths, + $paths, $this->fallbackDirsPsr4 ); } else { $this->fallbackDirsPsr4 = array_merge( $this->fallbackDirsPsr4, - (array) $paths + $paths ); } } elseif (!isset($this->prefixDirsPsr4[$prefix])) { @@ -175,18 +250,18 @@ class ClassLoader throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); } $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; - $this->prefixDirsPsr4[$prefix] = (array) $paths; + $this->prefixDirsPsr4[$prefix] = $paths; } elseif ($prepend) { // Prepend directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( - (array) $paths, + $paths, $this->prefixDirsPsr4[$prefix] ); } else { // Append directories for an already registered namespace. $this->prefixDirsPsr4[$prefix] = array_merge( $this->prefixDirsPsr4[$prefix], - (array) $paths + $paths ); } } @@ -195,8 +270,10 @@ class ClassLoader * Registers a set of PSR-0 directories for a given prefix, * replacing any others previously set for this prefix. * - * @param string $prefix The prefix - * @param array|string $paths The PSR-0 base directories + * @param string $prefix The prefix + * @param list|string $paths The PSR-0 base directories + * + * @return void */ public function set($prefix, $paths) { @@ -211,10 +288,12 @@ class ClassLoader * Registers a set of PSR-4 directories for a given namespace, * replacing any others previously set for this namespace. * - * @param string $prefix The prefix/namespace, with trailing '\\' - * @param array|string $paths The PSR-4 base directories + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param list|string $paths The PSR-4 base directories * * @throws \InvalidArgumentException + * + * @return void */ public function setPsr4($prefix, $paths) { @@ -234,6 +313,8 @@ class ClassLoader * Turns on searching the include path for class files. * * @param bool $useIncludePath + * + * @return void */ public function setUseIncludePath($useIncludePath) { @@ -256,6 +337,8 @@ class ClassLoader * that have not been registered with the class map. * * @param bool $classMapAuthoritative + * + * @return void */ public function setClassMapAuthoritative($classMapAuthoritative) { @@ -276,6 +359,8 @@ class ClassLoader * APCu prefix to use to cache found/not-found classes, if the extension is enabled. * * @param string|null $apcuPrefix + * + * @return void */ public function setApcuPrefix($apcuPrefix) { @@ -296,33 +381,55 @@ class ClassLoader * Registers this instance as an autoloader. * * @param bool $prepend Whether to prepend the autoloader or not + * + * @return void */ public function register($prepend = false) { spl_autoload_register(array($this, 'loadClass'), true, $prepend); + + if (null === $this->vendorDir) { + return; + } + + if ($prepend) { + self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders; + } else { + unset(self::$registeredLoaders[$this->vendorDir]); + self::$registeredLoaders[$this->vendorDir] = $this; + } } /** * Unregisters this instance as an autoloader. + * + * @return void */ public function unregister() { spl_autoload_unregister(array($this, 'loadClass')); + + if (null !== $this->vendorDir) { + unset(self::$registeredLoaders[$this->vendorDir]); + } } /** * Loads the given class or interface. * * @param string $class The name of the class - * @return bool|null True if loaded, null otherwise + * @return true|null True if loaded, null otherwise */ public function loadClass($class) { if ($file = $this->findFile($class)) { - includeFile($file); + $includeFile = self::$includeFile; + $includeFile($file); return true; } + + return null; } /** @@ -367,6 +474,21 @@ class ClassLoader return $file; } + /** + * Returns the currently registered loaders keyed by their corresponding vendor directories. + * + * @return array + */ + public static function getRegisteredLoaders() + { + return self::$registeredLoaders; + } + + /** + * @param string $class + * @param string $ext + * @return string|false + */ private function findFileWithExtension($class, $ext) { // PSR-4 lookup @@ -432,14 +554,26 @@ class ClassLoader return false; } -} -/** - * Scope isolated include. - * - * Prevents access to $this/self from included files. - */ -function includeFile($file) -{ - include $file; + /** + * @return void + */ + private static function initializeIncludeClosure() + { + if (self::$includeFile !== null) { + return; + } + + /** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + * + * @param string $file + * @return void + */ + self::$includeFile = \Closure::bind(static function($file) { + include $file; + }, null, null); + } } diff --git a/phpmailer/vendor/composer/InstalledVersions.php b/phpmailer/vendor/composer/InstalledVersions.php new file mode 100644 index 00000000..51e734a7 --- /dev/null +++ b/phpmailer/vendor/composer/InstalledVersions.php @@ -0,0 +1,359 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer; + +use Composer\Autoload\ClassLoader; +use Composer\Semver\VersionParser; + +/** + * This class is copied in every Composer installed project and available to all + * + * See also https://getcomposer.org/doc/07-runtime.md#installed-versions + * + * To require its presence, you can require `composer-runtime-api ^2.0` + * + * @final + */ +class InstalledVersions +{ + /** + * @var mixed[]|null + * @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array}|array{}|null + */ + private static $installed; + + /** + * @var bool|null + */ + private static $canGetVendors; + + /** + * @var array[] + * @psalm-var array}> + */ + private static $installedByVendor = array(); + + /** + * Returns a list of all package names which are present, either by being installed, replaced or provided + * + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackages() + { + $packages = array(); + foreach (self::getInstalled() as $installed) { + $packages[] = array_keys($installed['versions']); + } + + if (1 === \count($packages)) { + return $packages[0]; + } + + return array_keys(array_flip(\call_user_func_array('array_merge', $packages))); + } + + /** + * Returns a list of all package names with a specific type e.g. 'library' + * + * @param string $type + * @return string[] + * @psalm-return list + */ + public static function getInstalledPackagesByType($type) + { + $packagesByType = array(); + + foreach (self::getInstalled() as $installed) { + foreach ($installed['versions'] as $name => $package) { + if (isset($package['type']) && $package['type'] === $type) { + $packagesByType[] = $name; + } + } + } + + return $packagesByType; + } + + /** + * Checks whether the given package is installed + * + * This also returns true if the package name is provided or replaced by another package + * + * @param string $packageName + * @param bool $includeDevRequirements + * @return bool + */ + public static function isInstalled($packageName, $includeDevRequirements = true) + { + foreach (self::getInstalled() as $installed) { + if (isset($installed['versions'][$packageName])) { + return $includeDevRequirements || !isset($installed['versions'][$packageName]['dev_requirement']) || $installed['versions'][$packageName]['dev_requirement'] === false; + } + } + + return false; + } + + /** + * Checks whether the given package satisfies a version constraint + * + * e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call: + * + * Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3') + * + * @param VersionParser $parser Install composer/semver to have access to this class and functionality + * @param string $packageName + * @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package + * @return bool + */ + public static function satisfies(VersionParser $parser, $packageName, $constraint) + { + $constraint = $parser->parseConstraints((string) $constraint); + $provided = $parser->parseConstraints(self::getVersionRanges($packageName)); + + return $provided->matches($constraint); + } + + /** + * Returns a version constraint representing all the range(s) which are installed for a given package + * + * It is easier to use this via isInstalled() with the $constraint argument if you need to check + * whether a given version of a package is installed, and not just whether it exists + * + * @param string $packageName + * @return string Version constraint usable with composer/semver + */ + public static function getVersionRanges($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + $ranges = array(); + if (isset($installed['versions'][$packageName]['pretty_version'])) { + $ranges[] = $installed['versions'][$packageName]['pretty_version']; + } + if (array_key_exists('aliases', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']); + } + if (array_key_exists('replaced', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']); + } + if (array_key_exists('provided', $installed['versions'][$packageName])) { + $ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']); + } + + return implode(' || ', $ranges); + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['version'])) { + return null; + } + + return $installed['versions'][$packageName]['version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present + */ + public static function getPrettyVersion($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['pretty_version'])) { + return null; + } + + return $installed['versions'][$packageName]['pretty_version']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference + */ + public static function getReference($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + if (!isset($installed['versions'][$packageName]['reference'])) { + return null; + } + + return $installed['versions'][$packageName]['reference']; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @param string $packageName + * @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path. + */ + public static function getInstallPath($packageName) + { + foreach (self::getInstalled() as $installed) { + if (!isset($installed['versions'][$packageName])) { + continue; + } + + return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null; + } + + throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed'); + } + + /** + * @return array + * @psalm-return array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool} + */ + public static function getRootPackage() + { + $installed = self::getInstalled(); + + return $installed[0]['root']; + } + + /** + * Returns the raw installed.php data for custom implementations + * + * @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect. + * @return array[] + * @psalm-return array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} + */ + public static function getRawData() + { + @trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED); + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + self::$installed = include __DIR__ . '/installed.php'; + } else { + self::$installed = array(); + } + } + + return self::$installed; + } + + /** + * Returns the raw data of all installed.php which are currently loaded for custom implementations + * + * @return array[] + * @psalm-return list}> + */ + public static function getAllRawData() + { + return self::getInstalled(); + } + + /** + * Lets you reload the static array from another file + * + * This is only useful for complex integrations in which a project needs to use + * this class but then also needs to execute another project's autoloader in process, + * and wants to ensure both projects have access to their version of installed.php. + * + * A typical case would be PHPUnit, where it would need to make sure it reads all + * the data it needs from this class, then call reload() with + * `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure + * the project in which it runs can then also use this class safely, without + * interference between PHPUnit's dependencies and the project's dependencies. + * + * @param array[] $data A vendor/composer/installed.php data set + * @return void + * + * @psalm-param array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $data + */ + public static function reload($data) + { + self::$installed = $data; + self::$installedByVendor = array(); + } + + /** + * @return array[] + * @psalm-return list}> + */ + private static function getInstalled() + { + if (null === self::$canGetVendors) { + self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders'); + } + + $installed = array(); + + if (self::$canGetVendors) { + foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) { + if (isset(self::$installedByVendor[$vendorDir])) { + $installed[] = self::$installedByVendor[$vendorDir]; + } elseif (is_file($vendorDir.'/composer/installed.php')) { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require $vendorDir.'/composer/installed.php'; + $installed[] = self::$installedByVendor[$vendorDir] = $required; + if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) { + self::$installed = $installed[count($installed) - 1]; + } + } + } + } + + if (null === self::$installed) { + // only require the installed.php file if this file is loaded from its dumped location, + // and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937 + if (substr(__DIR__, -8, 1) !== 'C') { + /** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array} $required */ + $required = require __DIR__ . '/installed.php'; + self::$installed = $required; + } else { + self::$installed = array(); + } + } + + if (self::$installed !== array()) { + $installed[] = self::$installed; + } + + return $installed; + } +} diff --git a/phpmailer/vendor/composer/autoload_classmap.php b/phpmailer/vendor/composer/autoload_classmap.php index 6000382d..c20440c1 100644 --- a/phpmailer/vendor/composer/autoload_classmap.php +++ b/phpmailer/vendor/composer/autoload_classmap.php @@ -2,12 +2,15 @@ // autoload_classmap.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( + 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', + 'PHPMailer\\PHPMailer\\DSNConfigurator' => $vendorDir . '/phpmailer/phpmailer/src/DSNConfigurator.php', 'PHPMailer\\PHPMailer\\Exception' => $vendorDir . '/phpmailer/phpmailer/src/Exception.php', 'PHPMailer\\PHPMailer\\OAuth' => $vendorDir . '/phpmailer/phpmailer/src/OAuth.php', + 'PHPMailer\\PHPMailer\\OAuthTokenProvider' => $vendorDir . '/phpmailer/phpmailer/src/OAuthTokenProvider.php', 'PHPMailer\\PHPMailer\\PHPMailer' => $vendorDir . '/phpmailer/phpmailer/src/PHPMailer.php', 'PHPMailer\\PHPMailer\\POP3' => $vendorDir . '/phpmailer/phpmailer/src/POP3.php', 'PHPMailer\\PHPMailer\\SMTP' => $vendorDir . '/phpmailer/phpmailer/src/SMTP.php', diff --git a/phpmailer/vendor/composer/autoload_namespaces.php b/phpmailer/vendor/composer/autoload_namespaces.php index b7fc0125..15a2ff3a 100644 --- a/phpmailer/vendor/composer/autoload_namespaces.php +++ b/phpmailer/vendor/composer/autoload_namespaces.php @@ -2,7 +2,7 @@ // autoload_namespaces.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/phpmailer/vendor/composer/autoload_psr4.php b/phpmailer/vendor/composer/autoload_psr4.php index 0706da6f..28567a00 100644 --- a/phpmailer/vendor/composer/autoload_psr4.php +++ b/phpmailer/vendor/composer/autoload_psr4.php @@ -2,7 +2,7 @@ // autoload_psr4.php @generated by Composer -$vendorDir = dirname(dirname(__FILE__)); +$vendorDir = dirname(__DIR__); $baseDir = dirname($vendorDir); return array( diff --git a/phpmailer/vendor/composer/autoload_real.php b/phpmailer/vendor/composer/autoload_real.php index e7e97ae8..65adf3da 100644 --- a/phpmailer/vendor/composer/autoload_real.php +++ b/phpmailer/vendor/composer/autoload_real.php @@ -22,31 +22,14 @@ class ComposerAutoloaderInitPhpMailerAddon return self::$loader; } + require __DIR__ . '/platform_check.php'; + spl_autoload_register(array('ComposerAutoloaderInitPhpMailerAddon', 'loadClassLoader'), true, true); - self::$loader = $loader = new \Composer\Autoload\ClassLoader(); + self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); spl_autoload_unregister(array('ComposerAutoloaderInitPhpMailerAddon', 'loadClassLoader')); - $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); - if ($useStaticLoader) { - require_once __DIR__ . '/autoload_static.php'; - - call_user_func(\Composer\Autoload\ComposerStaticInitPhpMailerAddon::getInitializer($loader)); - } else { - $map = require __DIR__ . '/autoload_namespaces.php'; - foreach ($map as $namespace => $path) { - $loader->set($namespace, $path); - } - - $map = require __DIR__ . '/autoload_psr4.php'; - foreach ($map as $namespace => $path) { - $loader->setPsr4($namespace, $path); - } - - $classMap = require __DIR__ . '/autoload_classmap.php'; - if ($classMap) { - $loader->addClassMap($classMap); - } - } + require __DIR__ . '/autoload_static.php'; + call_user_func(\Composer\Autoload\ComposerStaticInitPhpMailerAddon::getInitializer($loader)); $loader->register(true); diff --git a/phpmailer/vendor/composer/autoload_static.php b/phpmailer/vendor/composer/autoload_static.php index 20cd9684..8fc70b40 100644 --- a/phpmailer/vendor/composer/autoload_static.php +++ b/phpmailer/vendor/composer/autoload_static.php @@ -21,8 +21,11 @@ class ComposerStaticInitPhpMailerAddon ); public static $classMap = array ( + 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', + 'PHPMailer\\PHPMailer\\DSNConfigurator' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/DSNConfigurator.php', 'PHPMailer\\PHPMailer\\Exception' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/Exception.php', 'PHPMailer\\PHPMailer\\OAuth' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/OAuth.php', + 'PHPMailer\\PHPMailer\\OAuthTokenProvider' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/OAuthTokenProvider.php', 'PHPMailer\\PHPMailer\\PHPMailer' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/PHPMailer.php', 'PHPMailer\\PHPMailer\\POP3' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/POP3.php', 'PHPMailer\\PHPMailer\\SMTP' => __DIR__ . '/..' . '/phpmailer/phpmailer/src/SMTP.php', diff --git a/phpmailer/vendor/composer/installed.json b/phpmailer/vendor/composer/installed.json index 20714abc..142a295b 100644 --- a/phpmailer/vendor/composer/installed.json +++ b/phpmailer/vendor/composer/installed.json @@ -1,80 +1,90 @@ -[ - { - "name": "phpmailer/phpmailer", - "version": "v6.5.0", - "version_normalized": "6.5.0.0", - "source": { - "type": "git", - "url": "https://github.com/PHPMailer/PHPMailer.git", - "reference": "a5b5c43e50b7fba655f793ad27303cd74c57363c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/a5b5c43e50b7fba655f793ad27303cd74c57363c", - "reference": "a5b5c43e50b7fba655f793ad27303cd74c57363c", - "shasum": "" - }, - "require": { - "ext-ctype": "*", - "ext-filter": "*", - "ext-hash": "*", - "php": ">=5.5.0" - }, - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "doctrine/annotations": "^1.2", - "phpcompatibility/php-compatibility": "^9.3.5", - "roave/security-advisories": "dev-latest", - "squizlabs/php_codesniffer": "^3.5.6", - "yoast/phpunit-polyfills": "^0.2.0" - }, - "suggest": { - "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", - "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", - "league/oauth2-google": "Needed for Google XOAUTH2 authentication", - "psr/log": "For optional PSR-3 debug logging", - "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication", - "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)" - }, - "time": "2021-06-16T14:33:43+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "PHPMailer\\PHPMailer\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "LGPL-2.1-only" +{ + "packages": [ + { + "name": "phpmailer/phpmailer", + "version": "v6.10.0", + "version_normalized": "6.10.0.0", + "source": { + "type": "git", + "url": "https://github.com/PHPMailer/PHPMailer.git", + "reference": "bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPMailer/PHPMailer/zipball/bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144", + "reference": "bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "ext-filter": "*", + "ext-hash": "*", + "php": ">=5.5.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "doctrine/annotations": "^1.2.6 || ^1.13.3", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", + "phpcompatibility/php-compatibility": "^9.3.5", + "roave/security-advisories": "dev-latest", + "squizlabs/php_codesniffer": "^3.7.2", + "yoast/phpunit-polyfills": "^1.0.4" + }, + "suggest": { + "decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication", + "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", + "ext-openssl": "Needed for secure SMTP sending and DKIM signing", + "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication", + "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", + "league/oauth2-google": "Needed for Google XOAUTH2 authentication", + "psr/log": "For optional PSR-3 debug logging", + "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)", + "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication" + }, + "time": "2025-04-24T15:19:31+00:00", + "type": "library", + "installation-source": "dist", + "autoload": { + "psr-4": { + "PHPMailer\\PHPMailer\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-2.1-only" + ], + "authors": [ + { + "name": "Marcus Bointon", + "email": "phpmailer@synchromedia.co.uk" + }, + { + "name": "Jim Jagielski", + "email": "jimjag@gmail.com" + }, + { + "name": "Andy Prevost", + "email": "codeworxtech@users.sourceforge.net" + }, + { + "name": "Brent R. Matzelle" + } + ], + "description": "PHPMailer is a full-featured email creation and transfer class for PHP", + "support": { + "issues": "https://github.com/PHPMailer/PHPMailer/issues", + "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.10.0" + }, + "funding": [ + { + "url": "https://github.com/Synchro", + "type": "github" + } + ], + "install-path": "../phpmailer/phpmailer" + } ], - "authors": [ - { - "name": "Marcus Bointon", - "email": "phpmailer@synchromedia.co.uk" - }, - { - "name": "Jim Jagielski", - "email": "jimjag@gmail.com" - }, - { - "name": "Andy Prevost", - "email": "codeworxtech@users.sourceforge.net" - }, - { - "name": "Brent R. Matzelle" - } - ], - "description": "PHPMailer is a full-featured email creation and transfer class for PHP", - "support": { - "issues": "https://github.com/PHPMailer/PHPMailer/issues", - "source": "https://github.com/PHPMailer/PHPMailer/tree/v6.5.0" - }, - "funding": [ - { - "url": "https://github.com/Synchro", - "type": "github" - } - ] - } -] + "dev": true, + "dev-package-names": [] +} diff --git a/phpmailer/vendor/composer/installed.php b/phpmailer/vendor/composer/installed.php new file mode 100644 index 00000000..554d2c40 --- /dev/null +++ b/phpmailer/vendor/composer/installed.php @@ -0,0 +1,32 @@ + array( + 'name' => 'friendica-addons/phpmailer', + 'pretty_version' => 'dev-2025.07-rc', + 'version' => 'dev-2025.07-rc', + 'reference' => '715f70032330ad14f710284104c8593c7800e125', + 'type' => 'friendica-addon', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev' => true, + ), + 'versions' => array( + 'friendica-addons/phpmailer' => array( + 'pretty_version' => 'dev-2025.07-rc', + 'version' => 'dev-2025.07-rc', + 'reference' => '715f70032330ad14f710284104c8593c7800e125', + 'type' => 'friendica-addon', + 'install_path' => __DIR__ . '/../../', + 'aliases' => array(), + 'dev_requirement' => false, + ), + 'phpmailer/phpmailer' => array( + 'pretty_version' => 'v6.10.0', + 'version' => '6.10.0.0', + 'reference' => 'bf74d75a1fde6beaa34a0ddae2ec5fce0f72a144', + 'type' => 'library', + 'install_path' => __DIR__ . '/../phpmailer/phpmailer', + 'aliases' => array(), + 'dev_requirement' => false, + ), + ), +); diff --git a/phpmailer/vendor/composer/platform_check.php b/phpmailer/vendor/composer/platform_check.php new file mode 100644 index 00000000..f79e574b --- /dev/null +++ b/phpmailer/vendor/composer/platform_check.php @@ -0,0 +1,26 @@ += 70000)) { + $issues[] = 'Your Composer dependencies require a PHP version ">= 7.0.0". You are running ' . PHP_VERSION . '.'; +} + +if ($issues) { + if (!headers_sent()) { + header('HTTP/1.1 500 Internal Server Error'); + } + if (!ini_get('display_errors')) { + if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') { + fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL); + } elseif (!headers_sent()) { + echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL; + } + } + trigger_error( + 'Composer detected issues in your platform: ' . implode(' ', $issues), + E_USER_ERROR + ); +} diff --git a/phpmailer/vendor/phpmailer/phpmailer/README.md b/phpmailer/vendor/phpmailer/phpmailer/README.md index fa27d2f6..862a4e1a 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/README.md +++ b/phpmailer/vendor/phpmailer/phpmailer/README.md @@ -1,45 +1,54 @@ +[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://supportukrainenow.org/) + ![PHPMailer](https://raw.github.com/PHPMailer/PHPMailer/master/examples/images/phpmailer.png) # PHPMailer – A full-featured email creation and transfer class for PHP -[![Test status](https://github.com/PHPMailer/PHPMailer/workflows/Tests/badge.svg)](https://github.com/PHPMailer/PHPMailer/actions) [![Latest Stable Version](https://poser.pugx.org/phpmailer/phpmailer/v/stable.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![Total Downloads](https://poser.pugx.org/phpmailer/phpmailer/downloads)](https://packagist.org/packages/phpmailer/phpmailer) [![License](https://poser.pugx.org/phpmailer/phpmailer/license.svg)](https://packagist.org/packages/phpmailer/phpmailer) [![API Docs](https://github.com/phpmailer/phpmailer/workflows/Docs/badge.svg)](https://phpmailer.github.io/PHPMailer/) +[![Test status](https://github.com/PHPMailer/PHPMailer/workflows/Tests/badge.svg)](https://github.com/PHPMailer/PHPMailer/actions) +[![codecov.io](https://codecov.io/gh/PHPMailer/PHPMailer/branch/master/graph/badge.svg?token=iORZpwmYmM)](https://codecov.io/gh/PHPMailer/PHPMailer) +[![Latest Stable Version](https://poser.pugx.org/phpmailer/phpmailer/v/stable.svg)](https://packagist.org/packages/phpmailer/phpmailer) +[![Total Downloads](https://poser.pugx.org/phpmailer/phpmailer/downloads)](https://packagist.org/packages/phpmailer/phpmailer) +[![License](https://poser.pugx.org/phpmailer/phpmailer/license.svg)](https://packagist.org/packages/phpmailer/phpmailer) +[![API Docs](https://github.com/phpmailer/phpmailer/workflows/Docs/badge.svg)](https://phpmailer.github.io/PHPMailer/) +[![OpenSSF Scorecard](https://api.securityscorecards.dev/projects/github.com/PHPMailer/PHPMailer/badge)](https://api.securityscorecards.dev/projects/github.com/PHPMailer/PHPMailer) ## Features - Probably the world's most popular code for sending email from PHP! - Used by many open-source projects: WordPress, Drupal, 1CRM, SugarCRM, Yii, Joomla! and many more - Integrated SMTP support – send without a local mail server -- Send emails with multiple To, CC, BCC and Reply-to addresses +- Send emails with multiple To, CC, BCC, and Reply-to addresses - Multipart/alternative emails for mail clients that do not read HTML email - Add attachments, including inline - Support for UTF-8 content and 8bit, base64, binary, and quoted-printable encodings -- SMTP authentication with LOGIN, PLAIN, CRAM-MD5, and XOAUTH2 mechanisms over SMTPS and SMTP+STARTTLS transports +- Full UTF-8 support when using servers that support `SMTPUTF8`. +- Support for iCal events in multiparts and attachments +- SMTP authentication with `LOGIN`, `PLAIN`, `CRAM-MD5`, and `XOAUTH2` mechanisms over SMTPS and SMTP+STARTTLS transports - Validates email addresses automatically - Protects against header injection attacks - Error messages in over 50 languages! - DKIM and S/MIME signing support -- Compatible with PHP 5.5 and later, including PHP 8.0 +- Compatible with PHP 5.5 and later, including PHP 8.4 - Namespaced to prevent name clashes - Much more! ## Why you might need it -Many PHP developers need to send email from their code. The only PHP function that supports this directly is [`mail()`](https://www.php.net/manual/en/function.mail.php). However, it does not provide any assistance for making use of popular features such as encryption, authentication, HTML messages, and attachments. +Many PHP developers need to send email from their code. The only PHP function that supports this directly is [`mail()`](https://www.php.net/manual/en/function.mail.php). However, it does not provide any assistance for making use of popular features such as authentication, HTML messages, and attachments. Formatting email correctly is surprisingly difficult. There are myriad overlapping (and conflicting) standards, requiring tight adherence to horribly complicated formatting and encoding rules – the vast majority of code that you'll find online that uses the `mail()` function directly is just plain wrong, if not unsafe! The PHP `mail()` function usually sends via a local mail server, typically fronted by a `sendmail` binary on Linux, BSD, and macOS platforms, however, Windows usually doesn't include a local mail server; PHPMailer's integrated SMTP client allows email sending on all platforms without needing a local mail server. Be aware though, that the `mail()` function should be avoided when possible; it's both faster and [safer](https://exploitbox.io/paper/Pwning-PHP-Mail-Function-For-Fun-And-RCE.html) to use SMTP to localhost. *Please* don't be tempted to do it yourself – if you don't use PHPMailer, there are many other excellent libraries that -you should look at before rolling your own. Try [SwiftMailer](https://swiftmailer.symfony.com/) -, [Laminas/Mail](https://docs.laminas.dev/laminas-mail/), [ZetaComponents](https://github.com/zetacomponents/Mail) etc. +you should look at before rolling your own. Try [Symfony Mailer](https://symfony.com/doc/current/mailer.html), [Laminas/Mail](https://docs.laminas.dev/laminas-mail/), [ZetaComponents](https://github.com/zetacomponents/Mail), etc. ## License -This software is distributed under the [LGPL 2.1](http://www.gnu.org/licenses/lgpl-2.1.html) license, along with the [GPL Cooperation Commitment](https://gplcc.github.io/gplcc/). Please read [LICENSE](https://github.com/PHPMailer/PHPMailer/blob/master/LICENSE) for information on the software availability and distribution. +This software is distributed under the [LGPL 2.1](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html) license, along with the [GPL Cooperation Commitment](https://gplcc.github.io/gplcc/). Please read [LICENSE](https://github.com/PHPMailer/PHPMailer/blob/master/LICENSE) for information on the software availability and distribution. ## Installation & loading PHPMailer is available on [Packagist](https://packagist.org/packages/phpmailer/phpmailer) (using semantic versioning), and installation via [Composer](https://getcomposer.org) is the recommended way to install PHPMailer. Just add this line to your `composer.json` file: ```json -"phpmailer/phpmailer": "^6.2" +"phpmailer/phpmailer": "^6.10.0" ``` or run @@ -50,7 +59,8 @@ composer require phpmailer/phpmailer Note that the `vendor` folder and the `vendor/autoload.php` script are generated by Composer; they are not part of PHPMailer. -If you want to use the Gmail XOAUTH2 authentication class, you will also need to add a dependency on the `league/oauth2-client` package in your `composer.json`. +If you want to use XOAUTH2 authentication, you will also need to add a dependency on the `league/oauth2-client` and appropriate service adapters package in your `composer.json`, or take a look at +by @decomplexity's [SendOauth2 wrapper](https://github.com/decomplexity/SendOauth2), especially if you're using Microsoft services. Alternatively, if you're not using Composer, you can [download PHPMailer as a zip file](https://github.com/PHPMailer/PHPMailer/archive/master.zip), (note that docs and examples are not included in the zip file), then copy the contents of the PHPMailer folder into one of the `include_path` directories specified in your PHP configuration and load each class file manually: @@ -65,7 +75,7 @@ require 'path/to/PHPMailer/src/PHPMailer.php'; require 'path/to/PHPMailer/src/SMTP.php'; ``` -If you're not using the `SMTP` class explicitly (you're probably not), you don't need a `use` line for the SMTP class. Even if you're not using exceptions, you do still need to load the `Exception` class as it is used internally. +If you're not using the `SMTP` class explicitly (you're probably not), you don't need a `use` line for it. Even if you're not using exceptions, you do still need to load the `Exception` class as it is used internally. ## Legacy versions PHPMailer 5.2 (which is compatible with PHP 5.0 — 7.0) is no longer supported, even for security updates. You will find the latest version of 5.2 in the [5.2-stable branch](https://github.com/PHPMailer/PHPMailer/tree/5.2-stable). If you're using PHP 5.5 or later (which you should be), switch to the 6.x releases. @@ -86,10 +96,10 @@ use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\SMTP; use PHPMailer\PHPMailer\Exception; -//Load Composer's autoloader +//Load Composer's autoloader (created by composer, not included with PHPMailer) require 'vendor/autoload.php'; -//Instantiation and passing `true` enables exceptions +//Create an instance; passing `true` enables exceptions $mail = new PHPMailer(true); try { @@ -100,8 +110,8 @@ try { $mail->SMTPAuth = true; //Enable SMTP authentication $mail->Username = 'user@example.com'; //SMTP username $mail->Password = 'secret'; //SMTP password - $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; //Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged - $mail->Port = 587; //TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above + $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; //Enable implicit TLS encryption + $mail->Port = 465; //TCP port to connect to; use 587 if you have set `SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS` //Recipients $mail->setFrom('from@example.com', 'Mailer'); @@ -128,21 +138,21 @@ try { } ``` -You'll find plenty to play with in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder, which covers many common scenarios including sending through gmail, building contact forms, sending to mailing lists, and more. +You'll find plenty to play with in the [examples](https://github.com/PHPMailer/PHPMailer/tree/master/examples) folder, which covers many common scenarios including sending through Gmail, building contact forms, sending to mailing lists, and more. If you are re-using the instance (e.g. when sending to a mailing list), you may need to clear the recipient list to avoid sending duplicate messages. See [the mailing list example](https://github.com/PHPMailer/PHPMailer/blob/master/examples/mailing_list.phps) for further guidance. That's it. You should now be ready to use PHPMailer! ## Localization -PHPMailer defaults to English, but in the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder you'll find many translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](http://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this: +PHPMailer defaults to English, but in the [language](https://github.com/PHPMailer/PHPMailer/tree/master/language/) folder, you'll find many translations for PHPMailer error messages that you may encounter. Their filenames contain [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) language code for the translations, for example `fr` for French. To specify a language, you need to tell PHPMailer which one to use, like this: ```php //To load the French version $mail->setLanguage('fr', '/optional/path/to/language/directory/'); ``` -We welcome corrections and new languages – if you're looking for corrections, run the [PHPMailerLangTest.php](https://github.com/PHPMailer/PHPMailer/tree/master/test/PHPMailerLangTest.php) script in the tests folder and it will show any missing translations. +We welcome corrections and new languages – if you're looking for corrections, run the [Language/TranslationCompletenessTest.php](https://github.com/PHPMailer/PHPMailer/blob/master/test/Language/TranslationCompletenessTest.php) script in the tests folder and it will show any missing translations. ## Documentation Start reading at the [GitHub wiki](https://github.com/PHPMailer/PHPMailer/wiki). If you're having trouble, head for [the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting) as it's frequently updated. @@ -153,9 +163,9 @@ To reduce PHPMailer's deployed code footprint, examples are not included if you Complete generated API documentation is [available online](https://phpmailer.github.io/PHPMailer/). -You can generate complete API-level documentation by running `phpdoc` in the top-level folder, and documentation will appear in the `docs` folder, though you'll need to have [PHPDocumentor](http://www.phpdoc.org) installed. You may find [the unit tests](https://github.com/PHPMailer/PHPMailer/blob/master/test/PHPMailerTest.php) a good reference for how to do various operations such as encryption. +You can generate complete API-level documentation by running `phpdoc` in the top-level folder, and documentation will appear in the `docs` folder, though you'll need to have [PHPDocumentor](https://www.phpdoc.org) installed. You may find [the unit tests](https://github.com/PHPMailer/PHPMailer/blob/master/test/PHPMailer/PHPMailerTest.php) a good reference for how to do various operations such as encryption. -If the documentation doesn't cover what you need, search the [many questions on Stack Overflow](http://stackoverflow.com/questions/tagged/phpmailer), and before you ask a question about "SMTP Error: Could not connect to SMTP host.", [read the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting). +If the documentation doesn't cover what you need, search the [many questions on Stack Overflow](https://stackoverflow.com/questions/tagged/phpmailer), and before you ask a question about "SMTP Error: Could not connect to SMTP host.", [read the troubleshooting guide](https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting). ## Tests [PHPMailer tests](https://github.com/PHPMailer/PHPMailer/tree/master/test/) use PHPUnit 9, with [a polyfill](https://github.com/Yoast/PHPUnit-Polyfills) to let 9-style tests run on older PHPUnit and PHP versions. @@ -170,9 +180,9 @@ Please disclose any vulnerabilities found responsibly – report security issues See [SECURITY](https://github.com/PHPMailer/PHPMailer/tree/master/SECURITY.md) and [PHPMailer's security advisories on GitHub](https://github.com/PHPMailer/PHPMailer/security). ## Contributing -Please submit bug reports, suggestions and pull requests to the [GitHub issue tracker](https://github.com/PHPMailer/PHPMailer/issues). +Please submit bug reports, suggestions, and pull requests to the [GitHub issue tracker](https://github.com/PHPMailer/PHPMailer/issues). -We're particularly interested in fixing edge-cases, expanding test coverage and updating translations. +We're particularly interested in fixing edge cases, expanding test coverage, and updating translations. If you found a mistake in the docs, or want to add something, go ahead and amend the wiki – anyone can edit it. @@ -196,7 +206,7 @@ Donations are very welcome, whether in beer 🍺, T-shirts 👕, or cold, hard c Available as part of the Tidelift Subscription. The maintainers of PHPMailer and thousands of other packages are working with Tidelift to deliver commercial -support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and +support and maintenance for the open-source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-phpmailer-phpmailer?utm_source=packagist-phpmailer-phpmailer&utm_medium=referral&utm_campaign=enterprise&utm_term=repo) @@ -204,7 +214,7 @@ use. [Learn more.](https://tidelift.com/subscription/pkg/packagist-phpmailer-php See [changelog](changelog.md). ## History -- PHPMailer was originally written in 2001 by Brent R. Matzelle as a [SourceForge project](http://sourceforge.net/projects/phpmailer/). +- PHPMailer was originally written in 2001 by Brent R. Matzelle as a [SourceForge project](https://sourceforge.net/projects/phpmailer/). - [Marcus Bointon](https://github.com/Synchro) (`coolbru` on SF) and Andy Prevost (`codeworxtech`) took over the project in 2004. - Became an Apache incubator project on Google Code in 2010, managed by Jim Jagielski. - Marcus created [his fork on GitHub](https://github.com/Synchro/PHPMailer) in 2008. @@ -214,9 +224,9 @@ See [changelog](changelog.md). ### What's changed since moving from SourceForge? - Official successor to the SourceForge and Google Code projects. - Test suite. -- Continuous integration with Github Actions. +- Continuous integration with GitHub Actions. - Composer support. - Public development. - Additional languages and language strings. - CRAM-MD5 authentication support. -- Preserves full repo history of authors, commits and branches from the original SourceForge project. +- Preserves full repo history of authors, commits, and branches from the original SourceForge project. diff --git a/phpmailer/vendor/phpmailer/phpmailer/SECURITY.md b/phpmailer/vendor/phpmailer/phpmailer/SECURITY.md index 035a87f7..4f34026d 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/SECURITY.md +++ b/phpmailer/vendor/phpmailer/phpmailer/SECURITY.md @@ -13,13 +13,13 @@ PHPMailer versions 6.1.5 and earlier contain an output escaping bug that occurs PHPMailer versions prior to 6.0.6 and 5.2.27 are vulnerable to an object injection attack by passing `phar://` paths into `addAttachment()` and other functions that may receive unfiltered local paths, possibly leading to RCE. Recorded as [CVE-2018-19296](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2018-19296). See [this article](https://knasmueller.net/5-answers-about-php-phar-exploitation) for more info on this type of vulnerability. Mitigated by blocking the use of paths containing URL-protocol style prefixes such as `phar://`. Reported by Sehun Oh of cyberone.kr. -PHPMailer versions prior to 5.2.24 (released July 26th 2017) have an XSS vulnerability in one of the code examples, [CVE-2017-11503](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-11503). The `code_generator.phps` example did not filter user input prior to output. This file is distributed with a `.phps` extension, so it it not normally executable unless it is explicitly renamed, and the file is not included when PHPMailer is loaded through composer, so it is safe by default. There was also an undisclosed potential XSS vulnerability in the default exception handler (unused by default). Patches for both issues kindly provided by Patrick Monnerat of the Fedora Project. +PHPMailer versions prior to 5.2.24 (released July 26th 2017) have an XSS vulnerability in one of the code examples, [CVE-2017-11503](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-11503). The `code_generator.phps` example did not filter user input prior to output. This file is distributed with a `.phps` extension, so it is not normally executable unless it is explicitly renamed, and the file is not included when PHPMailer is loaded through composer, so it is safe by default. There was also an undisclosed potential XSS vulnerability in the default exception handler (unused by default). Patches for both issues kindly provided by Patrick Monnerat of the Fedora Project. PHPMailer versions prior to 5.2.22 (released January 9th 2017) have a local file disclosure vulnerability, [CVE-2017-5223](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2017-5223). If content passed into `msgHTML()` is sourced from unfiltered user input, relative paths can map to absolute local file paths and added as attachments. Also note that `addAttachment` (just like `file_get_contents`, `passthru`, `unlink`, etc) should not be passed user-sourced params either! Reported by Yongxiang Li of Asiasecurity. PHPMailer versions prior to 5.2.20 (released December 28th 2016) are vulnerable to [CVE-2016-10045](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10045) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10045-Vuln-Patch-Bypass.html), and patched by Paul Buonopane (@Zenexer). -PHPMailer versions prior to 5.2.18 (released December 2016) are vulnerable to [CVE-2016-10033](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10033) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](http://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10033-Vuln.html). +PHPMailer versions prior to 5.2.18 (released December 2016) are vulnerable to [CVE-2016-10033](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10033) a remote code execution vulnerability, responsibly reported by [Dawid Golunski](https://legalhackers.com/advisories/PHPMailer-Exploit-Remote-Code-Exec-CVE-2016-10033-Vuln.html). PHPMailer versions prior to 5.2.14 (released November 2015) are vulnerable to [CVE-2015-8476](https://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2015-8476) an SMTP CRLF injection bug permitting arbitrary message sending. diff --git a/phpmailer/vendor/phpmailer/phpmailer/SMTPUTF8.md b/phpmailer/vendor/phpmailer/phpmailer/SMTPUTF8.md new file mode 100644 index 00000000..ca284ee2 --- /dev/null +++ b/phpmailer/vendor/phpmailer/phpmailer/SMTPUTF8.md @@ -0,0 +1,48 @@ +# A short history of UTF-8 in email + +## Background + +For most of its existence, SMTP has been a 7-bit channel, only supporting US-ASCII characters. This has been a problem for many languages, especially those that use non-Latin scripts, and has led to the development of various workarounds. + +The first major improvement, introduced in 1994 in [RFC 1652](https://www.rfc-editor.org/rfc/rfc1652) and extended in 2011 in [RFC 6152](https://www.rfc-editor.org/rfc/rfc6152), was the addition of the `8BITMIME` SMTP extension, which allowed raw 8-bit data to be included in message bodies sent over SMTP. +This allowed the message *contents* to contain 8-bit data, including things like UTF-8 text, even though the SMTP protocol itself was still firmly 7-bit. This worked by having the server switch to 8-bit after the headers, and then back to 7-bit after the completion of a `DATA` command. + +From 1996, messages could support [RFC 2047 encoding](https://www.rfc-editor.org/rfc/rfc2047), which permitted inserting characters from any character set into header *values* (but not names), but only by encoding them in somewhat unreadable ways to allow them to survive passage through a 7-bit channel. An example with a subject of "Schrödinger's cat" would be: + +``` +Subject: =?utf-8?Q=Schr=C3=B6dinger=92s_Cat?= +``` + +Here the accented `ö` is encoded as `=C3=B6`, which is the UTF-8 encoding of the 2-byte character, and the whole thing is wrapped in `=?utf-8?Q?` to indicate that it uses the UTF-8 charset and `quoted-printable` encoding. This is a bit of a hack, and not very human-friendly, but it works. + +Similarly, 8-bit message bodies could be encoded using the same `quoted-printable` and `base64` content transfer encoding (CTE) schemes, which preserved the 8-bit content while encoding it in a format that could survive transmission through a 7-bit channel. + +Domain names were originally also stuck in a 7-bit world, actually even more constrained to only a subset of the US-ASCII character set. But of course, many people want to have domains in their own language/script. Internationalized domain name (IDN) permitted this, using yet another complex encoding scheme called punycode, defined for domain names in 2003 in [RFC 3492](https://www.rfc-editor.org/rfc/rfc3492). This finally allowed the domain part (after the `@`) of email addresses to contain UTF-8, though it was actually an illusion preserved by email client applications. For example, an address of +`user@café.example.com` translates to +`user@xn--caf-dma.example.com` in punycode, rendering it mostly unreadable, but 7-bit friendly, and remaining compatible with email clients that don't know about IDN. + +The one remaining part of email that could not handle UTF-8 is the local part of email addresses (the part before the `@`). + +I've only mentioned UTF-8 here, but most of these approaches also allowed other character sets that were popular, such as [the ISO-8859 family](https://en.wikipedia.org/wiki/ISO/IEC_8859). However, UTF-8 solves so many problems that these other character sets are gradually falling out of favour, as UTF-8 can support all languages. + +This patchwork of overlapping approaches has served us well, but we have to admit that it's a mess. + +## SMTPUTF8 + +`SMTPUTF8` is another SMTP extension, defined in [RFC 6531](https://www.rfc-editor.org/rfc/rfc6531) in 2012. This essentially solves the whole problem, allowing the entire SMTP conversation — commands, headers, and message bodies — to be sent in raw, unencoded UTF-8. + +But there's a problem with this approach: adoption. If you send a UTF-8 message to a recipient whose mail server doesn't support this format, the sender has to somehow downgrade the message to make it survive a transition to 7-bit. This is a hard problem to solve, especially since there is no way to make a 7-bit system support UTF-8 in the local parts of addresses. This downgrade problem is what held up the adoption of `SMTPUTF8` in PHPMailer for many years, but in that time the *de facto* approach has become to simply fail in that situation, and tell the recipient it's time they upgraded their mail server 😅. + +The vast majority of large email providers (gmail, Yahoo, Microsoft, etc), mail servers (postfix, exim, IIS, etc), and mail clients (Apple Mail, Outlook, Thunderbird, etc) now all support SMTPUTF8, so the need for backward compatibility is no longer what it was. + +## SMTPUTF8 in PHPMailer + +Several other PHP email libraries have implemented a halfway solution to `SMTPUTF8`, adding only the ability to support UTF-8 in email addresses, not elsewhere in the protocol. I wanted PHPMailer to do it "the right way", and this has taken much longer. PHPMailer now supports UTF-8 everywhere, and does not need to use transfer or header encodings for UTF-8 text when connecting to an `SMTPUTF8`-capable mail server. + +This support is handled automatically: if you add an email address that requires UTF-8, PHPMailer will use UTF-8 for everything. If not, it will fall back to 7-bit and encode the message as necessary. + +The one place you will need to be careful is in the selection of the address validator. By default, PHPMailer uses PHP's built-in `filter_var` validator, which does not allow UTF-8 email addresses. When PHPMailer spots that you have submitted a UTF-8 address, but have not altered the default validator, it will automatically switch to using a UTF-8-compatible validator. As soon as you do this, any SMTP connection you make will *require* that the server you connect to supports `SMTPUTF8`. You can select this validator explicitly by setting `PHPMailer::$validator = 'eai'` (an acronym for Email Address Internationalization). + +### Postfix gotcha + +Postfix has supported `SMTPUTF8` for a long time, but it has a peculiarity that it does not always advertise that it does so. However, rather surprisingly, if you use UTF-8 in the conversation, it will work anyway. diff --git a/phpmailer/vendor/phpmailer/phpmailer/VERSION b/phpmailer/vendor/phpmailer/phpmailer/VERSION index 4be2c727..cf79bf90 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/VERSION +++ b/phpmailer/vendor/phpmailer/phpmailer/VERSION @@ -1 +1 @@ -6.5.0 \ No newline at end of file +6.10.0 diff --git a/phpmailer/vendor/phpmailer/phpmailer/composer.json b/phpmailer/vendor/phpmailer/phpmailer/composer.json index 58393b2c..7b008b7c 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/composer.json +++ b/phpmailer/vendor/phpmailer/phpmailer/composer.json @@ -25,6 +25,12 @@ "type": "github" } ], + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + }, + "lock": false + }, "require": { "php": ">=5.5.0", "ext-ctype": "*", @@ -32,19 +38,24 @@ "ext-hash": "*" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "doctrine/annotations": "^1.2", + "dealerdirect/phpcodesniffer-composer-installer": "^1.0", + "doctrine/annotations": "^1.2.6 || ^1.13.3", + "php-parallel-lint/php-console-highlighter": "^1.0.0", + "php-parallel-lint/php-parallel-lint": "^1.3.2", "phpcompatibility/php-compatibility": "^9.3.5", "roave/security-advisories": "dev-latest", - "squizlabs/php_codesniffer": "^3.5.6", - "yoast/phpunit-polyfills": "^0.2.0" + "squizlabs/php_codesniffer": "^3.7.2", + "yoast/phpunit-polyfills": "^1.0.4" }, "suggest": { + "decomplexity/SendOauth2": "Adapter for using XOAUTH2 authentication", "ext-mbstring": "Needed to send email in multibyte encoding charset or decode encoded addresses", + "ext-openssl": "Needed for secure SMTP sending and DKIM signing", + "greew/oauth2-azure-provider": "Needed for Microsoft Azure XOAUTH2 authentication", "hayageek/oauth2-yahoo": "Needed for Yahoo XOAUTH2 authentication", "league/oauth2-google": "Needed for Google XOAUTH2 authentication", "psr/log": "For optional PSR-3 debug logging", - "stevenmaguire/oauth2-microsoft": "Needed for Microsoft XOAUTH2 authentication", + "thenetworg/oauth2-azure": "Needed for Microsoft XOAUTH2 authentication", "symfony/polyfill-mbstring": "To support UTF-8 if the Mbstring PHP extension is not enabled (^1.2)" }, "autoload": { @@ -60,6 +71,10 @@ "license": "LGPL-2.1-only", "scripts": { "check": "./vendor/bin/phpcs", - "test": "./vendor/bin/phpunit" + "test": "./vendor/bin/phpunit --no-coverage", + "coverage": "./vendor/bin/phpunit", + "lint": [ + "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . --show-deprecated -e php,phps --exclude vendor --exclude .git --exclude build" + ] } } diff --git a/phpmailer/vendor/phpmailer/phpmailer/get_oauth_token.php b/phpmailer/vendor/phpmailer/phpmailer/get_oauth_token.php index befdc34a..0e54a00b 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/get_oauth_token.php +++ b/phpmailer/vendor/phpmailer/phpmailer/get_oauth_token.php @@ -12,7 +12,7 @@ * @copyright 2012 - 2020 Marcus Bointon * @copyright 2010 - 2012 Jim Jagielski * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License + * @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License * @note This program is distributed in the hope that it will be useful - WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. @@ -36,7 +36,7 @@ namespace PHPMailer\PHPMailer; * Aliases for League Provider Classes * Make sure you have added these to your composer.json and run `composer install` * Plenty to choose from here: - * @see http://oauth2-client.thephpleague.com/providers/thirdparty/ + * @see https://oauth2-client.thephpleague.com/providers/thirdparty/ */ //@see https://github.com/thephpleague/oauth2-google use League\OAuth2\Client\Provider\Google; @@ -44,14 +44,31 @@ use League\OAuth2\Client\Provider\Google; use Hayageek\OAuth2\Client\Provider\Yahoo; //@see https://github.com/stevenmaguire/oauth2-microsoft use Stevenmaguire\OAuth2\Client\Provider\Microsoft; +//@see https://github.com/greew/oauth2-azure-provider +use Greew\OAuth2\Client\Provider\Azure; -if (!isset($_GET['code']) && !isset($_GET['provider'])) { +if (!isset($_GET['code']) && !isset($_POST['provider'])) { ?> -Select Provider:
-
Google
-Yahoo
-Microsoft/Outlook/Hotmail/Live/Office365
+ +
+

Select Provider

+ +
+ +
+ +
+ +
+

Enter id and secret

+

These details are obtained by setting up an app in your provider's developer console. +

+

ClientId:

+

ClientSecret:

+

TenantID (only relevant for Azure):

+ +
[ + 'https://outlook.office.com/SMTP.Send', + 'offline_access' + ] + ]; + break; } if (null === $provider) { @@ -142,5 +178,5 @@ if (!isset($_GET['code'])) { ); //Use this to interact with an API on the users behalf //Use this to get a new access token if the old one expires - echo 'Refresh Token: ', $token->getRefreshToken(); + echo 'Refresh Token: ', htmlspecialchars($token->getRefreshToken()); } diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-as.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-as.php new file mode 100644 index 00000000..327dfbaf --- /dev/null +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-as.php @@ -0,0 +1,35 @@ + + */ + +$PHPMAILER_LANG['authenticate'] = 'SMTP ত্ৰুটি: প্ৰমাণীকৰণ কৰিব নোৱাৰি'; +$PHPMAILER_LANG['buggy_php'] = 'আপোনাৰ PHP সংস্কৰণ এটা বাগৰ দ্বাৰা প্ৰভাৱিত হয় যাৰ ফলত নষ্ট বাৰ্তা হব পাৰে । ইয়াক সমাধান কৰিবলে, প্ৰেৰণ কৰিবলে SMTP ব্যৱহাৰ কৰক, আপোনাৰ php.ini ত mail.add_x_header বিকল্প নিষ্ক্ৰিয় কৰক, MacOS বা Linux লৈ সলনি কৰক, বা আপোনাৰ PHP সংস্কৰণ 7.0.17+ বা 7.1.3+ লৈ সলনি কৰক ।'; +$PHPMAILER_LANG['connect_host'] = 'SMTP ত্ৰুটি: SMTP চাৰ্ভাৰৰ সৈতে সংযোগ কৰিবলে অক্ষম'; +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP ত্ৰুটি: তথ্য গ্ৰহণ কৰা হোৱা নাই'; +$PHPMAILER_LANG['empty_message'] = 'বাৰ্তাৰ মূখ্য অংশ খালী।'; +$PHPMAILER_LANG['encoding'] = 'অজ্ঞাত এনকোডিং: '; +$PHPMAILER_LANG['execute'] = 'এক্সিকিউট কৰিব নোৱাৰি: '; +$PHPMAILER_LANG['extension_missing'] = 'সম্প্ৰসাৰণ নোহোৱা হৈছে: '; +$PHPMAILER_LANG['file_access'] = 'ফাইল অভিগম কৰিবলে অক্ষম: '; +$PHPMAILER_LANG['file_open'] = 'ফাইল ত্ৰুটি: ফাইল খোলিবলৈ অক্ষম: '; +$PHPMAILER_LANG['from_failed'] = 'নিম্নলিখিত প্ৰেৰকৰ ঠিকনা(সমূহ) ব্যৰ্থ: '; +$PHPMAILER_LANG['instantiate'] = 'মেইল ফাংচনৰ এটা উদাহৰণ সৃষ্টি কৰিবলে অক্ষম'; +$PHPMAILER_LANG['invalid_address'] = 'প্ৰেৰণ কৰিব নোৱাৰি: অবৈধ ইমেইল ঠিকনা: '; +$PHPMAILER_LANG['invalid_header'] = 'অবৈধ হেডাৰৰ নাম বা মান'; +$PHPMAILER_LANG['invalid_hostentry'] = 'অবৈধ হোষ্টেন্ট্ৰি: '; +$PHPMAILER_LANG['invalid_host'] = 'অবৈধ হস্ট:'; +$PHPMAILER_LANG['mailer_not_supported'] = 'মেইলাৰ সমৰ্থিত নহয়।'; +$PHPMAILER_LANG['provide_address'] = 'আপুনি অন্ততঃ এটা গন্তব্য ইমেইল ঠিকনা দিব লাগিব'; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP ত্ৰুটি: নিম্নলিখিত গন্তব্যস্থানসমূহ ব্যৰ্থ: '; +$PHPMAILER_LANG['signing'] = 'স্বাক্ষৰ কৰাত ব্যৰ্থ: '; +$PHPMAILER_LANG['smtp_code'] = 'SMTP কড: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'অতিৰিক্ত SMTP তথ্য: '; +$PHPMAILER_LANG['smtp_detail'] = 'বিৱৰণ:'; +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP সংযোগ() ব্যৰ্থ'; +$PHPMAILER_LANG['smtp_error'] = 'SMTP চাৰ্ভাৰৰ ত্ৰুটি: '; +$PHPMAILER_LANG['variable_set'] = 'চলক নিৰ্ধাৰণ কৰিব পৰা নগল: '; +$PHPMAILER_LANG['extension_missing'] = 'অনুপস্থিত সম্প্ৰসাৰণ: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-bn.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-bn.php new file mode 100644 index 00000000..47365108 --- /dev/null +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-bn.php @@ -0,0 +1,35 @@ + + */ + +$PHPMAILER_LANG['authenticate'] = 'SMTP ত্রুটি: প্রমাণীকরণ করতে অক্ষম৷'; +$PHPMAILER_LANG['buggy_php'] = 'আপনার PHP সংস্করণ একটি বাগ দ্বারা প্রভাবিত হয় যার ফলে দূষিত বার্তা হতে পারে। এটি ঠিক করতে, পাঠাতে SMTP ব্যবহার করুন, আপনার php.ini এ mail.add_x_header বিকল্পটি নিষ্ক্রিয় করুন, MacOS বা Linux-এ স্যুইচ করুন, অথবা আপনার PHP সংস্করণকে 7.0.17+ বা 7.1.3+ এ পরিবর্তন করুন।'; +$PHPMAILER_LANG['connect_host'] = 'SMTP ত্রুটি: SMTP সার্ভারের সাথে সংযোগ করতে অক্ষম৷'; +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP ত্রুটি: ডেটা গ্রহণ করা হয়নি৷'; +$PHPMAILER_LANG['empty_message'] = 'বার্তার অংশটি খালি।'; +$PHPMAILER_LANG['encoding'] = 'অজানা এনকোডিং: '; +$PHPMAILER_LANG['execute'] = 'নির্বাহ করতে অক্ষম: '; +$PHPMAILER_LANG['extension_missing'] = 'এক্সটেনশন অনুপস্থিত:'; +$PHPMAILER_LANG['file_access'] = 'ফাইল অ্যাক্সেস করতে অক্ষম: '; +$PHPMAILER_LANG['file_open'] = 'ফাইল ত্রুটি: ফাইল খুলতে অক্ষম: '; +$PHPMAILER_LANG['from_failed'] = 'নিম্নলিখিত প্রেরকের ঠিকানা(গুলি) ব্যর্থ হয়েছে: '; +$PHPMAILER_LANG['instantiate'] = 'মেল ফাংশনের একটি উদাহরণ তৈরি করতে অক্ষম৷'; +$PHPMAILER_LANG['invalid_address'] = 'পাঠাতে অক্ষম: অবৈধ ইমেল ঠিকানা: '; +$PHPMAILER_LANG['invalid_header'] = 'অবৈধ হেডার নাম বা মান'; +$PHPMAILER_LANG['invalid_hostentry'] = 'অবৈধ হোস্টেন্ট্রি: '; +$PHPMAILER_LANG['invalid_host'] = 'অবৈধ হোস্ট:'; +$PHPMAILER_LANG['mailer_not_supported'] = 'মেইলার সমর্থিত নয়।'; +$PHPMAILER_LANG['provide_address'] = 'আপনাকে অবশ্যই অন্তত একটি গন্তব্য ইমেল ঠিকানা প্রদান করতে হবে৷'; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP ত্রুটি: নিম্নলিখিত গন্তব্যগুলি ব্যর্থ হয়েছে: '; +$PHPMAILER_LANG['signing'] = 'স্বাক্ষর করতে ব্যর্থ হয়েছে: '; +$PHPMAILER_LANG['smtp_code'] = 'SMTP কোড: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'অতিরিক্ত SMTP তথ্য:'; +$PHPMAILER_LANG['smtp_detail'] = 'বর্ণনা: '; +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP সংযোগ() ব্যর্থ হয়েছে৷'; +$PHPMAILER_LANG['smtp_error'] = 'SMTP সার্ভার ত্রুটি: '; +$PHPMAILER_LANG['variable_set'] = 'পরিবর্তনশীল সেট করা যায়নি: '; +$PHPMAILER_LANG['extension_missing'] = 'অনুপস্থিত এক্সটেনশন: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ch.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ch.php deleted file mode 100644 index 500c9526..00000000 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ch.php +++ /dev/null @@ -1,27 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP 错误:身份验证失败。'; -$PHPMAILER_LANG['connect_host'] = 'SMTP 错误: 不能连接SMTP主机。'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误: 数据不可接受。'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = '未知编码:'; -$PHPMAILER_LANG['execute'] = '不能执行: '; -$PHPMAILER_LANG['file_access'] = '不能访问文件:'; -$PHPMAILER_LANG['file_open'] = '文件错误:不能打开文件:'; -$PHPMAILER_LANG['from_failed'] = '下面的发送地址邮件发送失败了: '; -$PHPMAILER_LANG['instantiate'] = '不能实现mail方法。'; -//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' 您所选择的发送邮件的方法并不支持。'; -$PHPMAILER_LANG['provide_address'] = '您必须提供至少一个 收信人的email地址。'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误: 下面的 收件人失败了: '; -//$PHPMAILER_LANG['signing'] = 'Signing Error: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-da.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-da.php index 1edba1d7..db9a1ef5 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-da.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-da.php @@ -9,21 +9,28 @@ */ $PHPMAILER_LANG['authenticate'] = 'SMTP fejl: Login mislykkedes.'; +$PHPMAILER_LANG['buggy_php'] = 'Din version af PHP er berørt af en fejl, som gør at dine beskeder muligvis vises forkert. For at rette dette kan du skifte til SMTP, slå mail.add_x_header headeren i din php.ini fil fra, skifte til MacOS eller Linux eller opgradere din version af PHP til 7.0.17+ eller 7.1.3+.'; $PHPMAILER_LANG['connect_host'] = 'SMTP fejl: Forbindelse til SMTP serveren kunne ikke oprettes.'; $PHPMAILER_LANG['data_not_accepted'] = 'SMTP fejl: Data blev ikke accepteret.'; $PHPMAILER_LANG['empty_message'] = 'Meddelelsen er uden indhold'; $PHPMAILER_LANG['encoding'] = 'Ukendt encode-format: '; $PHPMAILER_LANG['execute'] = 'Kunne ikke afvikle: '; +$PHPMAILER_LANG['extension_missing'] = 'Udvidelse mangler: '; $PHPMAILER_LANG['file_access'] = 'Kunne ikke tilgå filen: '; $PHPMAILER_LANG['file_open'] = 'Fil fejl: Kunne ikke åbne filen: '; $PHPMAILER_LANG['from_failed'] = 'Følgende afsenderadresse er forkert: '; $PHPMAILER_LANG['instantiate'] = 'Email funktionen kunne ikke initialiseres.'; $PHPMAILER_LANG['invalid_address'] = 'Udgyldig adresse: '; +$PHPMAILER_LANG['invalid_header'] = 'Ugyldig header navn eller værdi'; +$PHPMAILER_LANG['invalid_hostentry'] = 'Ugyldig hostentry: '; +$PHPMAILER_LANG['invalid_host'] = 'Ugyldig vært: '; $PHPMAILER_LANG['mailer_not_supported'] = ' mailer understøttes ikke.'; $PHPMAILER_LANG['provide_address'] = 'Indtast mindst en modtagers email adresse.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP fejl: Følgende modtagere er forkerte: '; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP fejl: Følgende modtagere fejlede: '; $PHPMAILER_LANG['signing'] = 'Signeringsfejl: '; +$PHPMAILER_LANG['smtp_code'] = 'SMTP kode: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'Yderligere SMTP info: '; $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() fejlede.'; +$PHPMAILER_LANG['smtp_detail'] = 'Detalje: '; $PHPMAILER_LANG['smtp_error'] = 'SMTP server fejl: '; $PHPMAILER_LANG['variable_set'] = 'Kunne ikke definere eller nulstille variablen: '; -$PHPMAILER_LANG['extension_missing'] = 'Udvidelse mangler: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-el.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-el.php index b3d5ca94..339ee575 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-el.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-el.php @@ -5,22 +5,29 @@ * @package PHPMailer */ -$PHPMAILER_LANG['authenticate'] = 'SMTP Σφάλμα: Αδυναμία πιστοποίησης (authentication).'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Σφάλμα: Αδυναμία σύνδεσης στον SMTP-Host.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Σφάλμα: Τα δεδομένα δεν έγιναν αποδεκτά.'; -$PHPMAILER_LANG['empty_message'] = 'Το E-Mail δεν έχει περιεχόμενο .'; -$PHPMAILER_LANG['encoding'] = 'Αγνωστο Encoding-Format: '; -$PHPMAILER_LANG['execute'] = 'Αδυναμία εκτέλεσης ακόλουθης εντολής: '; -$PHPMAILER_LANG['file_access'] = 'Αδυναμία προσπέλασης του αρχείου: '; -$PHPMAILER_LANG['file_open'] = 'Σφάλμα Αρχείου: Δεν είναι δυνατό το άνοιγμα του ακόλουθου αρχείου: '; -$PHPMAILER_LANG['from_failed'] = 'Η παρακάτω διεύθυνση αποστολέα δεν είναι σωστή: '; -$PHPMAILER_LANG['instantiate'] = 'Αδυναμία εκκίνησης Mail function.'; -$PHPMAILER_LANG['invalid_address'] = 'Το μήνυμα δεν εστάλη, η διεύθυνση δεν είναι έγκυρη: '; +$PHPMAILER_LANG['authenticate'] = 'Σφάλμα SMTP: Αδυναμία πιστοποίησης.'; +$PHPMAILER_LANG['buggy_php'] = 'Η έκδοση PHP που χρησιμοποιείτε παρουσιάζει σφάλμα που μπορεί να έχει ως αποτέλεσμα κατεστραμένα μηνύματα. Για να το διορθώσετε, αλλάξτε τον τρόπο αποστολής σε SMTP, απενεργοποιήστε την επιλογή mail.add_x_header στο αρχείο php.ini, αλλάξτε λειτουργικό σε MacOS ή Linux ή αναβαθμίστε την PHP σε έκδοση 7.0.17+ ή 7.1.3+.'; +$PHPMAILER_LANG['connect_host'] = 'Σφάλμα SMTP: Αδυναμία σύνδεσης με τον φιλοξενητή SMTP.'; +$PHPMAILER_LANG['data_not_accepted'] = 'Σφάλμα SMTP: Μη αποδεκτά δεδομένα.'; +$PHPMAILER_LANG['empty_message'] = 'Η ηλεκτρονική επιστολή δεν έχει περιεχόμενο.'; +$PHPMAILER_LANG['encoding'] = 'Άγνωστη μορφή κωδικοποίησης: '; +$PHPMAILER_LANG['execute'] = 'Αδυναμία εκτέλεσης: '; +$PHPMAILER_LANG['extension_missing'] = 'Απουσία επέκτασης: '; +$PHPMAILER_LANG['file_access'] = 'Αδυναμία πρόσβασης στο αρχείο: '; +$PHPMAILER_LANG['file_open'] = 'Σφάλμα Αρχείου: Αδυναμία ανοίγματος αρχείου: '; +$PHPMAILER_LANG['from_failed'] = 'Η ακόλουθη διεύθυνση αποστολέα δεν είναι σωστή: '; +$PHPMAILER_LANG['instantiate'] = 'Αδυναμία εκκίνησης συνάρτησης Mail.'; +$PHPMAILER_LANG['invalid_address'] = 'Μη έγκυρη διεύθυνση: '; +$PHPMAILER_LANG['invalid_header'] = 'Μη έγκυρο όνομα κεφαλίδας ή τιμή'; +$PHPMAILER_LANG['invalid_hostentry'] = 'Μη έγκυρη εισαγωγή φιλοξενητή: '; +$PHPMAILER_LANG['invalid_host'] = 'Μη έγκυρος φιλοξενητής: '; $PHPMAILER_LANG['mailer_not_supported'] = ' mailer δεν υποστηρίζεται.'; -$PHPMAILER_LANG['provide_address'] = 'Παρακαλούμε δώστε τουλάχιστον μια e-mail διεύθυνση παραλήπτη.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Σφάλμα: Οι παρακάτω διευθύνσεις παραλήπτη δεν είναι έγκυρες: '; +$PHPMAILER_LANG['provide_address'] = 'Δώστε τουλάχιστον μια ηλεκτρονική διεύθυνση παραλήπτη.'; +$PHPMAILER_LANG['recipients_failed'] = 'Σφάλμα SMTP: Οι παρακάτω διευθύνσεις παραλήπτη δεν είναι έγκυρες: '; $PHPMAILER_LANG['signing'] = 'Σφάλμα υπογραφής: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Αποτυχία σύνδεσης στον SMTP Server.'; -$PHPMAILER_LANG['smtp_error'] = 'Σφάλμα από τον SMTP Server: '; -$PHPMAILER_LANG['variable_set'] = 'Αδυναμία ορισμού ή αρχικοποίησης μεταβλητής: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; +$PHPMAILER_LANG['smtp_code'] = 'Κώδικάς SMTP: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'Πρόσθετες πληροφορίες SMTP: '; +$PHPMAILER_LANG['smtp_connect_failed'] = 'Αποτυχία σύνδεσης SMTP.'; +$PHPMAILER_LANG['smtp_detail'] = 'Λεπτομέρεια: '; +$PHPMAILER_LANG['smtp_error'] = 'Σφάλμα με τον διακομιστή SMTP: '; +$PHPMAILER_LANG['variable_set'] = 'Αδυναμία ορισμού ή επαναφοράς μεταβλητής: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php index 6ba74627..4e74bfb7 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-es.php @@ -4,24 +4,33 @@ * Spanish PHPMailer language file: refer to English translation for definitive list * @package PHPMailer * @author Matt Sturdy + * @author Crystopher Glodzienski Cardoso + * @author Daniel Cruz */ $PHPMAILER_LANG['authenticate'] = 'Error SMTP: Imposible autentificar.'; +$PHPMAILER_LANG['buggy_php'] = 'Tu versión de PHP está afectada por un bug que puede resultar en mensajes corruptos. Para arreglarlo, cambia a enviar usando SMTP, deshabilita la opción mail.add_x_header en tu php.ini, cambia a MacOS o Linux, o actualiza tu PHP a la versión 7.0.17+ o 7.1.3+.'; $PHPMAILER_LANG['connect_host'] = 'Error SMTP: Imposible conectar al servidor SMTP.'; $PHPMAILER_LANG['data_not_accepted'] = 'Error SMTP: Datos no aceptados.'; $PHPMAILER_LANG['empty_message'] = 'El cuerpo del mensaje está vacío.'; $PHPMAILER_LANG['encoding'] = 'Codificación desconocida: '; $PHPMAILER_LANG['execute'] = 'Imposible ejecutar: '; +$PHPMAILER_LANG['extension_missing'] = 'Extensión faltante: '; $PHPMAILER_LANG['file_access'] = 'Imposible acceder al archivo: '; $PHPMAILER_LANG['file_open'] = 'Error de Archivo: Imposible abrir el archivo: '; $PHPMAILER_LANG['from_failed'] = 'La(s) siguiente(s) direcciones de remitente fallaron: '; $PHPMAILER_LANG['instantiate'] = 'Imposible crear una instancia de la función Mail.'; $PHPMAILER_LANG['invalid_address'] = 'Imposible enviar: dirección de email inválido: '; +$PHPMAILER_LANG['invalid_header'] = 'Nombre o valor de encabezado no válido'; +$PHPMAILER_LANG['invalid_hostentry'] = 'Hostentry inválido: '; +$PHPMAILER_LANG['invalid_host'] = 'Host inválido: '; $PHPMAILER_LANG['mailer_not_supported'] = ' mailer no está soportado.'; $PHPMAILER_LANG['provide_address'] = 'Debe proporcionar al menos una dirección de email de destino.'; $PHPMAILER_LANG['recipients_failed'] = 'Error SMTP: Los siguientes destinos fallaron: '; $PHPMAILER_LANG['signing'] = 'Error al firmar: '; +$PHPMAILER_LANG['smtp_code'] = 'Código del servidor SMTP: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'Información adicional del servidor SMTP: '; $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falló.'; +$PHPMAILER_LANG['smtp_detail'] = 'Detalle: '; $PHPMAILER_LANG['smtp_error'] = 'Error del servidor SMTP: '; $PHPMAILER_LANG['variable_set'] = 'No se pudo configurar la variable: '; -$PHPMAILER_LANG['extension_missing'] = 'Extensión faltante: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php index 243c0548..6d1e6373 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fi.php @@ -20,7 +20,6 @@ $PHPMAILER_LANG['instantiate'] = 'mail-funktion luonti epäonnistui.'; $PHPMAILER_LANG['mailer_not_supported'] = 'postivälitintyyppiä ei tueta.'; $PHPMAILER_LANG['provide_address'] = 'Aseta vähintään yksi vastaanottajan sähköpostiosoite.'; $PHPMAILER_LANG['recipients_failed'] = 'SMTP-virhe: seuraava vastaanottaja osoite on virheellinen.'; -$PHPMAILER_LANG['encoding'] = 'Tuntematon koodaustyyppi: '; //$PHPMAILER_LANG['signing'] = 'Signing Error: '; //$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; //$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php index b57f0ec6..a6d582d8 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-fr.php @@ -6,27 +6,31 @@ * Some French punctuation requires a thin non-breaking space (U+202F) character before it, * for example before a colon or exclamation mark. * There is one of these characters between these quotes: " " - * @see http://unicode.org/udhr/n/notes_fra.html */ -$PHPMAILER_LANG['authenticate'] = 'Erreur SMTP : échec de l\'authentification.'; +$PHPMAILER_LANG['authenticate'] = 'Erreur SMTP : échec de l’authentification.'; +$PHPMAILER_LANG['buggy_php'] = 'Votre version de PHP est affectée par un bug qui peut entraîner des messages corrompus. Pour résoudre ce problème, passez à l’envoi par SMTP, désactivez l’option mail.add_x_header dans le fichier php.ini, passez à MacOS ou Linux, ou passez PHP à la version 7.0.17+ ou 7.1.3+.'; $PHPMAILER_LANG['connect_host'] = 'Erreur SMTP : impossible de se connecter au serveur SMTP.'; $PHPMAILER_LANG['data_not_accepted'] = 'Erreur SMTP : données incorrectes.'; $PHPMAILER_LANG['empty_message'] = 'Corps du message vide.'; $PHPMAILER_LANG['encoding'] = 'Encodage inconnu : '; -$PHPMAILER_LANG['execute'] = 'Impossible de lancer l\'exécution : '; -$PHPMAILER_LANG['file_access'] = 'Impossible d\'accéder au fichier : '; +$PHPMAILER_LANG['execute'] = 'Impossible de lancer l’exécution : '; +$PHPMAILER_LANG['extension_missing'] = 'Extension manquante : '; +$PHPMAILER_LANG['file_access'] = 'Impossible d’accéder au fichier : '; $PHPMAILER_LANG['file_open'] = 'Ouverture du fichier impossible : '; -$PHPMAILER_LANG['from_failed'] = 'L\'adresse d\'expéditeur suivante a échoué : '; -$PHPMAILER_LANG['instantiate'] = 'Impossible d\'instancier la fonction mail.'; -$PHPMAILER_LANG['invalid_address'] = 'L\'adresse courriel n\'est pas valide : '; -$PHPMAILER_LANG['invalid_hostentry'] = 'L\'entrée hôte n\'est pas valide : '; -$PHPMAILER_LANG['invalid_host'] = 'L\'hôte n\'est pas valide : '; +$PHPMAILER_LANG['from_failed'] = 'L’adresse d’expéditeur suivante a échoué : '; +$PHPMAILER_LANG['instantiate'] = 'Impossible d’instancier la fonction mail.'; +$PHPMAILER_LANG['invalid_address'] = 'Adresse courriel non valide : '; +$PHPMAILER_LANG['invalid_header'] = 'Nom ou valeur de l’en-tête non valide'; +$PHPMAILER_LANG['invalid_hostentry'] = 'Entrée d’hôte non valide : '; +$PHPMAILER_LANG['invalid_host'] = 'Hôte non valide : '; $PHPMAILER_LANG['mailer_not_supported'] = ' client de messagerie non supporté.'; $PHPMAILER_LANG['provide_address'] = 'Vous devez fournir au moins une adresse de destinataire.'; -$PHPMAILER_LANG['recipients_failed'] = 'Erreur SMTP : les destinataires suivants sont en erreur : '; +$PHPMAILER_LANG['recipients_failed'] = 'Erreur SMTP : les destinataires suivants ont échoué : '; $PHPMAILER_LANG['signing'] = 'Erreur de signature : '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Échec de la connexion SMTP.'; +$PHPMAILER_LANG['smtp_code'] = 'Code SMTP : '; +$PHPMAILER_LANG['smtp_code_ex'] = 'Informations supplémentaires SMTP : '; +$PHPMAILER_LANG['smtp_connect_failed'] = 'La fonction SMTP connect() a échoué.'; +$PHPMAILER_LANG['smtp_detail'] = 'Détails : '; $PHPMAILER_LANG['smtp_error'] = 'Erreur du serveur SMTP : '; -$PHPMAILER_LANG['variable_set'] = 'Impossible d\'initialiser ou de réinitialiser une variable : '; -$PHPMAILER_LANG['extension_missing'] = 'Extension manquante : '; +$PHPMAILER_LANG['variable_set'] = 'Impossible d’initialiser ou de réinitialiser une variable : '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-hi.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-hi.php index d973a359..d2856e05 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-hi.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-hi.php @@ -4,24 +4,32 @@ * Hindi PHPMailer language file: refer to English translation for definitive list * @package PHPMailer * @author Yash Karanke + * Rewrite and extension of the work by Jayanti Suthar */ $PHPMAILER_LANG['authenticate'] = 'SMTP त्रुटि: प्रामाणिकता की जांच नहीं हो सका। '; +$PHPMAILER_LANG['buggy_php'] = 'PHP का आपका संस्करण एक बग से प्रभावित है जिसके परिणामस्वरूप संदेश दूषित हो सकते हैं. इसे ठीक करने हेतु, भेजने के लिए SMTP का उपयोग करे, अपने php.ini में mail.add_x_header विकल्प को अक्षम करें, MacOS या Linux पर जाए, या अपने PHP संस्करण को 7.0.17+ या 7.1.3+ बदले.'; $PHPMAILER_LANG['connect_host'] = 'SMTP त्रुटि: SMTP सर्वर से कनेक्ट नहीं हो सका। '; $PHPMAILER_LANG['data_not_accepted'] = 'SMTP त्रुटि: डेटा स्वीकार नहीं किया जाता है। '; $PHPMAILER_LANG['empty_message'] = 'संदेश खाली है। '; $PHPMAILER_LANG['encoding'] = 'अज्ञात एन्कोडिंग प्रकार। '; $PHPMAILER_LANG['execute'] = 'आदेश को निष्पादित करने में विफल। '; +$PHPMAILER_LANG['extension_missing'] = 'एक्सटेन्षन गायब है: '; $PHPMAILER_LANG['file_access'] = 'फ़ाइल उपलब्ध नहीं है। '; $PHPMAILER_LANG['file_open'] = 'फ़ाइल त्रुटि: फाइल को खोला नहीं जा सका। '; $PHPMAILER_LANG['from_failed'] = 'प्रेषक का पता गलत है। '; $PHPMAILER_LANG['instantiate'] = 'मेल फ़ंक्शन कॉल नहीं कर सकता है।'; $PHPMAILER_LANG['invalid_address'] = 'पता गलत है। '; +$PHPMAILER_LANG['invalid_header'] = 'अमान्य हेडर नाम या मान'; +$PHPMAILER_LANG['invalid_hostentry'] = 'अमान्य hostentry: '; +$PHPMAILER_LANG['invalid_host'] = 'अमान्य होस्ट: '; $PHPMAILER_LANG['mailer_not_supported'] = 'मेल सर्वर के साथ काम नहीं करता है। '; $PHPMAILER_LANG['provide_address'] = 'आपको कम से कम एक प्राप्तकर्ता का ई-मेल पता प्रदान करना होगा।'; $PHPMAILER_LANG['recipients_failed'] = 'SMTP त्रुटि: निम्न प्राप्तकर्ताओं को पते भेजने में विफल। '; -$PHPMAILER_LANG['signing'] = 'साइनअप त्रुटि:। '; +$PHPMAILER_LANG['signing'] = 'साइनअप त्रुटि: '; +$PHPMAILER_LANG['smtp_code'] = 'SMTP कोड: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'अतिरिक्त SMTP जानकारी: '; $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP का connect () फ़ंक्शन विफल हुआ। '; +$PHPMAILER_LANG['smtp_detail'] = 'विवरण: '; $PHPMAILER_LANG['smtp_error'] = 'SMTP सर्वर त्रुटि। '; $PHPMAILER_LANG['variable_set'] = 'चर को बना या संशोधित नहीं किया जा सकता। '; -$PHPMAILER_LANG['extension_missing'] = 'एक्सटेन्षन गायब है: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ja.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ja.php index eee79898..d01869ce 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ja.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ja.php @@ -3,26 +3,35 @@ /** * Japanese PHPMailer language file: refer to English translation for definitive list * @package PHPMailer - * @author Mitsuhiro Yoshida + * @author Mitsuhiro Yoshida * @author Yoshi Sakai + * @author Arisophy + * @author ARAKI Musashi */ $PHPMAILER_LANG['authenticate'] = 'SMTPエラー: 認証できませんでした。'; +$PHPMAILER_LANG['buggy_php'] = 'ご利用のバージョンのPHPには不具合があり、メッセージが破損するおそれがあります。問題の解決は以下のいずれかを行ってください。SMTPでの送信に切り替える。php.iniのmail.add_x_headerをoffにする。MacOSまたはLinuxに切り替える。PHPバージョン7.0.17以降または7.1.3以降にアップグレードする。'; $PHPMAILER_LANG['connect_host'] = 'SMTPエラー: SMTPホストに接続できませんでした。'; $PHPMAILER_LANG['data_not_accepted'] = 'SMTPエラー: データが受け付けられませんでした。'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; +$PHPMAILER_LANG['empty_message'] = 'メール本文が空です。'; $PHPMAILER_LANG['encoding'] = '不明なエンコーディング: '; $PHPMAILER_LANG['execute'] = '実行できませんでした: '; +$PHPMAILER_LANG['extension_missing'] = '拡張機能が見つかりません: '; $PHPMAILER_LANG['file_access'] = 'ファイルにアクセスできません: '; $PHPMAILER_LANG['file_open'] = 'ファイルエラー: ファイルを開けません: '; $PHPMAILER_LANG['from_failed'] = 'Fromアドレスを登録する際にエラーが発生しました: '; $PHPMAILER_LANG['instantiate'] = 'メール関数が正常に動作しませんでした。'; -//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; -$PHPMAILER_LANG['provide_address'] = '少なくとも1つメールアドレスを 指定する必要があります。'; +$PHPMAILER_LANG['invalid_address'] = '不正なメールアドレス: '; +$PHPMAILER_LANG['invalid_header'] = '不正なヘッダー名またはその内容'; +$PHPMAILER_LANG['invalid_hostentry'] = '不正なホストエントリー: '; +$PHPMAILER_LANG['invalid_host'] = '不正なホスト: '; $PHPMAILER_LANG['mailer_not_supported'] = ' メーラーがサポートされていません。'; +$PHPMAILER_LANG['provide_address'] = '少なくとも1つメールアドレスを 指定する必要があります。'; $PHPMAILER_LANG['recipients_failed'] = 'SMTPエラー: 次の受信者アドレスに 間違いがあります: '; -//$PHPMAILER_LANG['signing'] = 'Signing Error: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; +$PHPMAILER_LANG['signing'] = '署名エラー: '; +$PHPMAILER_LANG['smtp_code'] = 'SMTPコード: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'SMTP追加情報: '; +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP接続に失敗しました。'; +$PHPMAILER_LANG['smtp_detail'] = '詳細: '; +$PHPMAILER_LANG['smtp_error'] = 'SMTPサーバーエラー: '; +$PHPMAILER_LANG['variable_set'] = '変数が存在しません: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ku.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ku.php new file mode 100644 index 00000000..cf3bda69 --- /dev/null +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ku.php @@ -0,0 +1,27 @@ + + */ + +$PHPMAILER_LANG['authenticate'] = 'هەڵەی SMTP : نەتوانرا کۆدەکە پشتڕاست بکرێتەوە '; +$PHPMAILER_LANG['connect_host'] = 'هەڵەی SMTP: نەتوانرا پەیوەندی بە سێرڤەرەوە بکات SMTP.'; +$PHPMAILER_LANG['data_not_accepted'] = 'هەڵەی SMTP: ئەو زانیاریانە قبوڵ نەکرا.'; +$PHPMAILER_LANG['empty_message'] = 'پەیامەکە بەتاڵە'; +$PHPMAILER_LANG['encoding'] = 'کۆدکردنی نەزانراو : '; +$PHPMAILER_LANG['execute'] = 'ناتوانرێت جێبەجێ بکرێت: '; +$PHPMAILER_LANG['file_access'] = 'ناتوانرێت دەستت بگات بە فایلەکە: '; +$PHPMAILER_LANG['file_open'] = 'هەڵەی پەڕگە(فایل): ناتوانرێت بکرێتەوە: '; +$PHPMAILER_LANG['from_failed'] = 'هەڵە لە ئاستی ناونیشانی نێرەر: '; +$PHPMAILER_LANG['instantiate'] = 'ناتوانرێت خزمەتگوزاری پۆستە پێشکەش بکرێت.'; +$PHPMAILER_LANG['invalid_address'] = 'نەتوانرا بنێردرێت ، چونکە ناونیشانی ئیمەیڵەکە نادروستە: '; +$PHPMAILER_LANG['mailer_not_supported'] = ' مەیلەر پشتگیری ناکات'; +$PHPMAILER_LANG['provide_address'] = 'دەبێت ناونیشانی ئیمەیڵی لانیکەم یەک وەرگر دابین بکرێت.'; +$PHPMAILER_LANG['recipients_failed'] = ' هەڵەی SMTP: ئەم هەڵانەی خوارەوەشکستی هێنا لە ناردن بۆ هەردووکیان: '; +$PHPMAILER_LANG['signing'] = 'هەڵەی واژۆ: '; +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect()پەیوەندی شکستی هێنا .'; +$PHPMAILER_LANG['smtp_error'] = 'هەڵەی ئاستی سێرڤەری SMTP: '; +$PHPMAILER_LANG['variable_set'] = 'ناتوانرێت بیگۆڕیت یان دوبارە بینێریتەوە: '; +$PHPMAILER_LANG['extension_missing'] = 'درێژکراوە نەماوە: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-mn.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-mn.php new file mode 100644 index 00000000..04d262c7 --- /dev/null +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-mn.php @@ -0,0 +1,27 @@ + + * @author João Vieira */ -$PHPMAILER_LANG['authenticate'] = 'Erro do SMTP: Não foi possível realizar a autenticação.'; -$PHPMAILER_LANG['connect_host'] = 'Erro do SMTP: Não foi possível realizar ligação com o servidor SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Erro do SMTP: Os dados foram rejeitados.'; -$PHPMAILER_LANG['empty_message'] = 'A mensagem no e-mail está vazia.'; +$PHPMAILER_LANG['authenticate'] = 'Erro SMTP: Falha na autenticação.'; +$PHPMAILER_LANG['buggy_php'] = 'A sua versão do PHP tem um bug que pode causar mensagens corrompidas. Para resolver, utilize o envio por SMTP, desative a opção mail.add_x_header no ficheiro php.ini, mude para MacOS ou Linux, ou atualize o PHP para a versão 7.0.17+ ou 7.1.3+.'; +$PHPMAILER_LANG['connect_host'] = 'Erro SMTP: Não foi possível ligar ao servidor SMTP.'; +$PHPMAILER_LANG['data_not_accepted'] = 'Erro SMTP: Dados não aceites.'; +$PHPMAILER_LANG['empty_message'] = 'A mensagem de e-mail está vazia.'; $PHPMAILER_LANG['encoding'] = 'Codificação desconhecida: '; $PHPMAILER_LANG['execute'] = 'Não foi possível executar: '; -$PHPMAILER_LANG['file_access'] = 'Não foi possível aceder o ficheiro: '; -$PHPMAILER_LANG['file_open'] = 'Abertura do ficheiro: Não foi possível abrir o ficheiro: '; -$PHPMAILER_LANG['from_failed'] = 'Ocorreram falhas nos endereços dos seguintes remententes: '; -$PHPMAILER_LANG['instantiate'] = 'Não foi possível iniciar uma instância da função mail.'; -$PHPMAILER_LANG['invalid_address'] = 'Não foi enviado nenhum e-mail para o endereço de e-mail inválido: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer não é suportado.'; -$PHPMAILER_LANG['provide_address'] = 'Tem de fornecer pelo menos um endereço como destinatário do e-mail.'; -$PHPMAILER_LANG['recipients_failed'] = 'Erro do SMTP: O endereço do seguinte destinatário falhou: '; -$PHPMAILER_LANG['signing'] = 'Erro ao assinar: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falhou.'; -$PHPMAILER_LANG['smtp_error'] = 'Erro de servidor SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'Não foi possível definir ou redefinir a variável: '; $PHPMAILER_LANG['extension_missing'] = 'Extensão em falta: '; +$PHPMAILER_LANG['file_access'] = 'Não foi possível aceder ao ficheiro: '; +$PHPMAILER_LANG['file_open'] = 'Erro ao abrir o ficheiro: '; +$PHPMAILER_LANG['from_failed'] = 'O envio falhou para o seguinte endereço do remetente: '; +$PHPMAILER_LANG['instantiate'] = 'Não foi possível instanciar a função mail.'; +$PHPMAILER_LANG['invalid_address'] = 'Endereço de e-mail inválido: '; +$PHPMAILER_LANG['invalid_header'] = 'Nome ou valor do cabeçalho inválido.'; +$PHPMAILER_LANG['invalid_hostentry'] = 'Entrada de host inválida: '; +$PHPMAILER_LANG['invalid_host'] = 'Host inválido: '; +$PHPMAILER_LANG['mailer_not_supported'] = 'O cliente de e-mail não é suportado.'; +$PHPMAILER_LANG['provide_address'] = 'Deve fornecer pelo menos um endereço de destinatário.'; +$PHPMAILER_LANG['recipients_failed'] = 'Erro SMTP: Falha no envio para os seguintes destinatários: '; +$PHPMAILER_LANG['signing'] = 'Erro ao assinar: '; +$PHPMAILER_LANG['smtp_code'] = 'Código SMTP: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'Informações adicionais SMTP: '; +$PHPMAILER_LANG['smtp_connect_failed'] = 'Falha na função SMTP connect().'; +$PHPMAILER_LANG['smtp_detail'] = 'Detalhes: '; +$PHPMAILER_LANG['smtp_error'] = 'Erro do servidor SMTP: '; +$PHPMAILER_LANG['variable_set'] = 'Não foi possível definir ou redefinir a variável: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt_br.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt_br.php index d8638098..5239865a 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt_br.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-pt_br.php @@ -7,24 +7,32 @@ * @author Lucas Guimarães * @author Phelipe Alves * @author Fabio Beneditto + * @author Geidson Benício Coelho */ $PHPMAILER_LANG['authenticate'] = 'Erro de SMTP: Não foi possível autenticar.'; +$PHPMAILER_LANG['buggy_php'] = 'Sua versão do PHP é afetada por um bug que por resultar em messagens corrompidas. Para corrigir, mude para enviar usando SMTP, desative a opção mail.add_x_header em seu php.ini, mude para MacOS ou Linux, ou atualize seu PHP para versão 7.0.17+ ou 7.1.3+ '; $PHPMAILER_LANG['connect_host'] = 'Erro de SMTP: Não foi possível conectar ao servidor SMTP.'; $PHPMAILER_LANG['data_not_accepted'] = 'Erro de SMTP: Dados rejeitados.'; $PHPMAILER_LANG['empty_message'] = 'Mensagem vazia'; $PHPMAILER_LANG['encoding'] = 'Codificação desconhecida: '; $PHPMAILER_LANG['execute'] = 'Não foi possível executar: '; +$PHPMAILER_LANG['extension_missing'] = 'Extensão não existe: '; $PHPMAILER_LANG['file_access'] = 'Não foi possível acessar o arquivo: '; $PHPMAILER_LANG['file_open'] = 'Erro de Arquivo: Não foi possível abrir o arquivo: '; $PHPMAILER_LANG['from_failed'] = 'Os seguintes remetentes falharam: '; $PHPMAILER_LANG['instantiate'] = 'Não foi possível instanciar a função mail.'; $PHPMAILER_LANG['invalid_address'] = 'Endereço de e-mail inválido: '; +$PHPMAILER_LANG['invalid_header'] = 'Nome ou valor de cabeçalho inválido'; +$PHPMAILER_LANG['invalid_hostentry'] = 'hostentry inválido: '; +$PHPMAILER_LANG['invalid_host'] = 'host inválido: '; $PHPMAILER_LANG['mailer_not_supported'] = ' mailer não é suportado.'; $PHPMAILER_LANG['provide_address'] = 'Você deve informar pelo menos um destinatário.'; $PHPMAILER_LANG['recipients_failed'] = 'Erro de SMTP: Os seguintes destinatários falharam: '; $PHPMAILER_LANG['signing'] = 'Erro de Assinatura: '; $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falhou.'; +$PHPMAILER_LANG['smtp_code'] = 'Código do servidor SMTP: '; $PHPMAILER_LANG['smtp_error'] = 'Erro de servidor SMTP: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'Informações adicionais do servidor SMTP: '; +$PHPMAILER_LANG['smtp_detail'] = 'Detalhes do servidor SMTP: '; $PHPMAILER_LANG['variable_set'] = 'Não foi possível definir ou redefinir a variável: '; -$PHPMAILER_LANG['extension_missing'] = 'Extensão não existe: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ro.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ro.php index 292ec1e4..45bef915 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ro.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ro.php @@ -3,25 +3,31 @@ /** * Romanian PHPMailer language file: refer to English translation for definitive list * @package PHPMailer - * @author Alex Florea */ $PHPMAILER_LANG['authenticate'] = 'Eroare SMTP: Autentificarea a eșuat.'; +$PHPMAILER_LANG['buggy_php'] = 'Versiunea instalată de PHP este afectată de o problemă care poate duce la coruperea mesajelor Pentru a preveni această problemă, folosiți SMTP, dezactivați opțiunea mail.add_x_header din php.ini, folosiți MacOS/Linux sau actualizați versiunea de PHP la 7.0.17+ sau 7.1.3+.'; $PHPMAILER_LANG['connect_host'] = 'Eroare SMTP: Conectarea la serverul SMTP a eșuat.'; $PHPMAILER_LANG['data_not_accepted'] = 'Eroare SMTP: Datele nu au fost acceptate.'; $PHPMAILER_LANG['empty_message'] = 'Mesajul este gol.'; $PHPMAILER_LANG['encoding'] = 'Encodare necunoscută: '; $PHPMAILER_LANG['execute'] = 'Nu se poate executa următoarea comandă: '; +$PHPMAILER_LANG['extension_missing'] = 'Lipsește extensia: '; $PHPMAILER_LANG['file_access'] = 'Nu se poate accesa următorul fișier: '; $PHPMAILER_LANG['file_open'] = 'Eroare fișier: Nu se poate deschide următorul fișier: '; $PHPMAILER_LANG['from_failed'] = 'Următoarele adrese From au dat eroare: '; $PHPMAILER_LANG['instantiate'] = 'Funcția mail nu a putut fi inițializată.'; $PHPMAILER_LANG['invalid_address'] = 'Adresa de email nu este validă: '; +$PHPMAILER_LANG['invalid_header'] = 'Numele sau valoarea header-ului nu este validă: '; +$PHPMAILER_LANG['invalid_hostentry'] = 'Hostentry invalid: '; +$PHPMAILER_LANG['invalid_host'] = 'Host invalid: '; $PHPMAILER_LANG['mailer_not_supported'] = ' mailer nu este suportat.'; $PHPMAILER_LANG['provide_address'] = 'Trebuie să adăugați cel puțin o adresă de email.'; $PHPMAILER_LANG['recipients_failed'] = 'Eroare SMTP: Următoarele adrese de email au eșuat: '; $PHPMAILER_LANG['signing'] = 'A aparut o problemă la semnarea emailului. '; +$PHPMAILER_LANG['smtp_code'] = 'Cod SMTP: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'Informații SMTP adiționale: '; $PHPMAILER_LANG['smtp_connect_failed'] = 'Conectarea la serverul SMTP a eșuat.'; +$PHPMAILER_LANG['smtp_detail'] = 'Detalii SMTP: '; $PHPMAILER_LANG['smtp_error'] = 'Eroare server SMTP: '; $PHPMAILER_LANG['variable_set'] = 'Nu se poate seta/reseta variabila. '; -$PHPMAILER_LANG['extension_missing'] = 'Lipsește extensia: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ru.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ru.php index 8c8c5e81..8013f37c 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ru.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ru.php @@ -5,24 +5,32 @@ * @package PHPMailer * @author Alexey Chumakov * @author Foster Snowhill + * @author ProjectSoft */ -$PHPMAILER_LANG['authenticate'] = 'Ошибка SMTP: ошибка авторизации.'; +$PHPMAILER_LANG['authenticate'] = 'Ошибка SMTP: не удалось пройти аутентификацию.'; +$PHPMAILER_LANG['buggy_php'] = 'В вашей версии PHP есть ошибка, которая может привести к повреждению сообщений. Чтобы исправить, переключитесь на отправку по SMTP, отключите опцию mail.add_x_header в ваш php.ini, переключитесь на MacOS или Linux или обновите PHP до версии 7.0.17+ или 7.1.3+.'; $PHPMAILER_LANG['connect_host'] = 'Ошибка SMTP: не удается подключиться к SMTP-серверу.'; $PHPMAILER_LANG['data_not_accepted'] = 'Ошибка SMTP: данные не приняты.'; +$PHPMAILER_LANG['empty_message'] = 'Пустое сообщение'; $PHPMAILER_LANG['encoding'] = 'Неизвестная кодировка: '; $PHPMAILER_LANG['execute'] = 'Невозможно выполнить команду: '; +$PHPMAILER_LANG['extension_missing'] = 'Расширение отсутствует: '; $PHPMAILER_LANG['file_access'] = 'Нет доступа к файлу: '; $PHPMAILER_LANG['file_open'] = 'Файловая ошибка: не удаётся открыть файл: '; $PHPMAILER_LANG['from_failed'] = 'Неверный адрес отправителя: '; $PHPMAILER_LANG['instantiate'] = 'Невозможно запустить функцию mail().'; -$PHPMAILER_LANG['provide_address'] = 'Пожалуйста, введите хотя бы один email-адрес получателя.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' — почтовый сервер не поддерживается.'; -$PHPMAILER_LANG['recipients_failed'] = 'Ошибка SMTP: не удалась отправка таким адресатам: '; -$PHPMAILER_LANG['empty_message'] = 'Пустое сообщение'; $PHPMAILER_LANG['invalid_address'] = 'Не отправлено из-за неправильного формата email-адреса: '; +$PHPMAILER_LANG['invalid_header'] = 'Неверное имя или значение заголовка'; +$PHPMAILER_LANG['invalid_hostentry'] = 'Неверная запись хоста: '; +$PHPMAILER_LANG['invalid_host'] = 'Неверный хост: '; +$PHPMAILER_LANG['mailer_not_supported'] = ' — почтовый сервер не поддерживается.'; +$PHPMAILER_LANG['provide_address'] = 'Вы должны указать хотя бы один адрес электронной почты получателя.'; +$PHPMAILER_LANG['recipients_failed'] = 'Ошибка SMTP: Ошибка следующих получателей: '; $PHPMAILER_LANG['signing'] = 'Ошибка подписи: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Ошибка соединения с SMTP-сервером'; +$PHPMAILER_LANG['smtp_code'] = 'Код SMTP: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'Дополнительная информация SMTP: '; +$PHPMAILER_LANG['smtp_connect_failed'] = 'Ошибка соединения с SMTP-сервером.'; +$PHPMAILER_LANG['smtp_detail'] = 'Детали: '; $PHPMAILER_LANG['smtp_error'] = 'Ошибка SMTP-сервера: '; $PHPMAILER_LANG['variable_set'] = 'Невозможно установить или сбросить переменную: '; -$PHPMAILER_LANG['extension_missing'] = 'Расширение отсутствует: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-si.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-si.php new file mode 100644 index 00000000..dce502aa --- /dev/null +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-si.php @@ -0,0 +1,34 @@ + + */ + +$PHPMAILER_LANG['authenticate'] = 'SMTP දෝෂය: සත්‍යාපනය අසාර්ථක විය.'; +$PHPMAILER_LANG['buggy_php'] = 'ඔබගේ PHP version එකෙහි පවතින දෝෂයක් නිසා email පණිවිඩ දෝෂ සහගත වීමේ හැකියාවක් ඇත. මෙය විසදීම සදහා SMTP භාවිතා කිරීම, mail.add_x_header INI setting එක අක්‍රීය කිරීම, MacOS හෝ Linux වලට මාරු වීම, හෝ ඔබගේ PHP version එක 7.0.17+ හෝ 7.1.3+ වලට අලුත් කිරීම කරගන්න.'; +$PHPMAILER_LANG['connect_host'] = 'SMTP දෝෂය: සම්බන්ධ වීමට නොහැකි විය.'; +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP දෝෂය: දත්ත පිළිගනු නොලැබේ.'; +$PHPMAILER_LANG['empty_message'] = 'පණිවිඩ අන්තර්ගතය හිස්'; +$PHPMAILER_LANG['encoding'] = 'නොදන්නා කේතනය: '; +$PHPMAILER_LANG['execute'] = 'ක්‍රියාත්මක කළ නොහැකි විය: '; +$PHPMAILER_LANG['extension_missing'] = 'Extension එක නොමැත: '; +$PHPMAILER_LANG['file_access'] = 'File එකට ප්‍රවේශ විය නොහැකි විය: '; +$PHPMAILER_LANG['file_open'] = 'File දෝෂය: File එක විවෘත කළ නොහැක: '; +$PHPMAILER_LANG['from_failed'] = 'පහත From ලිපිනයන් අසාර්ථක විය: '; +$PHPMAILER_LANG['instantiate'] = 'mail function එක ක්‍රියාත්මක කළ නොහැක.'; +$PHPMAILER_LANG['invalid_address'] = 'වලංගු නොවන ලිපිනය: '; +$PHPMAILER_LANG['invalid_header'] = 'වලංගු නොවන header නාමයක් හෝ අගයක්'; +$PHPMAILER_LANG['invalid_hostentry'] = 'වලංගු නොවන hostentry එකක්: '; +$PHPMAILER_LANG['invalid_host'] = 'වලංගු නොවන host එකක්: '; +$PHPMAILER_LANG['mailer_not_supported'] = ' mailer සහාය නොදක්වයි.'; +$PHPMAILER_LANG['provide_address'] = 'ඔබ අවම වශයෙන් එක් ලබන්නෙකුගේ ඊමේල් ලිපිනයක් සැපයිය යුතුය.'; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP දෝෂය: පහත ලබන්නන් අසමත් විය: '; +$PHPMAILER_LANG['signing'] = 'Sign කිරීමේ දෝෂය: '; +$PHPMAILER_LANG['smtp_code'] = 'SMTP කේතය: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'අමතර SMTP තොරතුරු: '; +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP සම්බන්ධය අසාර්ථක විය.'; +$PHPMAILER_LANG['smtp_detail'] = 'තොරතුරු: '; +$PHPMAILER_LANG['smtp_error'] = 'SMTP දෝෂය: '; +$PHPMAILER_LANG['variable_set'] = 'Variable එක සැකසීමට හෝ නැවත සැකසීමට නොහැක: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-sl.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-sl.php index c437a886..3e00c259 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-sl.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-sl.php @@ -9,23 +9,28 @@ */ $PHPMAILER_LANG['authenticate'] = 'SMTP napaka: Avtentikacija ni uspela.'; +$PHPMAILER_LANG['buggy_php'] = 'Na vašo PHP različico vpliva napaka, ki lahko povzroči poškodovana sporočila. Če želite težavo odpraviti, preklopite na pošiljanje prek SMTP, onemogočite možnost mail.add_x_header v vaši php.ini datoteki, preklopite na MacOS ali Linux, ali nadgradite vašo PHP zaličico na 7.0.17+ ali 7.1.3+.'; $PHPMAILER_LANG['connect_host'] = 'SMTP napaka: Vzpostavljanje povezave s SMTP gostiteljem ni uspelo.'; $PHPMAILER_LANG['data_not_accepted'] = 'SMTP napaka: Strežnik zavrača podatke.'; $PHPMAILER_LANG['empty_message'] = 'E-poštno sporočilo nima vsebine.'; $PHPMAILER_LANG['encoding'] = 'Nepoznan tip kodiranja: '; $PHPMAILER_LANG['execute'] = 'Operacija ni uspela: '; +$PHPMAILER_LANG['extension_missing'] = 'Manjkajoča razširitev: '; $PHPMAILER_LANG['file_access'] = 'Nimam dostopa do datoteke: '; $PHPMAILER_LANG['file_open'] = 'Ne morem odpreti datoteke: '; $PHPMAILER_LANG['from_failed'] = 'Neveljaven e-naslov pošiljatelja: '; $PHPMAILER_LANG['instantiate'] = 'Ne morem inicializirati mail funkcije.'; $PHPMAILER_LANG['invalid_address'] = 'E-poštno sporočilo ni bilo poslano. E-naslov je neveljaven: '; +$PHPMAILER_LANG['invalid_header'] = 'Neveljavno ime ali vrednost glave'; $PHPMAILER_LANG['invalid_hostentry'] = 'Neveljaven vnos gostitelja: '; $PHPMAILER_LANG['invalid_host'] = 'Neveljaven gostitelj: '; $PHPMAILER_LANG['mailer_not_supported'] = ' mailer ni podprt.'; $PHPMAILER_LANG['provide_address'] = 'Prosimo, vnesite vsaj enega naslovnika.'; $PHPMAILER_LANG['recipients_failed'] = 'SMTP napaka: Sledeči naslovniki so neveljavni: '; $PHPMAILER_LANG['signing'] = 'Napaka pri podpisovanju: '; +$PHPMAILER_LANG['smtp_code'] = 'SMTP koda: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'Dodatne informacije o SMTP: '; $PHPMAILER_LANG['smtp_connect_failed'] = 'Ne morem vzpostaviti povezave s SMTP strežnikom.'; +$PHPMAILER_LANG['smtp_detail'] = 'Podrobnosti: '; $PHPMAILER_LANG['smtp_error'] = 'Napaka SMTP strežnika: '; $PHPMAILER_LANG['variable_set'] = 'Ne morem nastaviti oz. ponastaviti spremenljivke: '; -$PHPMAILER_LANG['extension_missing'] = 'Manjkajoča razširitev: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php index f938f802..3c45bc1c 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-tr.php @@ -11,21 +11,28 @@ */ $PHPMAILER_LANG['authenticate'] = 'SMTP Hatası: Oturum açılamadı.'; +$PHPMAILER_LANG['buggy_php'] = 'PHP sürümünüz iletilerin bozulmasına neden olabilecek bir hatadan etkileniyor. Bunu düzeltmek için, SMTP kullanarak göndermeye geçin, mail.add_x_header seçeneğini devre dışı bırakın php.ini dosyanızdaki mail.add_x_header seçeneğini devre dışı bırakın, MacOS veya Linux geçin veya PHP sürümünü 7.0.17+ veya 7.1.3+ sürümüne yükseltin,'; $PHPMAILER_LANG['connect_host'] = 'SMTP Hatası: SMTP sunucusuna bağlanılamadı.'; $PHPMAILER_LANG['data_not_accepted'] = 'SMTP Hatası: Veri kabul edilmedi.'; $PHPMAILER_LANG['empty_message'] = 'Mesajın içeriği boş'; $PHPMAILER_LANG['encoding'] = 'Bilinmeyen karakter kodlama: '; $PHPMAILER_LANG['execute'] = 'Çalıştırılamadı: '; +$PHPMAILER_LANG['extension_missing'] = 'Eklenti bulunamadı: '; $PHPMAILER_LANG['file_access'] = 'Dosyaya erişilemedi: '; $PHPMAILER_LANG['file_open'] = 'Dosya Hatası: Dosya açılamadı: '; $PHPMAILER_LANG['from_failed'] = 'Belirtilen adreslere gönderme başarısız: '; $PHPMAILER_LANG['instantiate'] = 'Örnek e-posta fonksiyonu oluşturulamadı.'; $PHPMAILER_LANG['invalid_address'] = 'Geçersiz e-posta adresi: '; +$PHPMAILER_LANG['invalid_header'] = 'Geçersiz başlık adı veya değeri: '; +$PHPMAILER_LANG['invalid_hostentry'] = 'Geçersiz ana bilgisayar girişi: '; +$PHPMAILER_LANG['invalid_host'] = 'Geçersiz ana bilgisayar: '; $PHPMAILER_LANG['mailer_not_supported'] = ' e-posta kütüphanesi desteklenmiyor.'; $PHPMAILER_LANG['provide_address'] = 'En az bir alıcı e-posta adresi belirtmelisiniz.'; $PHPMAILER_LANG['recipients_failed'] = 'SMTP Hatası: Belirtilen alıcılara ulaşılamadı: '; $PHPMAILER_LANG['signing'] = 'İmzalama hatası: '; +$PHPMAILER_LANG['smtp_code'] = 'SMTP kodu: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'ek SMTP bilgileri: '; $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP connect() fonksiyonu başarısız.'; +$PHPMAILER_LANG['smtp_detail'] = 'SMTP SMTP Detayı: '; $PHPMAILER_LANG['smtp_error'] = 'SMTP sunucu hatası: '; $PHPMAILER_LANG['variable_set'] = 'Değişken ayarlanamadı ya da sıfırlanamadı: '; -$PHPMAILER_LANG['extension_missing'] = 'Eklenti bulunamadı: '; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ur.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ur.php new file mode 100644 index 00000000..0b9de0f1 --- /dev/null +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-ur.php @@ -0,0 +1,30 @@ + + */ + +$PHPMAILER_LANG['authenticate'] = 'SMTP خرابی: تصدیق کرنے سے قاصر۔'; +$PHPMAILER_LANG['connect_host'] = 'SMTP خرابی: سرور سے منسلک ہونے سے قاصر۔'; +$PHPMAILER_LANG['data_not_accepted'] = 'SMTP خرابی: ڈیٹا قبول نہیں کیا گیا۔'; +$PHPMAILER_LANG['empty_message'] = 'پیغام کی باڈی خالی ہے۔'; +$PHPMAILER_LANG['encoding'] = 'نامعلوم انکوڈنگ: '; +$PHPMAILER_LANG['execute'] = 'عمل کرنے کے قابل نہیں '; +$PHPMAILER_LANG['file_access'] = 'فائل تک رسائی سے قاصر:'; +$PHPMAILER_LANG['file_open'] = 'فائل کی خرابی: فائل کو کھولنے سے قاصر:'; +$PHPMAILER_LANG['from_failed'] = 'درج ذیل بھیجنے والے کا پتہ ناکام ہو گیا:'; +$PHPMAILER_LANG['instantiate'] = 'میل فنکشن کی مثال بنانے سے قاصر۔'; +$PHPMAILER_LANG['invalid_address'] = 'بھیجنے سے قاصر: غلط ای میل پتہ:'; +$PHPMAILER_LANG['mailer_not_supported'] = ' میلر تعاون یافتہ نہیں ہے۔'; +$PHPMAILER_LANG['provide_address'] = 'آپ کو کم از کم ایک منزل کا ای میل پتہ فراہم کرنا چاہیے۔'; +$PHPMAILER_LANG['recipients_failed'] = 'SMTP خرابی: درج ذیل پتہ پر نہیں بھیجا جاسکا: '; +$PHPMAILER_LANG['signing'] = 'دستخط کی خرابی: '; +$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP ملنا ناکام ہوا'; +$PHPMAILER_LANG['smtp_error'] = 'SMTP سرور کی خرابی: '; +$PHPMAILER_LANG['variable_set'] = 'متغیر سیٹ نہیں کیا جا سکا: '; +$PHPMAILER_LANG['extension_missing'] = 'ایکٹینشن موجود نہیں ہے۔ '; +$PHPMAILER_LANG['smtp_code'] = 'SMTP سرور کوڈ: '; +$PHPMAILER_LANG['smtp_code_ex'] = 'اضافی SMTP سرور کی معلومات:'; +$PHPMAILER_LANG['invalid_header'] = 'غلط ہیڈر کا نام یا قدر'; diff --git a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php index 728a4994..03d49116 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php +++ b/phpmailer/vendor/phpmailer/phpmailer/language/phpmailer.lang-zh_cn.php @@ -9,11 +9,13 @@ */ $PHPMAILER_LANG['authenticate'] = 'SMTP 错误:登录失败。'; +$PHPMAILER_LANG['buggy_php'] = '您的 PHP 版本存在漏洞,可能会导致消息损坏。为修复此问题,请切换到使用 SMTP 发送,在您的 php.ini 中禁用 mail.add_x_header 选项。切换到 MacOS 或 Linux,或将您的 PHP 升级到 7.0.17+ 或 7.1.3+ 版本。'; $PHPMAILER_LANG['connect_host'] = 'SMTP 错误:无法连接到 SMTP 主机。'; $PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误:数据不被接受。'; $PHPMAILER_LANG['empty_message'] = '邮件正文为空。'; $PHPMAILER_LANG['encoding'] = '未知编码:'; $PHPMAILER_LANG['execute'] = '无法执行:'; +$PHPMAILER_LANG['extension_missing'] = '缺少扩展名:'; $PHPMAILER_LANG['file_access'] = '无法访问文件:'; $PHPMAILER_LANG['file_open'] = '文件错误:无法打开文件:'; $PHPMAILER_LANG['from_failed'] = '发送地址错误:'; @@ -22,8 +24,13 @@ $PHPMAILER_LANG['invalid_address'] = '发送失败,电子邮箱地址是 $PHPMAILER_LANG['mailer_not_supported'] = '发信客户端不被支持。'; $PHPMAILER_LANG['provide_address'] = '必须提供至少一个收件人地址。'; $PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误:收件人地址错误:'; -$PHPMAILER_LANG['signing'] = '登录失败:'; $PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP服务器连接失败。'; $PHPMAILER_LANG['smtp_error'] = 'SMTP服务器出错:'; $PHPMAILER_LANG['variable_set'] = '无法设置或重置变量:'; -$PHPMAILER_LANG['extension_missing'] = '丢失模块 Extension:'; +$PHPMAILER_LANG['invalid_header'] = '无效的标题名称或值'; +$PHPMAILER_LANG['invalid_hostentry'] = '无效的hostentry: '; +$PHPMAILER_LANG['invalid_host'] = '无效的主机:'; +$PHPMAILER_LANG['signing'] = '签名错误:'; +$PHPMAILER_LANG['smtp_code'] = 'SMTP代码: '; +$PHPMAILER_LANG['smtp_code_ex'] = '附加SMTP信息: '; +$PHPMAILER_LANG['smtp_detail'] = '详情:'; diff --git a/phpmailer/vendor/phpmailer/phpmailer/phpunit.xml.dist b/phpmailer/vendor/phpmailer/phpmailer/phpunit.xml.dist deleted file mode 100644 index c68df965..00000000 --- a/phpmailer/vendor/phpmailer/phpmailer/phpunit.xml.dist +++ /dev/null @@ -1,35 +0,0 @@ - - - - - ./test/ - - - - - - - - languages - pop3 - - - - - ./src - - - - - - - - diff --git a/phpmailer/vendor/phpmailer/phpmailer/src/DSNConfigurator.php b/phpmailer/vendor/phpmailer/phpmailer/src/DSNConfigurator.php new file mode 100644 index 00000000..7058c1f0 --- /dev/null +++ b/phpmailer/vendor/phpmailer/phpmailer/src/DSNConfigurator.php @@ -0,0 +1,245 @@ + + * @author Jim Jagielski (jimjag) + * @author Andy Prevost (codeworxtech) + * @author Brent R. Matzelle (original founder) + * @copyright 2012 - 2023 Marcus Bointon + * @copyright 2010 - 2012 Jim Jagielski + * @copyright 2004 - 2009 Andy Prevost + * @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License + * @note This program is distributed in the hope that it will be useful - WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + */ + +namespace PHPMailer\PHPMailer; + +/** + * Configure PHPMailer with DSN string. + * + * @see https://en.wikipedia.org/wiki/Data_source_name + * + * @author Oleg Voronkovich + */ +class DSNConfigurator +{ + /** + * Create new PHPMailer instance configured by DSN. + * + * @param string $dsn DSN + * @param bool $exceptions Should we throw external exceptions? + * + * @return PHPMailer + */ + public static function mailer($dsn, $exceptions = null) + { + static $configurator = null; + + if (null === $configurator) { + $configurator = new DSNConfigurator(); + } + + return $configurator->configure(new PHPMailer($exceptions), $dsn); + } + + /** + * Configure PHPMailer instance with DSN string. + * + * @param PHPMailer $mailer PHPMailer instance + * @param string $dsn DSN + * + * @return PHPMailer + */ + public function configure(PHPMailer $mailer, $dsn) + { + $config = $this->parseDSN($dsn); + + $this->applyConfig($mailer, $config); + + return $mailer; + } + + /** + * Parse DSN string. + * + * @param string $dsn DSN + * + * @throws Exception If DSN is malformed + * + * @return array Configuration + */ + private function parseDSN($dsn) + { + $config = $this->parseUrl($dsn); + + if (false === $config || !isset($config['scheme']) || !isset($config['host'])) { + throw new Exception('Malformed DSN'); + } + + if (isset($config['query'])) { + parse_str($config['query'], $config['query']); + } + + return $config; + } + + /** + * Apply configuration to mailer. + * + * @param PHPMailer $mailer PHPMailer instance + * @param array $config Configuration + * + * @throws Exception If scheme is invalid + */ + private function applyConfig(PHPMailer $mailer, $config) + { + switch ($config['scheme']) { + case 'mail': + $mailer->isMail(); + break; + case 'sendmail': + $mailer->isSendmail(); + break; + case 'qmail': + $mailer->isQmail(); + break; + case 'smtp': + case 'smtps': + $mailer->isSMTP(); + $this->configureSMTP($mailer, $config); + break; + default: + throw new Exception( + sprintf( + 'Invalid scheme: "%s". Allowed values: "mail", "sendmail", "qmail", "smtp", "smtps".', + $config['scheme'] + ) + ); + } + + if (isset($config['query'])) { + $this->configureOptions($mailer, $config['query']); + } + } + + /** + * Configure SMTP. + * + * @param PHPMailer $mailer PHPMailer instance + * @param array $config Configuration + */ + private function configureSMTP($mailer, $config) + { + $isSMTPS = 'smtps' === $config['scheme']; + + if ($isSMTPS) { + $mailer->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; + } + + $mailer->Host = $config['host']; + + if (isset($config['port'])) { + $mailer->Port = $config['port']; + } elseif ($isSMTPS) { + $mailer->Port = SMTP::DEFAULT_SECURE_PORT; + } + + $mailer->SMTPAuth = isset($config['user']) || isset($config['pass']); + + if (isset($config['user'])) { + $mailer->Username = $config['user']; + } + + if (isset($config['pass'])) { + $mailer->Password = $config['pass']; + } + } + + /** + * Configure options. + * + * @param PHPMailer $mailer PHPMailer instance + * @param array $options Options + * + * @throws Exception If option is unknown + */ + private function configureOptions(PHPMailer $mailer, $options) + { + $allowedOptions = get_object_vars($mailer); + + unset($allowedOptions['Mailer']); + unset($allowedOptions['SMTPAuth']); + unset($allowedOptions['Username']); + unset($allowedOptions['Password']); + unset($allowedOptions['Hostname']); + unset($allowedOptions['Port']); + unset($allowedOptions['ErrorInfo']); + + $allowedOptions = \array_keys($allowedOptions); + + foreach ($options as $key => $value) { + if (!in_array($key, $allowedOptions)) { + throw new Exception( + sprintf( + 'Unknown option: "%s". Allowed values: "%s"', + $key, + implode('", "', $allowedOptions) + ) + ); + } + + switch ($key) { + case 'AllowEmpty': + case 'SMTPAutoTLS': + case 'SMTPKeepAlive': + case 'SingleTo': + case 'UseSendmailOptions': + case 'do_verp': + case 'DKIM_copyHeaderFields': + $mailer->$key = (bool) $value; + break; + case 'Priority': + case 'SMTPDebug': + case 'WordWrap': + $mailer->$key = (int) $value; + break; + default: + $mailer->$key = $value; + break; + } + } + } + + /** + * Parse a URL. + * Wrapper for the built-in parse_url function to work around a bug in PHP 5.5. + * + * @param string $url URL + * + * @return array|false + */ + protected function parseUrl($url) + { + if (\PHP_VERSION_ID >= 50600 || false === strpos($url, '?')) { + return parse_url($url); + } + + $chunks = explode('?', $url); + if (is_array($chunks)) { + $result = parse_url($chunks[0]); + if (is_array($result)) { + $result['query'] = $chunks[1]; + } + return $result; + } + + return false; + } +} diff --git a/phpmailer/vendor/phpmailer/phpmailer/src/Exception.php b/phpmailer/vendor/phpmailer/phpmailer/src/Exception.php index a50a8991..09c1a2cf 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/src/Exception.php +++ b/phpmailer/vendor/phpmailer/phpmailer/src/Exception.php @@ -13,7 +13,7 @@ * @copyright 2012 - 2020 Marcus Bointon * @copyright 2010 - 2012 Jim Jagielski * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License + * @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License * @note This program is distributed in the hope that it will be useful - WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. @@ -35,6 +35,6 @@ class Exception extends \Exception */ public function errorMessage() { - return '' . htmlspecialchars($this->getMessage()) . "
\n"; + return '' . htmlspecialchars($this->getMessage(), ENT_COMPAT | ENT_HTML401) . "
\n"; } } diff --git a/phpmailer/vendor/phpmailer/phpmailer/src/OAuth.php b/phpmailer/vendor/phpmailer/phpmailer/src/OAuth.php index c93d0be1..a7e95886 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/src/OAuth.php +++ b/phpmailer/vendor/phpmailer/phpmailer/src/OAuth.php @@ -13,7 +13,7 @@ * @copyright 2012 - 2020 Marcus Bointon * @copyright 2010 - 2012 Jim Jagielski * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License + * @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License * @note This program is distributed in the hope that it will be useful - WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. @@ -29,11 +29,11 @@ use League\OAuth2\Client\Token\AccessToken; * OAuth - OAuth2 authentication wrapper class. * Uses the oauth2-client package from the League of Extraordinary Packages. * - * @see http://oauth2-client.thephpleague.com + * @see https://oauth2-client.thephpleague.com * * @author Marcus Bointon (Synchro/coolbru) */ -class OAuth +class OAuth implements OAuthTokenProvider { /** * An instance of the League OAuth Client Provider. diff --git a/phpmailer/vendor/phpmailer/phpmailer/src/OAuthTokenProvider.php b/phpmailer/vendor/phpmailer/phpmailer/src/OAuthTokenProvider.php new file mode 100644 index 00000000..cbda1a12 --- /dev/null +++ b/phpmailer/vendor/phpmailer/phpmailer/src/OAuthTokenProvider.php @@ -0,0 +1,44 @@ + + * @author Jim Jagielski (jimjag) + * @author Andy Prevost (codeworxtech) + * @author Brent R. Matzelle (original founder) + * @copyright 2012 - 2020 Marcus Bointon + * @copyright 2010 - 2012 Jim Jagielski + * @copyright 2004 - 2009 Andy Prevost + * @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License + * @note This program is distributed in the hope that it will be useful - WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. + */ + +namespace PHPMailer\PHPMailer; + +/** + * OAuthTokenProvider - OAuth2 token provider interface. + * Provides base64 encoded OAuth2 auth strings for SMTP authentication. + * + * @see OAuth + * @see SMTP::authenticate() + * + * @author Peter Scopes (pdscopes) + * @author Marcus Bointon (Synchro/coolbru) + */ +interface OAuthTokenProvider +{ + /** + * Generate a base64-encoded OAuth token ensuring that the access token has not expired. + * The string to be base 64 encoded should be in the form: + * "user=\001auth=Bearer \001\001" + * + * @return string + */ + public function getOauth64(); +} diff --git a/phpmailer/vendor/phpmailer/phpmailer/src/PHPMailer.php b/phpmailer/vendor/phpmailer/phpmailer/src/PHPMailer.php index eb4b742b..2444bcf3 100644 --- a/phpmailer/vendor/phpmailer/phpmailer/src/PHPMailer.php +++ b/phpmailer/vendor/phpmailer/phpmailer/src/PHPMailer.php @@ -13,7 +13,7 @@ * @copyright 2012 - 2020 Marcus Bointon * @copyright 2010 - 2012 Jim Jagielski * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License + * @license https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html GNU Lesser General Public License * @note This program is distributed in the hope that it will be useful - WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. @@ -103,14 +103,14 @@ class PHPMailer * * @var string */ - public $From = 'root@localhost'; + public $From = ''; /** * The From name of the message. * * @var string */ - public $FromName = 'Root User'; + public $FromName = ''; /** * The envelope sender of the message. @@ -152,8 +152,7 @@ class PHPMailer * Only supported in simple alt or alt_inline message types * To generate iCal event structures, use classes like EasyPeasyICS or iCalcreator. * - * @see http://sprain.ch/blog/downloads/php-class-easypeasyics-create-ical-files-with-php/ - * @see http://kigkonsult.se/iCalcreator/ + * @see https://kigkonsult.se/iCalcreator/ * * @var string */ @@ -254,7 +253,7 @@ class PHPMailer * You can set your own, but it must be in the format "", * as defined in RFC5322 section 3.6.4 or it will be ignored. * - * @see https://tools.ietf.org/html/rfc5322#section-3.6.4 + * @see https://www.rfc-editor.org/rfc/rfc5322#section-3.6.4 * * @var string */ @@ -350,17 +349,24 @@ class PHPMailer public $Password = ''; /** - * SMTP auth type. - * Options are CRAM-MD5, LOGIN, PLAIN, XOAUTH2, attempted in that order if not specified. + * SMTP authentication type. Options are CRAM-MD5, LOGIN, PLAIN, XOAUTH2. + * If not specified, the first one from that list that the server supports will be selected. * * @var string */ public $AuthType = ''; /** - * An instance of the PHPMailer OAuth class. + * SMTP SMTPXClient command attributes * - * @var OAuth + * @var array + */ + protected $SMTPXClient = []; + + /** + * An implementation of the PHPMailer OAuthTokenProvider interface. + * + * @var OAuthTokenProvider */ protected $oauth; @@ -381,7 +387,7 @@ class PHPMailer * 'DELAY' will notify you if there is an unusual delay in delivery, but the actual * delivery's outcome (success or failure) is not yet decided. * - * @see https://tools.ietf.org/html/rfc3461 See section 4.1 for more information about NOTIFY + * @see https://www.rfc-editor.org/rfc/rfc3461.html#section-4.1 for more information about NOTIFY */ public $dsn = ''; @@ -461,7 +467,7 @@ class PHPMailer * Only applicable when sending via SMTP. * * @see https://en.wikipedia.org/wiki/Variable_envelope_return_path - * @see http://www.postfix.org/VERP_README.html Postfix VERP info + * @see https://www.postfix.org/VERP_README.html Postfix VERP info * * @var bool */ @@ -544,10 +550,10 @@ class PHPMailer * The function that handles the result of the send email action. * It is called out by send() for each email sent. * - * Value can be any php callable: http://www.php.net/is_callable + * Value can be any php callable: https://www.php.net/is_callable * * Parameters: - * bool $result result of the send action + * bool $result result of the send action * array $to email addresses of the recipients * array $cc cc email addresses * array $bcc bcc email addresses @@ -574,6 +580,10 @@ class PHPMailer * May be a callable to inject your own validator, but there are several built-in validators. * The default validator uses PHP's FILTER_VALIDATE_EMAIL filter_var option. * + * If CharSet is UTF8, the validator is left at the default value, + * and you send to addresses that use non-ASCII local parts, then + * PHPMailer automatically changes to the 'eai' validator. + * * @see PHPMailer::validateAddress() * * @var string|callable @@ -653,6 +663,14 @@ class PHPMailer */ protected $ReplyToQueue = []; + /** + * Whether the need for SMTPUTF8 has been detected. Set by + * preSend() if necessary. + * + * @var bool + */ + public $UseSMTPUTF8 = false; + /** * The array of attachments. * @@ -689,7 +707,7 @@ class PHPMailer protected $boundary = []; /** - * The array of available languages. + * The array of available text strings for the current language. * * @var array */ @@ -750,7 +768,7 @@ class PHPMailer * * @var string */ - const VERSION = '6.5.0'; + const VERSION = '6.10.0'; /** * Error severity: message only, continue processing. @@ -795,7 +813,7 @@ class PHPMailer * The maximum line length supported by mail(). * * Background: mail() will sometimes corrupt messages - * with headers headers longer than 65 chars, see #818. + * with headers longer than 65 chars, see #818. * * @var int */ @@ -858,7 +876,7 @@ class PHPMailer private function mailPassthru($to, $subject, $body, $header, $params) { //Check overloading of mail function to avoid double-encoding - if (ini_get('mbstring.func_overload') & 1) { + if ((int)ini_get('mbstring.func_overload') & 1) { $subject = $this->secureHeader($subject); } else { $subject = $this->encodeHeader($this->secureHeader($subject)); @@ -896,7 +914,7 @@ class PHPMailer } //Is this a PSR-3 logger? if ($this->Debugoutput instanceof \Psr\Log\LoggerInterface) { - $this->Debugoutput->debug($str); + $this->Debugoutput->debug(rtrim($str, "\r\n")); return; } @@ -1065,9 +1083,9 @@ class PHPMailer * be modified after calling this function), addition of such addresses is delayed until send(). * Addresses that have been added already return false, but do not throw exceptions. * - * @param string $kind One of 'to', 'cc', 'bcc', or 'ReplyTo' - * @param string $address The email address to send, resp. to reply to - * @param string $name + * @param string $kind One of 'to', 'cc', 'bcc', or 'Reply-To' + * @param string $address The email address + * @param string $name An optional username associated with the address * * @throws Exception * @@ -1075,9 +1093,11 @@ class PHPMailer */ protected function addOrEnqueueAnAddress($kind, $address, $name) { - $address = trim($address); - $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim - $pos = strrpos($address, '@'); + $pos = false; + if ($address !== null) { + $address = trim($address); + $pos = strrpos($address, '@'); + } if (false === $pos) { //At-sign is missing. $error_message = sprintf( @@ -1094,21 +1114,30 @@ class PHPMailer return false; } + if ($name !== null && is_string($name)) { + $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim + } else { + $name = ''; + } $params = [$kind, $address, $name]; //Enqueue addresses with IDN until we know the PHPMailer::$CharSet. - if (static::idnSupported() && $this->has8bitChars(substr($address, ++$pos))) { - if ('Reply-To' !== $kind) { - if (!array_key_exists($address, $this->RecipientsQueue)) { - $this->RecipientsQueue[$address] = $params; + //Domain is assumed to be whatever is after the last @ symbol in the address + if ($this->has8bitChars(substr($address, ++$pos))) { + if (static::idnSupported()) { + if ('Reply-To' !== $kind) { + if (!array_key_exists($address, $this->RecipientsQueue)) { + $this->RecipientsQueue[$address] = $params; + + return true; + } + } elseif (!array_key_exists($address, $this->ReplyToQueue)) { + $this->ReplyToQueue[$address] = $params; return true; } - } elseif (!array_key_exists($address, $this->ReplyToQueue)) { - $this->ReplyToQueue[$address] = $params; - - return true; } - + //We have an 8-bit domain, but we are missing the necessary extensions to support it + //Or we are already sending to this address return false; } @@ -1116,6 +1145,22 @@ class PHPMailer return call_user_func_array([$this, 'addAnAddress'], $params); } + /** + * Set the boundaries to use for delimiting MIME parts. + * If you override this, ensure you set all 3 boundaries to unique values. + * The default boundaries include a "=_" sequence which cannot occur in quoted-printable bodies, + * as suggested by https://www.rfc-editor.org/rfc/rfc2045#section-6.7 + * + * @return void + */ + public function setBoundaries() + { + $this->uniqueid = $this->generateId(); + $this->boundary[1] = 'b1=_' . $this->uniqueid; + $this->boundary[2] = 'b2=_' . $this->uniqueid; + $this->boundary[3] = 'b3=_' . $this->uniqueid; + } + /** * Add an address to one of the recipient arrays or to the ReplyTo array. * Addresses that have been added already return false, but do not throw exceptions. @@ -1130,6 +1175,15 @@ class PHPMailer */ protected function addAnAddress($kind, $address, $name = '') { + if ( + self::$validator === 'php' && + ((bool) preg_match('/[\x80-\xFF]/', $address)) + ) { + //The caller has not altered the validator and is sending to an address + //with UTF-8, so assume that they want UTF-8 support instead of failing + $this->CharSet = self::CHARSET_UTF8; + self::$validator = 'eai'; + } if (!in_array($kind, ['to', 'cc', 'bcc', 'Reply-To'])) { $error_message = sprintf( '%s: %s', @@ -1181,32 +1235,41 @@ class PHPMailer * Uses the imap_rfc822_parse_adrlist function if the IMAP extension is available. * Note that quotes in the name part are removed. * - * @see http://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation + * @see https://www.andrew.cmu.edu/user/agreen1/testing/mrbs/web/Mail/RFC822.php A more careful implementation * * @param string $addrstr The address list string * @param bool $useimap Whether to use the IMAP extension to parse the list + * @param string $charset The charset to use when decoding the address list string. * * @return array */ - public static function parseAddresses($addrstr, $useimap = true) + public static function parseAddresses($addrstr, $useimap = true, $charset = self::CHARSET_ISO88591) { $addresses = []; if ($useimap && function_exists('imap_rfc822_parse_adrlist')) { //Use this built-in parser if it's available $list = imap_rfc822_parse_adrlist($addrstr, ''); + // Clear any potential IMAP errors to get rid of notices being thrown at end of script. + imap_errors(); foreach ($list as $address) { if ( - ('.SYNTAX-ERROR.' !== $address->host) && static::validateAddress( - $address->mailbox . '@' . $address->host - ) + '.SYNTAX-ERROR.' !== $address->host && + static::validateAddress($address->mailbox . '@' . $address->host) ) { //Decode the name part if it's present and encoded if ( property_exists($address, 'personal') && - extension_loaded('mbstring') && - preg_match('/^=\?.*\?=$/', $address->personal) + //Check for a Mbstring constant rather than using extension_loaded, which is sometimes disabled + defined('MB_CASE_UPPER') && + preg_match('/^=\?.*\?=$/s', $address->personal) ) { + $origCharset = mb_internal_encoding(); + mb_internal_encoding($charset); + //Undo any RFC2047-encoded spaces-as-underscores + $address->personal = str_replace('_', '=20', $address->personal); + //Decode the name $address->personal = mb_decode_mimeheader($address->personal); + mb_internal_encoding($origCharset); } $addresses[] = [ @@ -1234,9 +1297,16 @@ class PHPMailer $email = trim(str_replace('>', '', $email)); $name = trim($name); if (static::validateAddress($email)) { + //Check for a Mbstring constant rather than using extension_loaded, which is sometimes disabled //If this name is encoded, decode it - if (preg_match('/^=\?.*\?=$/', $name)) { + if (defined('MB_CASE_UPPER') && preg_match('/^=\?.*\?=$/s', $name)) { + $origCharset = mb_internal_encoding(); + mb_internal_encoding($charset); + //Undo any RFC2047-encoded spaces-as-underscores + $name = str_replace('_', '=20', $name); + //Decode the name $name = mb_decode_mimeheader($name); + mb_internal_encoding($origCharset); } $addresses[] = [ //Remove any surrounding quotes and spaces from the name @@ -1264,7 +1334,7 @@ class PHPMailer */ public function setFrom($address, $name = '', $auto = true) { - $address = trim($address); + $address = trim((string)$address); $name = trim(preg_replace('/[\r\n]+/', '', $name)); //Strip breaks and trim //Don't validate now addresses with IDN. Will be done in send(). $pos = strrpos($address, '@'); @@ -1316,6 +1386,7 @@ class PHPMailer * * `pcre` Use old PCRE implementation; * * `php` Use PHP built-in FILTER_VALIDATE_EMAIL; * * `html5` Use the pattern given by the HTML5 spec for 'email' type form input elements. + * * `eai` Use a pattern similar to the HTML5 spec for 'email' and to firefox, extended to support EAI (RFC6530). * * `noregex` Don't use a regex: super fast, really dumb. * Alternatively you may pass in a callable to inject your own validator, for example: * @@ -1360,7 +1431,6 @@ class PHPMailer * * IPv6 literals: 'first.last@[IPv6:a1::]' * Not all of these will necessarily work for sending! * - * @see http://squiloople.com/2009/12/20/email-address-validation/ * @copyright 2009-2010 Michael Rushton * Feel free to use and redistribute this code. But please keep this copyright notice. */ @@ -1387,6 +1457,24 @@ class PHPMailer '[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/sD', $address ); + case 'eai': + /* + * This is the pattern used in the HTML5 spec for validation of 'email' type + * form input elements (as above), modified to accept Unicode email addresses. + * This is also more lenient than Firefox' html5 spec, in order to make the regex faster. + * 'eai' is an acronym for Email Address Internationalization. + * This validator is selected automatically if you attempt to use recipient addresses + * that contain Unicode characters in the local part. + * + * @see https://html.spec.whatwg.org/#e-mail-state-(type=email) + * @see https://en.wikipedia.org/wiki/International_email + */ + return (bool) preg_match( + '/^[-\p{L}\p{N}\p{M}.!#$%&\'*+\/=?^_`{|}~]+@[\p{L}\p{N}\p{M}](?:[\p{L}\p{N}\p{M}-]{0,61}' . + '[\p{L}\p{N}\p{M}])?(?:\.[\p{L}\p{N}\p{M}]' . + '(?:[-\p{L}\p{N}\p{M}]{0,61}[\p{L}\p{N}\p{M}])?)*$/usD', + $address + ); case 'php': default: return filter_var($address, FILTER_VALIDATE_EMAIL) !== false; @@ -1436,7 +1524,12 @@ class PHPMailer $errorcode = 0; if (defined('INTL_IDNA_VARIANT_UTS46')) { //Use the current punycode standard (appeared in PHP 7.2) - $punycode = idn_to_ascii($domain, $errorcode, \INTL_IDNA_VARIANT_UTS46); + $punycode = idn_to_ascii( + $domain, + \IDNA_DEFAULT | \IDNA_USE_STD3_RULES | \IDNA_CHECK_BIDI | + \IDNA_CHECK_CONTEXTJ | \IDNA_NONTRANSITIONAL_TO_ASCII, + \INTL_IDNA_VARIANT_UTS46 + ); } elseif (defined('INTL_IDNA_VARIANT_2003')) { //Fall back to this old, deprecated/removed encoding $punycode = idn_to_ascii($domain, $errorcode, \INTL_IDNA_VARIANT_2003); @@ -1508,21 +1601,33 @@ class PHPMailer && ini_get('mail.add_x_header') === '1' && stripos(PHP_OS, 'WIN') === 0 ) { - trigger_error( - 'Your version of PHP is affected by a bug that may result in corrupted messages.' . - ' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in' . - ' your php.ini, switch to MacOS or Linux, or upgrade your PHP to version 7.0.17+ or 7.1.3+.', - E_USER_WARNING - ); + trigger_error($this->lang('buggy_php'), E_USER_WARNING); } try { $this->error_count = 0; //Reset errors $this->mailHeader = ''; + //The code below tries to support full use of Unicode, + //while remaining compatible with legacy SMTP servers to + //the greatest degree possible: If the message uses + //Unicode in the local parts of any addresses, it is sent + //using SMTPUTF8. If not, it it sent using + //punycode-encoded domains and plain SMTP. + if ( + static::CHARSET_UTF8 === strtolower($this->CharSet) && + ($this->anyAddressHasUnicodeLocalPart($this->RecipientsQueue) || + $this->anyAddressHasUnicodeLocalPart(array_keys($this->all_recipients)) || + $this->anyAddressHasUnicodeLocalPart($this->ReplyToQueue) || + $this->addressHasUnicodeLocalPart($this->From)) + ) { + $this->UseSMTPUTF8 = true; + } //Dequeue recipient and Reply-To addresses with IDN foreach (array_merge($this->RecipientsQueue, $this->ReplyToQueue) as $params) { - $params[1] = $this->punyencodeAddress($params[1]); + if (!$this->UseSMTPUTF8) { + $params[1] = $this->punyencodeAddress($params[1]); + } call_user_func_array([$this, 'addAnAddress'], $params); } if (count($this->to) + count($this->cc) + count($this->bcc) < 1) { @@ -1531,17 +1636,21 @@ class PHPMailer //Validate From, Sender, and ConfirmReadingTo addresses foreach (['From', 'Sender', 'ConfirmReadingTo'] as $address_kind) { - $this->$address_kind = trim($this->$address_kind); - if (empty($this->$address_kind)) { + if ($this->{$address_kind} === null) { + $this->{$address_kind} = ''; continue; } - $this->$address_kind = $this->punyencodeAddress($this->$address_kind); - if (!static::validateAddress($this->$address_kind)) { + $this->{$address_kind} = trim($this->{$address_kind}); + if (empty($this->{$address_kind})) { + continue; + } + $this->{$address_kind} = $this->punyencodeAddress($this->{$address_kind}); + if (!static::validateAddress($this->{$address_kind})) { $error_message = sprintf( '%s (%s): %s', $this->lang('invalid_address'), $address_kind, - $this->$address_kind + $this->{$address_kind} ); $this->setError($error_message); $this->edebug($error_message); @@ -1641,17 +1750,17 @@ class PHPMailer default: $sendMethod = $this->Mailer . 'Send'; if (method_exists($this, $sendMethod)) { - return $this->$sendMethod($this->MIMEHeader, $this->MIMEBody); + return $this->{$sendMethod}($this->MIMEHeader, $this->MIMEBody); } return $this->mailSend($this->MIMEHeader, $this->MIMEBody); } } catch (Exception $exc) { - if ($this->Mailer === 'smtp' && $this->SMTPKeepAlive == true) { - $this->smtp->reset(); - } $this->setError($exc->getMessage()); $this->edebug($exc->getMessage()); + if ($this->Mailer === 'smtp' && $this->SMTPKeepAlive == true && $this->smtp->connected()) { + $this->smtp->reset(); + } if ($this->exceptions) { throw $exc; } @@ -1683,11 +1792,13 @@ class PHPMailer //This sets the SMTP envelope sender which gets turned into a return-path header by the receiver //A space after `-f` is optional, but there is a long history of its presence //causing problems, so we don't use one - //Exim docs: http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html - //Sendmail docs: http://www.sendmail.org/~ca/email/man/sendmail.html - //Qmail docs: http://www.qmail.org/man/man8/qmail-inject.html + //Exim docs: https://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html + //Sendmail docs: https://www.sendmail.org/~ca/email/man/sendmail.html //Example problem: https://www.drupal.org/node/1057954 - if (empty($this->Sender) && !empty(ini_get('sendmail_from'))) { + + //PHP 5.6 workaround + $sendmail_from_value = ini_get('sendmail_from'); + if (empty($this->Sender) && !empty($sendmail_from_value)) { //PHP config has a sender address we can use $this->Sender = ini_get('sendmail_from'); } @@ -1724,7 +1835,7 @@ class PHPMailer fwrite($mail, $header); fwrite($mail, $body); $result = pclose($mail); - $addrinfo = static::parseAddresses($toAddr); + $addrinfo = static::parseAddresses($toAddr, true, $this->CharSet); $this->doCallback( ($result === 0), [[$addrinfo['address'], $addrinfo['name']]], @@ -1779,7 +1890,13 @@ class PHPMailer */ protected static function isShellSafe($string) { - //Future-proof + //It's not possible to use shell commands safely (which includes the mail() function) without escapeshellarg, + //but some hosting providers disable it, creating a security problem that we don't want to have to deal with, + //so we don't. + if (!function_exists('escapeshellarg') || !function_exists('escapeshellcmd')) { + return false; + } + if ( escapeshellcmd($string) !== $string || !in_array(escapeshellarg($string), ["'$string'", "\"$string\""]) @@ -1814,7 +1931,7 @@ class PHPMailer */ protected static function isPermittedPath($path) { - //Matches scheme definition from https://tools.ietf.org/html/rfc3986#section-3.1 + //Matches scheme definition from https://www.rfc-editor.org/rfc/rfc3986#section-3.1 return !preg_match('#^[a-z][a-z\d+.-]*://#i', $path); } @@ -1830,7 +1947,7 @@ class PHPMailer if (!static::isPermittedPath($path)) { return false; } - $readable = file_exists($path); + $readable = is_file($path); //If not a UNC path (expected to start with \\), check read permission, see #2069 if (strpos($path, '\\\\') !== 0) { $readable = $readable && is_readable($path); @@ -1841,7 +1958,7 @@ class PHPMailer /** * Send mail using the PHP mail() function. * - * @see http://www.php.net/manual/en/book.mail.php + * @see https://www.php.net/manual/en/book.mail.php * * @param string $header The message headers * @param string $body The message body @@ -1858,18 +1975,27 @@ class PHPMailer foreach ($this->to as $toaddr) { $toArr[] = $this->addrFormat($toaddr); } - $to = implode(', ', $toArr); + $to = trim(implode(', ', $toArr)); + + //If there are no To-addresses (e.g. when sending only to BCC-addresses) + //the following should be added to get a correct DKIM-signature. + //Compare with $this->preSend() + if ($to === '') { + $to = 'undisclosed-recipients:;'; + } $params = null; //This sets the SMTP envelope sender which gets turned into a return-path header by the receiver //A space after `-f` is optional, but there is a long history of its presence //causing problems, so we don't use one - //Exim docs: http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html - //Sendmail docs: http://www.sendmail.org/~ca/email/man/sendmail.html - //Qmail docs: http://www.qmail.org/man/man8/qmail-inject.html + //Exim docs: https://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_exim_command_line.html + //Sendmail docs: https://www.sendmail.org/~ca/email/man/sendmail.html //Example problem: https://www.drupal.org/node/1057954 //CVE-2016-10033, CVE-2016-10045: Don't pass -f if characters will be escaped. - if (empty($this->Sender) && !empty(ini_get('sendmail_from'))) { + + //PHP 5.6 workaround + $sendmail_from_value = ini_get('sendmail_from'); + if (empty($this->Sender) && !empty($sendmail_from_value)) { //PHP config has a sender address we can use $this->Sender = ini_get('sendmail_from'); } @@ -1884,7 +2010,7 @@ class PHPMailer if ($this->SingleTo && count($toArr) > 1) { foreach ($toArr as $toAddr) { $result = $this->mailPassthru($toAddr, $this->Subject, $body, $header, $params); - $addrinfo = static::parseAddresses($toAddr); + $addrinfo = static::parseAddresses($toAddr, true, $this->CharSet); $this->doCallback( $result, [[$addrinfo['address'], $addrinfo['name']]], @@ -1938,6 +2064,38 @@ class PHPMailer return $this->smtp; } + /** + * Provide SMTP XCLIENT attributes + * + * @param string $name Attribute name + * @param ?string $value Attribute value + * + * @return bool + */ + public function setSMTPXclientAttribute($name, $value) + { + if (!in_array($name, SMTP::$xclient_allowed_attributes)) { + return false; + } + if (isset($this->SMTPXClient[$name]) && $value === null) { + unset($this->SMTPXClient[$name]); + } elseif ($value !== null) { + $this->SMTPXClient[$name] = $value; + } + + return true; + } + + /** + * Get SMTP XCLIENT attributes + * + * @return array + */ + public function getSMTPXclientAttributes() + { + return $this->SMTPXClient; + } + /** * Send mail via SMTP. * Returns false if there is a bad MAIL FROM, RCPT, or DATA input. @@ -1960,12 +2118,20 @@ class PHPMailer if (!$this->smtpConnect($this->SMTPOptions)) { throw new Exception($this->lang('smtp_connect_failed'), self::STOP_CRITICAL); } + //If we have recipient addresses that need Unicode support, + //but the server doesn't support it, stop here + if ($this->UseSMTPUTF8 && !$this->smtp->getServerExt('SMTPUTF8')) { + throw new Exception($this->lang('no_smtputf8'), self::STOP_CRITICAL); + } //Sender already validated in preSend() if ('' === $this->Sender) { $smtp_from = $this->From; } else { $smtp_from = $this->Sender; } + if (count($this->SMTPXClient)) { + $this->smtp->xclient($this->SMTPXClient); + } if (!$this->smtp->mail($smtp_from)) { $this->setError($this->lang('from_failed') . $smtp_from . ' : ' . implode(',', $this->smtp->getError())); throw new Exception($this->ErrorInfo, self::STOP_CRITICAL); @@ -2058,6 +2224,10 @@ class PHPMailer $this->smtp->setDebugLevel($this->SMTPDebug); $this->smtp->setDebugOutput($this->Debugoutput); $this->smtp->setVerp($this->do_verp); + $this->smtp->setSMTPUTF8($this->UseSMTPUTF8); + if ($this->Host === null) { + $this->Host = 'localhost'; + } $hosts = explode(';', $this->Host); $lastexception = null; @@ -2125,15 +2295,23 @@ class PHPMailer $this->smtp->hello($hello); //Automatically enable TLS encryption if: //* it's not disabled + //* we are not connecting to localhost //* we have openssl extension //* we are not already using SSL //* the server offers STARTTLS - if ($this->SMTPAutoTLS && $sslext && 'ssl' !== $secure && $this->smtp->getServerExt('STARTTLS')) { + if ( + $this->SMTPAutoTLS && + $this->Host !== 'localhost' && + $sslext && + $secure !== 'ssl' && + $this->smtp->getServerExt('STARTTLS') + ) { $tls = true; } if ($tls) { if (!$this->smtp->startTLS()) { - throw new Exception($this->lang('connect_host')); + $message = $this->getSmtpErrorMessage('connect_host'); + throw new Exception($message); } //We must resend EHLO after TLS negotiation $this->smtp->hello($hello); @@ -2164,6 +2342,11 @@ class PHPMailer if ($this->exceptions && null !== $lastexception) { throw $lastexception; } + if ($this->exceptions) { + // no exception was thrown, likely $this->smtp->connect() failed + $message = $this->getSmtpErrorMessage('connect_host'); + throw new Exception($message); + } return false; } @@ -2181,14 +2364,15 @@ class PHPMailer /** * Set the language for error messages. - * Returns false if it cannot load the language file. * The default language is English. * * @param string $langcode ISO 639-1 2-character language code (e.g. French is "fr") - * @param string $lang_path Path to the language file directory, with trailing separator (slash).D + * Optionally, the language code can be enhanced with a 4-character + * script annotation and/or a 2-character country annotation. + * @param string $lang_path Path to the language file directory, with trailing separator (slash) * Do not set this from user input! * - * @return bool + * @return bool Returns true if the requested language was loaded, false otherwise. */ public function setLanguage($langcode = 'en', $lang_path = '') { @@ -2211,44 +2395,78 @@ class PHPMailer //Define full set of translatable strings in English $PHPMAILER_LANG = [ 'authenticate' => 'SMTP Error: Could not authenticate.', + 'buggy_php' => 'Your version of PHP is affected by a bug that may result in corrupted messages.' . + ' To fix it, switch to sending using SMTP, disable the mail.add_x_header option in' . + ' your php.ini, switch to MacOS or Linux, or upgrade your PHP to version 7.0.17+ or 7.1.3+.', 'connect_host' => 'SMTP Error: Could not connect to SMTP host.', 'data_not_accepted' => 'SMTP Error: data not accepted.', 'empty_message' => 'Message body empty', 'encoding' => 'Unknown encoding: ', 'execute' => 'Could not execute: ', + 'extension_missing' => 'Extension missing: ', 'file_access' => 'Could not access file: ', 'file_open' => 'File Error: Could not open file: ', 'from_failed' => 'The following From address failed: ', 'instantiate' => 'Could not instantiate mail function.', 'invalid_address' => 'Invalid address: ', + 'invalid_header' => 'Invalid header name or value', 'invalid_hostentry' => 'Invalid hostentry: ', 'invalid_host' => 'Invalid host: ', 'mailer_not_supported' => ' mailer is not supported.', 'provide_address' => 'You must provide at least one recipient email address.', 'recipients_failed' => 'SMTP Error: The following recipients failed: ', 'signing' => 'Signing Error: ', + 'smtp_code' => 'SMTP code: ', + 'smtp_code_ex' => 'Additional SMTP info: ', 'smtp_connect_failed' => 'SMTP connect() failed.', + 'smtp_detail' => 'Detail: ', 'smtp_error' => 'SMTP server error: ', 'variable_set' => 'Cannot set or reset variable: ', - 'extension_missing' => 'Extension missing: ', + 'no_smtputf8' => 'Server does not support SMTPUTF8 needed to send to Unicode addresses', ]; if (empty($lang_path)) { //Calculate an absolute path so it can work if CWD is not here $lang_path = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'language' . DIRECTORY_SEPARATOR; } + //Validate $langcode - if (!preg_match('/^[a-z]{2}(?:_[a-zA-Z]{2})?$/', $langcode)) { + $foundlang = true; + $langcode = strtolower($langcode); + if ( + !preg_match('/^(?P[a-z]{2})(?P \r\n"; + if ($async) { - $b .= " \r\n"; - $b .= "
\r\n\r\n
"; - } else { - $b .= " \r\n"; + $b .= "
\r\n\r\n
"; } /* @@ -89,7 +93,7 @@ function piwik_analytics(string &$b) $b .= ""; } @@ -104,6 +108,7 @@ function piwik_addon_admin (string &$o) '$siteid' => ['siteid', DI::l10n()->t('Site ID'), DI::config()->get('piwik','siteid' ), ''], '$optout' => ['optout', DI::l10n()->t('Show opt-out cookie link?'), DI::config()->get('piwik','optout' ), ''], '$async' => ['async', DI::l10n()->t('Asynchronous tracking'), DI::config()->get('piwik','async' ), ''], + '$shortendpoint' => ['shortendpoint', DI::l10n()->t("Shortcut path to the script ('/js/' instead of '/piwik.js')"), DI::config()->get('piwik','shortendpoint' ), ''], ]); } @@ -113,4 +118,5 @@ function piwik_addon_admin_post() DI::config()->set('piwik', 'siteid', trim($_POST['siteid'] ?? '')); DI::config()->set('piwik', 'optout', trim($_POST['optout'] ?? '')); DI::config()->set('piwik', 'async', trim($_POST['async'] ?? '')); + DI::config()->set('piwik', 'shortendpoint', trim($_POST['shortendpoint'] ?? '')); } diff --git a/piwik/templates/admin.tpl b/piwik/templates/admin.tpl index 2ab1869b..7a9b5d71 100644 --- a/piwik/templates/admin.tpl +++ b/piwik/templates/admin.tpl @@ -2,4 +2,5 @@ {{include file="field_input.tpl" field=$siteid}} {{include file="field_checkbox.tpl" field=$optout}} {{include file="field_checkbox.tpl" field=$async}} +{{include file="field_checkbox.tpl" field=$shortendpoint}}
diff --git a/planets/lang/bg/messages.po b/planets/lang/bg/messages.po new file mode 100644 index 00000000..d4e30492 --- /dev/null +++ b/planets/lang/bg/messages.po @@ -0,0 +1,27 @@ +# ADDON planets +# Copyright (C) +# This file is distributed under the same license as the Friendica planets addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:15-0500\n" +"PO-Revision-Date: 2014-06-23 11:19+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: planets.php:126 +msgid "Enable Planets Addon" +msgstr "" + +#: planets.php:131 +msgid "Planets Settings" +msgstr "" diff --git a/planets/lang/bg/strings.php b/planets/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/planets/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: planets.php:126 +msgid "Enable Planets Addon" +msgstr "" + +#: planets.php:131 +msgid "Planets Settings" +msgstr "" diff --git a/planets/lang/ca/strings.php b/planets/lang/ca/strings.php index 625dcab9..d34874f6 100644 --- a/planets/lang/ca/strings.php +++ b/planets/lang/ca/strings.php @@ -1,5 +1,7 @@ -strings["Planets Settings"] = "Ajustos de Planet"; -$a->strings["Enable Planets Addon"] = "Activa Addon de Planet"; -$a->strings["Submit"] = "Enviar"; +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: planets.php:126 +msgid "Enable Planets Addon" +msgstr "" + +#: planets.php:131 +msgid "Planets Settings" +msgstr "" diff --git a/planets/lang/eo/strings.php b/planets/lang/eo/strings.php index c6b6d413..68e8a64c 100644 --- a/planets/lang/eo/strings.php +++ b/planets/lang/eo/strings.php @@ -1,5 +1,7 @@ -strings["Planets Settings"] = "Agordo pri Planets"; -$a->strings["Enable Planets Addon"] = "Ŝalti la Planets kromprogamon"; -$a->strings["Submit"] = "Sendi"; +\n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: planets.php:126 +msgid "Enable Planets Addon" +msgstr "" + +#: planets.php:131 +msgid "Planets Settings" +msgstr "" diff --git a/planets/lang/gd/strings.php b/planets/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/planets/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/planets/lang/is/messages.po b/planets/lang/is/messages.po new file mode 100644 index 00000000..9a82e125 --- /dev/null +++ b/planets/lang/is/messages.po @@ -0,0 +1,27 @@ +# ADDON planets +# Copyright (C) +# This file is distributed under the same license as the Friendica planets addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:15-0500\n" +"PO-Revision-Date: 2014-06-23 11:19+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: planets.php:126 +msgid "Enable Planets Addon" +msgstr "" + +#: planets.php:131 +msgid "Planets Settings" +msgstr "" diff --git a/planets/lang/is/strings.php b/planets/lang/is/strings.php index 82f8b728..975c341e 100644 --- a/planets/lang/is/strings.php +++ b/planets/lang/is/strings.php @@ -1,5 +1,7 @@ -strings["Planets Settings"] = ""; -$a->strings["Enable Planets Addon"] = ""; -$a->strings["Submit"] = "Senda inn"; + */ -use Friendica\App; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; @@ -29,7 +27,7 @@ function planets_install() Hook::register('addon_settings', 'addon/planets/planets.php', 'planets_settings'); Hook::register('addon_settings_post', 'addon/planets/planets.php', 'planets_settings_post'); - Logger::notice("installed planets"); + DI::logger()->notice("installed planets"); } /** @@ -40,7 +38,7 @@ function planets_install() */ function planets_post_hook(&$item) { - Logger::notice('planets invoked'); + DI::logger()->notice('planets invoked'); if (!DI::userSession()->getLocalUserId()) { /* non-zero if this is a logged in user of this system */ diff --git a/twitter/vendor/jublonet/codebird-php/LICENSE b/pnut/LICENSE similarity index 86% rename from twitter/vendor/jublonet/codebird-php/LICENSE rename to pnut/LICENSE index 94a9ed02..fe6b9036 100644 --- a/twitter/vendor/jublonet/codebird-php/LICENSE +++ b/pnut/LICENSE @@ -1,23 +1,21 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 - Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble - The GNU General Public License is a free, copyleft license for -software and other kinds of works. + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to +our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. +software for all its users. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you @@ -26,44 +24,34 @@ them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. The precise terms and conditions for copying, distribution and modification follow. @@ -72,7 +60,7 @@ modification follow. 0. Definitions. - "This License" refers to version 3 of the GNU General Public License. + "This License" refers to version 3 of the GNU Affero General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. @@ -549,35 +537,45 @@ to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. - 13. Use with the GNU Affero General Public License. + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single +under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General +Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published +GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's +versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. @@ -635,40 +633,30 @@ the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + GNU Affero General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program. If not, see . + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. +For more information on this, and how to apply and follow the GNU AGPL, see +. - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/pnut/README.md b/pnut/README.md new file mode 100644 index 00000000..798174b8 --- /dev/null +++ b/pnut/README.md @@ -0,0 +1,10 @@ +# Pnut connector + +With this addon to friendica you can give your users the possibility to post their *public* messages to pnut.io. + +No setup is needed for the admins to make it work for their users, however it is possible for the admin to create a client, so that the users don't have to. + +To do so, go to https://pnut.io/dev and scroll down to "Create New Client". +Enter a name of your choice and enter your Friendica host name as the website. +Use https://(yourhost.name)/pnut/connect as a redirect url, replace "(yourhost.name)" with the host name of your system. +Limit the scope to "basic,files,follow,polls,presence,stream,update_profile,write_post" \ No newline at end of file diff --git a/pnut/lang/C/messages.po b/pnut/lang/C/messages.po new file mode 100644 index 00000000..89b065fd --- /dev/null +++ b/pnut/lang/C/messages.po @@ -0,0 +1,74 @@ +# ADDON pnut +# Copyright (C) +# This file is distributed under the same license as the Friendica pnut addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-03-03 11:53+0000\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: pnut.php:42 +msgid "Permission denied." +msgstr "" + +#: pnut.php:79 +msgid "You are now authenticated with pnut.io." +msgstr "" + +#: pnut.php:82 +msgid "Error fetching token. Please try again." +msgstr "" + +#: pnut.php:85 +msgid "return to the connector page" +msgstr "" + +#: pnut.php:103 +msgid "Save Settings" +msgstr "" + +#: pnut.php:104 pnut.php:150 +msgid "Client ID" +msgstr "" + +#: pnut.php:105 pnut.php:151 +msgid "Client Secret" +msgstr "" + +#: pnut.php:139 +msgid "Authenticate with pnut.io" +msgstr "" + +#: pnut.php:143 +msgid "Disconnect" +msgstr "" + +#: pnut.php:148 +msgid "Enable Pnut Post Addon" +msgstr "" + +#: pnut.php:149 +msgid "Post to Pnut by default" +msgstr "" + +#: pnut.php:152 +msgid "Access Token" +msgstr "" + +#: pnut.php:161 +msgid "Pnut Export" +msgstr "" + +#: pnut.php:203 +msgid "Post to Pnut" +msgstr "" diff --git a/pnut/lib/LICENSE b/pnut/lib/LICENSE new file mode 100644 index 00000000..579599a8 --- /dev/null +++ b/pnut/lib/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2013, Josh Dolitsky +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Josh Dolitsky nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL TRAVIS RICHARDSON BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \ No newline at end of file diff --git a/pnut/lib/phpnut.php b/pnut/lib/phpnut.php new file mode 100644 index 00000000..716945ed --- /dev/null +++ b/pnut/lib/phpnut.php @@ -0,0 +1,2512 @@ +_clientId = $client_id_or_token; + $this->_clientSecret = $client_secret; + } else { + $this->_accessToken = $client_id_or_token; + } + + // if the digicert certificate exists in the same folder as this file, + // remember that fact for later + if (file_exists(__DIR__ . '/DigiCertHighAssuranceEVRootCA.pem')) { + $this->_sslCA = __DIR__ . '/DigiCertHighAssuranceEVRootCA.pem'; + } + } + + /** + * Set whether or not to strip Envelope Response (meta) information + * This option will be deprecated in the future. Is it to allow + * a stepped migration path between code expecting the old behavior + * and new behavior. When not stripped, you still can use the proper + * method to pull the meta information. Please start converting your code ASAP + */ + public function includeResponseEnvelope(): void + { + $this->_stripResponseEnvelope = false; + } + + /** + * Construct the proper Auth URL for the user to visit and either grant + * or not access to your app. Usually you would place this as a link for + * the user to client, or a redirect to send them to the auth URL. + * Also can be called after authentication for additional scopes + * @param string $callback_uri Where you want the user to be directed + * after authenticating with pnut.io. This must be one of the URIs + * allowed by your pnut.io application settings. + * @param array $scope An array of scopes (permissions) you wish to obtain + * from the user. If you don't specify anything, you'll only receive + * access to the user's basic profile (the default). + */ + public function getAuthUrl(?string $callback_uri=null, array $scope=null): string + { + if (empty($this->_clientId)) { + throw new phpnutException('You must specify your pnut client ID'); + } + + if (is_null($callback_uri)) { + if (defined('PNUT_REDIRECT_URI')) { + $callback_uri = PNUT_REDIRECT_URI; + } elseif (isset($_ENV['PNUT_REDIRECT_URI'])) { + $callback_uri = $_ENV['PNUT_REDIRECT_URI']; + } else { + throw new phpnutException('You must specify your pnut callback URI'); + } + } + + if (is_null($scope)) { + if (defined('PNUT_APP_SCOPE')) { + $scope = PNUT_APP_SCOPE; + } elseif (isset($_ENV['PNUT_APP_SCOPE'])) { + $scope = $_ENV['PNUT_APP_SCOPE']; + } else { + $scope = 'basic'; + } + } + + if (is_array($scope)) { + $scope = implode(',', $scope); + } + + // construct an authorization url based on our client id and other data + $data = [ + 'client_id'=>$this->_clientId, + 'response_type'=>'code', + 'redirect_uri'=>$callback_uri, + 'scope'=>$scope, + ]; + + $url = $this->_authUrl; + if ($this->_accessToken) { + $url .= 'authorize?'; + } else { + $url .= 'authenticate?'; + } + $url .= $this->buildQueryString($data); + + // return the constructed url + return $url; + } + + /** + * Call this after they return from the auth page, or anytime you need the + * token. For example, you could store it in a database and use + * setAccessToken() later on to return on behalf of the user. + */ + public function getAccessToken(string $callback_uri) + { + // if there's no access token set, and they're returning from + // the auth page with a code, use the code to get a token + if (!$this->_accessToken && isset($_GET['code']) && $_GET['code'] !== '') { + + if (empty($this->_clientId) || empty($this->_clientSecret)) { + throw new phpnutException('You must specify your Pnut client ID and client secret'); + } + + // construct the necessary elements to get a token + $data = [ + 'client_id'=>$this->_clientId, + 'client_secret'=>$this->_clientSecret, + 'grant_type'=>'authorization_code', + 'redirect_uri'=>$callback_uri, + 'code'=>$_GET['code'], + ]; + + // try and fetch the token with the above data + $res = $this->httpReq( + 'post', + "{$this->_baseUrl}oauth/access_token", + $data + ); + + // store it for later + $this->_accessToken = $res['access_token']; + $this->_username = $res['username']; + $this->_user_id = $res['user_id']; + } + + // return what we have (this may be a token, or it may be nothing) + return $this->_accessToken; + } + + /** + * Check the scope of current token to see if it has required scopes + * has to be done after a check + * + * @return int|array + */ + public function checkScopes(array $app_scopes) + { + if (count($this->_scopes) === 0) { + return -1; // _scope is empty + } + $missing = []; + foreach($app_scopes as $scope) { + if (!in_array($scope, $this->_scopes)) { + if ($scope === 'public_messages') { + // messages works for public_messages + if (in_array('messages', $this->_scopes)) { + // if we have messages in our scopes + continue; + } + } + $missing[] = $scope; + } + } + // identify the ones missing + if (count($missing) !== 0) { + // do something + return $missing; + } + return 0; // 0 missing + } + + /** + * Set the access token (eg: after retrieving it from offline storage) + * @param string $token A valid access token you're previously received + * from calling getAccessToken(). + */ + public function setAccessToken(?string $token=null): void + { + $this->_accessToken = $token; + } + + /** + * Deauthorize the current token (delete your authorization from the API) + * Generally this is useful for logging users out from a web app, so they + * don't get automatically logged back in the next time you redirect them + * to the authorization URL. + */ + public function deauthorizeToken() + { + return $this->httpReq('delete', "{$this->_baseUrl}token"); + } + + /** + * Retrieve an app access token from the app.net API. This allows you + * to access the API without going through the user access flow if you + * just want to (eg) consume global. App access tokens are required for + * some actions (like streaming global). DO NOT share the return value + * of this function with any user (or save it in a cookie, etc). This + * is considered secret info for your app only. + * @return string The app access token + */ + public function getAppAccessToken() + { + if (empty($this->_clientId) || empty($this->_clientSecret)) { + throw new phpnutException('You must specify your Pnut client ID and client secret'); + } + + // construct the necessary elements to get a token + $data = [ + 'client_id'=>$this->_clientId, + 'client_secret'=>$this->_clientSecret, + 'grant_type'=>'client_credentials', + ]; + // try and fetch the token with the above data + $res = $this->httpReq( + 'post', + "{$this->_baseUrl}oauth/access_token", + $data + ); + // store it for later + $this->_appAccessToken = $res['access_token']; + $this->_accessToken = $res['access_token']; + $this->_username = null; + $this->_user_id = null; + return $this->_accessToken; + } + + /** + * Returns the total number of requests you're allowed within the + * alloted time period. + * @see getRateLimitReset() + */ + public function getRateLimit() + { + return $this->_rateLimit; + } + + /** + * The number of requests you have remaining within the alloted time period + * @see getRateLimitReset() + */ + public function getRateLimitRemaining() + { + return $this->_rateLimitRemaining; + } + + /** + * The number of seconds remaining in the alloted time period. + * When this time is up you'll have getRateLimit() available again. + */ + public function getRateLimitReset() + { + return $this->_rateLimitReset; + } + + /** + * The scope the user has + */ + public function getScope() + { + return $this->_scope; + } + + /** + * Internal function, parses out important information pnut.io adds + * to the headers. + */ + protected function parseHeaders(string $response) + { + // take out the headers + // set internal variables + // return the body/content + $this->_rateLimit = null; + $this->_rateLimitRemaining = null; + $this->_rateLimitReset = null; + $this->_scope = null; + + $response = explode("\r\n\r\n", $response, 2); + $headers = $response[0]; + + if ($headers === 'HTTP/1.1 100 Continue') { + $response = explode("\r\n\r\n", $response[1], 2); + $headers = $response[0]; + } + + // this is not a good way to parse http headers + // it will not (for example) take into account multiline headers + // but what we're looking for is pretty basic, so we can ignore those shortcomings + $headers = explode("\r\n", $headers); + foreach ($headers as $header) { + $header = explode(': ', $header, 2); + if (count($header) < 2) { + continue; + } + list($k, $v) = $header; + switch ($k) { + case 'X-RateLimit-Remaining': + $this->_rateLimitRemaining = $v; + break; + case 'X-RateLimit-Limit': + $this->_rateLimit = $v; + break; + case 'X-RateLimit-Reset': + $this->_rateLimitReset = $v; + break; + case 'X-OAuth-Scopes': + $this->_scope = $v; + $this->_scopes = explode(',', $v); + break; + } + } + return $response[1] ?? null; + } + + /** + * Internal function. Used to turn things like TRUE into 1, and then + * calls http_build_query. + */ + protected function buildQueryString(array $array): string + { + foreach ($array as $k => &$v) { + if (is_array($v)) { + $v = implode(',', $v); + } elseif ($v === true) { + $v = '1'; + } + elseif ($v === false) { + $v = '0'; + } + unset($v); + } + return http_build_query($array); + } + + + /** + * Internal function to handle all + * HTTP requests (POST,PUT,GET,DELETE) + * + * @param string|array $params + */ + protected function httpReq(string $act, string $req, $params = [], string $contentType='application/x-www-form-urlencoded') + { + $ch = curl_init($req); + $headers = []; + if($act !== 'get') { + curl_setopt($ch, CURLOPT_POST, true); + // if they passed an array, build a list of parameters from it + if (is_array($params) && $act !== 'post-raw') { + $params = $this->buildQueryString($params); + } + curl_setopt($ch, CURLOPT_POSTFIELDS, $params); + $headers[] = "Content-Type: {$contentType}"; + } + if($act !== 'post' && $act !== 'post-raw') { + curl_setopt($ch, CURLOPT_CUSTOMREQUEST, strtoupper($act)); + } + if($act === 'get' && isset($params['access_token'])) { + $headers[] = "Authorization: Bearer {$params['access_token']}"; + } elseif ($this->_accessToken) { + $headers[] = "Authorization: Bearer {$this->_accessToken}"; + } + curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLINFO_HEADER_OUT, true); + curl_setopt($ch, CURLOPT_HEADER, true); + if ($this->_sslCA) { + curl_setopt($ch, CURLOPT_CAINFO, $this->_sslCA); + } + $this->_last_response = curl_exec($ch); + $this->_last_request = curl_getinfo($ch, CURLINFO_HEADER_OUT); + $http_status = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); + + if ($http_status === 0) { + throw new phpnutException("Unable to connect to {$req}"); + } + if ($this->_last_request === false) { + if (!curl_getinfo($ch, CURLINFO_SSL_VERIFYRESULT)) { + throw new phpnutException('SSL verification failed, connection terminated.'); + } + } + if ($this->_last_response) { + $response = $this->parseHeaders($this->_last_response); + if ($response) { + $response = json_decode($response, true); + + if (isset($response['meta'])) { + if (isset($response['meta']['max_id'])) { + $this->_maxid = $response['meta']['max_id']; + $this->_minid = $response['meta']['min_id']; + } + if (isset($response['meta']['more'])) { + $this->_more = $response['meta']['more']; + } + if (isset($response['meta']['marker'])) { + $this->_last_marker = $response['meta']['marker']; + } + } + + // look for errors + if (isset($response['error'])) { + if (is_array($response['error'])) { + throw new phpnutException( + $response['error']['message'], + $response['error']['code'] + ); + } else { + throw new phpnutException($response['error']); + } + } + + // look for response migration errors + elseif (isset($response['meta'], $response['meta']['error_message'])) { + throw new phpnutException( + $response['meta']['error_message'], + $response['meta']['code'] + ); + } + } + } + + if ($http_status < 200 || $http_status >= 300) { + throw new phpnutException("HTTP error {$http_status}"); + } + + // if we've received a migration response, handle it and return data only + elseif ($this->_stripResponseEnvelope && isset($response['meta'], $response['data'])) { + return $response['data']; + } + + // else non response migration response, just return it + elseif (isset($response)) { + return $response; + } + + else { + throw new phpnutException('No response'); + } + } + + + /** + * Get max_id from last meta response data envelope + */ + public function getResponseMaxID() + { + return $this->_maxid; + } + + /** + * Get min_id from last meta response data envelope + */ + public function getResponseMinID() + { + return $this->_minid; + } + + /** + * Get more from last meta response data envelope + */ + public function getResponseMore() + { + return $this->_more; + } + + /** + * Get marker from last meta response data envelope + */ + public function getResponseMarker() + { + return $this->_last_marker; + } + + public function getLastRequest() + { + return $this->_last_request; + } + + public function getLastResponse() + { + return $this->_last_response; + } + + /** + * Fetch API configuration object + * @return array + */ + public function getConfig() + { + return $this->httpReq('get', "{$this->_baseUrl}sys/config"); + } + + /** + * Fetch basic API statistics + * @return array + */ + public function getStats() + { + return $this->httpReq('get', "{$this->_baseUrl}sys/stats"); + } + + /** + * Process user content, message or post text. + * Mentions and hashtags will be parsed out of the + * text, as will bare URLs. To create a link in the text without using a + * bare URL, include the anchor text in the object text and include a link + * entity in the function call. + * @param string $text The text of the user/message/post + * @param array $data An associative array of optional post data. This + * will likely change as the API evolves, as of this writing allowed keys are: + * reply_to, and raw. "raw" may be a complex object represented + * by an associative array. + * @param array $params An associative array of optional data to be included + * in the URL (such as 'include_raw') + * @return array An associative array representing the post. + */ + public function processText(string $text, array $data=[], array $params=[]) + { + $data['text'] = $text; + $json = json_encode($data); + $qs = ''; + if (!empty($params)) { + $qs = '?' . $this->buildQueryString($params); + } + return $this->httpReq( + 'post', + $this->_baseUrl . 'text/process' . $qs, + $json, + 'application/json' + ); + } + + /** + * Create a new Post object. Mentions and hashtags will be parsed out of the + * post text, as will bare URLs. To create a link in a post without using a + * bare URL, include the anchor text in the post's text and include a link + * entity in the post creation call. + * @param string $text The text of the post + * @param array $data An associative array of optional post data. This + * will likely change as the API evolves, as of this writing allowed keys are: + * reply_to, is_nsfw, and raw. "raw" may be a complex object represented + * by an associative array. + * @param array $params An associative array of optional data to be included + * in the URL (such as 'include_raw') + * @return array An associative array representing the post. + */ + public function createPost(string $text, array $data=[], array $params=[]) + { + $data['text'] = $text; + $json = json_encode($data); + $qs = ''; + if (!empty($params)) { + $qs = '?' . $this->buildQueryString($params); + } + return $this->httpReq( + 'post', + $this->_baseUrl . 'posts' . $qs, + $json, + 'application/json' + ); + } + + /** + * Create a new Post object. Mentions and hashtags will be parsed out of the + * post text, as will bare URLs. To create a link in a post without using a + * bare URL, include the anchor text in the post's text and include a link + * entity in the post creation call. + * @param integer $post_id The ID of the post to revise + * @param string $text The new text of the post + * @param array $data An associative array of optional post data. This + * will likely change as the API evolves, as of this writing allowed keys are: + * is_nsfw. + * @param array $params An associative array of optional data to be included + * in the URL (such as 'include_raw') + * @return array An associative array representing the post. + */ + public function revisePost(int $post_id, string $text, array $data=[], array $params=[]) + { + $data['text'] = $text; + $json = json_encode($data); + $qs = ''; + if (!empty($params)) { + $qs = '?' . $this->buildQueryString($params); + } + return $this->httpReq( + 'put', + $this->_baseUrl . 'posts/' . urlencode($post_id) . $qs, + $json, + 'application/json' + ); + } + + /** + * Returns a specific Post. + * @param integer $post_id The ID of the post to retrieve + * @param array $params An associative array of optional general parameters. + * @return array An associative array representing the post + */ + public function getPost(int $post_id, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'posts/' . urlencode($post_id) . '?' + . $this->buildQueryString($params) + ); + } + + /** + * Returns a list of Posts. + * @param array $post_ids The list of post IDs to retrieve + * @param array $params An associative array of optional general parameters. + * @return array An array of arrays representing the posts + */ + public function getMultiplePosts(array $post_ids, array $params=[]) + { + $params['ids'] = $post_ids; + + return $this->httpReq( + 'get', + $this->_baseUrl . 'posts?' . $this->buildQueryString($params) + ); + } + + /** + * Delete a Post. The current user must be the same user who created the Post. + * It returns the deleted Post on success. + * @param integer $post_id The ID of the post to delete + * @return array An associative array representing the post that was deleted + */ + public function deletePost(int $post_id) + { + return $this->httpReq( + 'delete', + $this->_baseUrl . 'posts/' . urlencode($post_id) + ); + } + + /** + * Retrieve the Posts that are 'in reply to' a specific Post. + * @param integer $post_id The ID of the post you want to retrieve replies for. + * @param array $params An associative array of optional general parameters. + * @return array An array of associative arrays, each representing a single post. + */ + public function getPostThread(int $post_id, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'posts/' . urlencode($post_id) . '/thread?' + . $this->buildQueryString($params) + ); + } + + /** + * Retrieve revisions of a post. Currently only one can be created. + * @param integer $post_id The ID of the post you want to retrieve previous revisions of. + * @param array $params An associative array of optional general parameters. + * @return array An array of associative arrays, each representing a single post. + */ + public function getPostRevisions(int $post_id, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'posts/' . urlencode($post_id) . '/revisions?' + . $this->buildQueryString($params) + ); + } + + /** + * Get the most recent Posts created by a specific User in reverse + * chronological order (most recent first). + * @param string|int $user_id $user_id Either the ID of the user you wish to retrieve posts by, + * or the string "me", which will retrieve posts for the user you're authenticated + * as. + * @param array $params An associative array of optional general parameters. + * @return array An array of associative arrays, each representing a single post. + */ + public function getUserPosts($user_id = 'me', array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'users/' . urlencode($user_id) . '/posts?' + . $this->buildQueryString($params) + ); + } + + /** + * Get the most recent Posts mentioning by a specific User in reverse + * chronological order (newest first). + * @param string|int $user_id Either the ID of the user who is being mentioned, or + * the string "me", which will retrieve posts for the user you're authenticated + * as. + * @param array $params An associative array of optional general parameters. + * @return array An array of associative arrays, each representing a single post. + */ + public function getUserMentions($user_id='me', array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'users/' . urlencode($user_id) . '/mentions?' + . $this->buildQueryString($params) + ); + } + + /** + * Get the currently authenticated user's recent messages + * @param array $params An associative array of optional general parameters. + * @return array An array of associative arrays, each representing a single post. + */ + public function getUserMessages(array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'users/me/messages?' + . $this->buildQueryString($params) + ); + } + + /** + * Return the 20 most recent posts from the current User and + * the Users they follow. + * @param array $params An associative array of optional general parameters. + * @return array An array of associative arrays, each representing a single post. + */ + public function getUserStream(array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'posts/streams/me?' + . $this->buildQueryString($params) + ); + } + + /** + * Retrieve a list of all public Posts on pnut.io, often referred to as the + * global stream. + * @param array $params An associative array of optional general parameters. + * @return array An array of associative arrays, each representing a single post. + */ + public function getPublicPosts(array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'posts/streams/global?' + . $this->buildQueryString($params) + ); + } + + /** + * Retrieve a list of "explore" streams + * @return array An array of associative arrays, each representing a single explore stream. + */ + public function getPostExploreStreams() + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'posts/streams/explore' + ); + } + + /** + * Retrieve a list of posts from an "explore" stream on pnut.io. + * @param string $slug [] + * @param array $params An associative array of optional general parameters. + * @return array An array of associative arrays, each representing a single post. + */ + public function getPostExploreStream(string $slug, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'posts/streams/explore/' . urlencode($slug) . '?' + . $this->buildQueryString($params) + ); + } + + /** + * Bookmark a post + * @param integer $post_id The post ID to bookmark + */ + public function bookmarkPost(int $post_id) + { + return $this->httpReq( + 'put', + $this->_baseUrl . 'posts/' . urlencode($post_id) . '/bookmark' + ); + } + + /** + * Unbookmark a post + * @param integer $post_id The post ID to unbookmark + */ + public function unbookmarkPost(int $post_id) + { + return $this->httpReq( + 'delete', + $this->_baseUrl . 'posts/' . urlencode($post_id) . '/bookmark' + ); + } + + /** + * List the posts bookmarked by the current user + * @param array $params An associative array of optional general parameters. + * This will likely change as the API evolves, as of this writing allowed keys + * are: count, before_id, since_id, include_muted, include_deleted, + * and include_post_raw. + * See https://github.com/phpnut/api-spec/blob/master/resources/posts.md#general-parameters + * @param string|int $user_id + * @return array An array of associative arrays, each representing a single + * user who has bookmarked a post + */ + public function getBookmarked($user_id='me', array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'users/' . urlencode($user_id) . '/bookmarks?' + . $this->buildQueryString($params) + ); + } + + /** + * List the interactions with a post (bookmark, repost, reply) + * @param integer $post_id the post ID to get interactions from + * @param array $params optional parameters like filters or excludes + * @return array An array of associative arrays, each representing one post interaction. + */ + public function getPostInteractions(int $post_id, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'posts/' . urlencode($post_id) . '/interactions?' + . $this->buildQueryString($params) + ); + } + + /** + * List the bookmarks of a post + * @param integer $post_id the post ID to get stars from + * @return array An array of associative arrays, each representing one bookmark action. + */ + public function getPostBookmarks(int $post_id) + { + return $this->getPostInteractions($post_id, ['filters'=>['bookmark']]); + } + + /** + * Returns an array of User objects of users who reposted the specified post. + * @param integer $post_id the post ID to + * @return array An array of associative arrays, each representing a single + * user who reposted $post_id + */ + public function getPostReposts(int $post_id) + { + return $this->getPostInteractions($post_id, ['filters'=>['repost']]); + } + + /** + * Repost an existing Post object. + * @param integer $post_id The id of the post + * @return mixed the reposted post + */ + public function repost(int $post_id) + { + return $this->httpReq( + 'put', + $this->_baseUrl . 'posts/' . urlencode($post_id) . '/repost' + ); + } + + /** + * Delete a post that the user has reposted. + * @param integer $post_id The id of the post + * @return mixed the un-reposted post + */ + public function deleteRepost(int $post_id) + { + return $this->httpReq( + 'delete', + $this->_baseUrl . 'posts/' . urlencode($post_id) . '/repost' + ); + } + + /** + * Return Posts matching a specific #hashtag. + * @param string $hashtag The hashtag you're looking for. + * @param array $params An associative array of optional general parameters. + * This will likely change as the API evolves, as of this writing allowed keys + * are: count, before_id, since_id, include_muted, include_deleted, + * include_directed_posts, and include_raw. + * @return array An array of associative arrays, each representing a single post. + */ + public function searchHashtags(string $hashtag, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'posts/tags/' . urlencode($hashtag) . '?' + . $this->buildQueryString($params) + ); + } + + /** + * List the posts who match a specific search term + * @param array $params a list of filter, search query, and general Post parameters + * see: https://docs.pnut.io/resources/posts/search + * @param string $query The search query. Supports + * normal search terms. Searches post text. + * @return string|array|false An array of associative arrays, each representing one post. + * or false on error + */ + public function searchPosts(array $params=[], string $query='', string $order='default') + { + if (!is_array($params)) { + return false; + } + if (!empty($query)) { + $params['q'] = $query; + } + if ($order === 'default') { + if (!empty($query)) { + $params['order'] = 'relevance'; + } else { + $params['order'] = 'id'; + } + } + return $this->httpReq( + 'get', + $this->_baseUrl . 'posts/search?' . $this->buildQueryString($params) + ); + } + + /** + * Return the 20 most recent posts for a stream using a valid Token + * @param array $params An associative array of optional general parameters. + * This will likely change as the API evolves, as of this writing allowed keys + * are: count, before_id, since_id, include_muted, include_deleted, + * and include_post_raw. + * @return array An array of associative arrays, each representing a single post. + */ + public function getUserPersonalStream(array $params=[]) + { + if ($params['access_token']) { + return $this->httpReq( + 'get', + $this->_baseUrl . 'posts/streams/me?' + . $this->buildQueryString($params), + $params + ); + } else { + return $this->httpReq( + 'get', + $this->_baseUrl . 'posts/streams/me?' + . $this->buildQueryString($params) + ); + } + } + + /** + * Return the 20 most recent Posts from the current User's personalized stream + * and mentions stream merged into one stream. + * @param array $params An associative array of optional general parameters. + * This will likely change as the API evolves, as of this writing allowed keys + * are: count, before_id, since_id, include_muted, include_deleted, + * include_directed_posts, and include_raw. + * @return array An array of associative arrays, each representing a single post. + */ + public function getUserUnifiedStream(array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'posts/streams/unified?' + . $this->buildQueryString($params) + ); + } + + /** + * List User interactions + */ + public function getMyActions(array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'users/me/interactions?' + . $this->buildQueryString($params) + ); + } + + /** + * Returns a specific user object. + * @param string|int $user_id The ID of the user you want to retrieve, or the string "@-username", or the string + * "me" to retrieve data for the users you're currently authenticated as. + * @param array $params An associative array of optional general parameters. + * This will likely change as the API evolves, as of this writing allowed keys + * are: include_raw|include_user_raw. + * @return array An associative array representing the user data. + */ + public function getUser($user_id='me', array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'users/' . urlencode($user_id) . '?' + . $this->buildQueryString($params) + ); + } + + /** + * Returns multiple users request by an array of user ids + * @param array $params An associative array of optional general parameters. + * This will likely change as the API evolves, as of this writing allowed keys + * are: include_raw|include_user_raw. + * @return array An associative array representing the users data. + */ + public function getUsers(array $user_arr, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'users?ids=' . implode(',', $user_arr) + . '&' . $this->buildQueryString($params) + ); + } + + /** + * Add the specified user ID to the list of users followed. + * Returns the User object of the user being followed. + * @param string|int $user_id The user ID of the user to follow. + * @return array An associative array representing the user you just followed. + */ + public function followUser($user_id) + { + return $this->httpReq( + 'put', + $this->_baseUrl . 'users/' . urlencode($user_id) . '/follow' + ); + } + + /** + * Removes the specified user ID to the list of users followed. + * Returns the User object of the user being unfollowed. + * @param string|int $user_id The user ID of the user to unfollow. + * @return array An associative array representing the user you just unfollowed. + */ + public function unfollowUser($user_id) + { + return $this->httpReq( + 'delete', + $this->_baseUrl . 'users/' . urlencode($user_id) . '/follow' + ); + } + + /** + * Returns an array of User objects the specified user is following. + * @param string|int $user_id Either the ID of the user being followed, or + * the string "me", which will retrieve posts for the user you're authenticated + * as. + * @return array An array of associative arrays, each representing a single + * user following $user_id + */ + public function getFollowing($user_id='me', array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'users/' . urlencode($user_id) . '/following?' + . $this->buildQueryString($params) + ); + } + + /** + * Returns an array of User ids the specified user is following. + * @param string|int $user_id Either the ID of the user being followed, or + * the string "me", which will retrieve posts for the user you're authenticated + * as. + * @return array user ids the specified user is following. + */ + public function getFollowingIDs($user_id='me') + { + return $this->httpReq( + 'get', + "{$this->_baseUrl}users/{$user_id}/following?include_user=0" + ); + } + + /** + * Returns an array of User objects for users following the specified user. + * @param string|int $user_id Either the ID of the user being followed, or + * the string "me", which will retrieve posts for the user you're authenticated + * as. + * @return array An array of associative arrays, each representing a single + * user following $user_id + */ + public function getFollowers($user_id='me', array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'users/' . urlencode($user_id) . '/followers?' + . $this->buildQueryString($params) + ); + } + + /** + * Returns an array of User ids for users following the specified user. + * @param string|int $user_id Either the ID of the user being followed, or + * the string "me", which will retrieve posts for the user you're authenticated + * as. + * @return array user ids for users following the specified user + */ + public function getFollowersIDs($user_id='me') + { + return $this->httpReq( + 'get', + "{$this->_baseUrl}users/{$user_id}/followers?include_user=0" + ); + } + + /** + * Retrieve a user's user ID by specifying their username. + * @param string $username The username of the user you want the ID of, without + * an @ symbol at the beginning. + * @return integer The user's user ID + */ + public function getIdByUsername(string $username) + { + return $this->httpReq( + 'get', + "{$this->_baseUrl}users/@{$username}?include_user=0" + ); + } + + /** + * Mute a user + * @param string|int $user_id The user ID to mute + */ + public function muteUser($user_id) + { + return $this->httpReq( + 'put', + $this->_baseUrl . 'users/' . urlencode($user_id) . '/mute' + ); + } + + /** + * Unmute a user + * @param string|int $user_id The user ID to unmute + */ + public function unmuteUser($user_id) + { + return $this->httpReq( + 'delete', + $this->_baseUrl . 'users/' . urlencode($user_id) . '/mute' + ); + } + + /** + * List the users muted by the current user + * @return array An array of associative arrays, each representing one muted user. + */ + public function getMuted() + { + return $this->httpReq( + 'get', + "{$this->_baseUrl}users/me/muted" + ); + } + + /** + * Get a user object by username + * @param string $name the @name to get + * @return array representing one user + */ + public function getUserByName(string $name) + { + return $this->httpReq( + 'get', + "{$this->_baseUrl}users/@{$name}" + ); + } + + /** + * List the users who match a specific search term + * @param string $query The search query. Supports @username or #tag searches as + * well as normal search terms. Searches username, display name, bio information. + * Does not search posts. + * @return array|false An array of associative arrays, each representing one user. + */ + public function searchUsers(array $params=[], string $query='') + { + if (!is_array($params)) { + return false; + } + if ($query === '') { + return false; + } + $params['q'] = $query; + return $this->httpReq( + 'get', + $this->_baseUrl . 'users/search?q=' . $this->buildQueryString($params) + ); + } + + /** + * Update Profile Data via JSON + * @data array containing user descriptors + */ + public function updateUserData(array $data=[], array $params=[]) + { + $json = json_encode($data); + return $this->httpReq( + 'put', + $this->_baseUrl . 'users/me?' + . $this->buildQueryString($params), + $json, + 'application/json' + ); + } + + /** + * Update a user image + * @image path reference to image + * @which avatar|cover + */ + protected function updateUserImage(string $image, string $which='avatar') + { + $mimeType = ''; + + $test = @getimagesize($image); + if ($test && array_key_exists('mime', $test)) { + $mimeType = $test['mime']; + } + $data = [ + $which => new CURLFile($image, $mimeType) + ]; + return $this->httpReq( + 'post-raw', + "{$this->_baseUrl}users/me/{$which}", + $data, + 'multipart/form-data' + ); + } + + public function updateUserAvatar($avatar) + { + return $this->updateUserImage('avatar', $avatar); + } + + public function updateUserCover($cover) + { + return $this->updateUserImage('cover', $cover); + } + + /** + * Returns a Client object + * @param string $client_id + * @return array An array representing the client + */ + public function getClient(string $client_id, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'clients/' . urlencode($client_id) . '?' + . $this->buildQueryString($params) + ); + } + + /** + * Returns a list of truncated client details made by a user + * @param string $user_id + * @return array A list of arrays representing clients + */ + public function getUserClients(string $user_id) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'users/' . urlencode($user_id) . '/clients' + ); + } + + /** + * update stream marker + */ + public function updateStreamMarker(array $data=[]) + { + $json = json_encode($data); + return $this->httpReq( + 'post', + "{$this->_baseUrl}markers", + $json, + 'application/json' + ); + } + + /** + * get a page of current user subscribed channels + */ + public function getMyChannelSubscriptions(array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'users/me/channels/subscribed?' . $this->buildQueryString($params) + ); + } + + /** + * get user channels + */ + public function getMyChannels(array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'users/me/channels?' . $this->buildQueryString($params) + ); + } + + /** + * create a channel + * note: you cannot create a channel with type=io.pnut.core.pm (see createMessage) + */ + public function createChannel(array $data=[]) + { + $json = json_encode($data); + return $this->httpReq( + 'post', + "{$this->_baseUrl}channels", + $json, + 'application/json' + ); + } + + /** + * get channelid info + */ + public function getChannel(int $channelid, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'channels/' . $channelid . '?' + . $this->buildQueryString($params) + ); + } + + /** + * get an existing private message channel between multiple users + * @param string|array $users Can be a comma- or space-separated string, or an array. + * Usernames with @-symbol, or user ids. + */ + public function getExistingPM($users, array $params=[]) + { + if (is_string($users)) { + $users = explode(',', str_replace(' ', ',', $users)); + } + foreach($users as $key=>$user) { + if (!is_numeric($user) && substr($user, 0, 1) !== '@') { + $users[$key] = "@{$user}"; + } + } + $params['ids'] = $users; + return $this->httpReq( + 'get', + $this->_baseUrl . 'users/me/channels/existing_pm?' + . $this->buildQueryString($params) + ); + } + + /** + * get multiple channels' info by an array of channelids + */ + public function getChannels(array $channels, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'channels?ids=' . implode(',', $channels) . '&' + . $this->buildQueryString($params) + ); + } + + /** + * update channelid + */ + public function updateChannel(int $channelid, array $data=[]) + { + $json = json_encode($data); + return $this->httpReq( + 'put', + "{$this->_baseUrl}channels/{$channelid}", + $json, + 'application/json' + ); + } + + /** + * subscribe from channelid + */ + public function channelSubscribe(int $channelid) + { + return $this->httpReq( + 'put', + $this->_baseUrl.'channels/'.$channelid.'/subscribe' + ); + } + + /** + * unsubscribe from channelid + */ + public function channelUnsubscribe(int $channelid) + { + return $this->httpReq( + 'delete', + $this->_baseUrl.'channels/'.$channelid.'/subscribe' + ); + } + + /** + * mute channelid + */ + public function channelMute(int $channelid) + { + return $this->httpReq( + 'put', + $this->_baseUrl.'channels/'.$channelid.'/mute' + ); + } + + /** + * unmute channelid + */ + public function channelUnmute(int $channelid) + { + return $this->httpReq( + 'delete', + $this->_baseUrl.'channels/'.$channelid.'/mute' + ); + } + + /** + * get all user objects subscribed to channelid + */ + public function getChannelSubscriptions(int $channelid, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl.'channels/'.$channelid.'/subscribers?' + . $this->buildQueryString($params) + ); + } + + /** + * get all user IDs subscribed to channelid + */ + public function getChannelSubscriptionsById(int $channelid) + { + return $this->httpReq( + 'get', + "{$this->_baseUrl}channels/{$channelid}/subscribers?include_user=0" + ); + } + + /** + * Retrieve a list of "explore" streams + * @return array An array of associative arrays, each representing a single explore stream. + */ + public function getChannelExploreStreams() + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'channels/streams/explore' + ); + } + + /** + * Retrieve a list of channels from an "explore" stream on pnut.io. + * @param string $slug [] + * @param array $params An associative array of optional general parameters. + * @return array An array of associative arrays, each representing a single channel. + */ + public function getChannelExploreStream(string $slug, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl . 'channels/streams/explore/' . urlencode($slug) . '?' + . $this->buildQueryString($params) + ); + } + + /** + * mark channel inactive + */ + public function deleteChannel(int $channelid) + { + return $this->httpReq( + 'delete', + $this->_baseUrl.'channels/'.$channelid + ); + } + + /** + * List the channels that match a specific search term + * @param array $params a list of filter, search query, and general Channel parameters + * see: https://docs.pnut.io/resources/channels/search + * @param string $query The search query. Supports + * normal search terms. Searches common channel raw. + * @return array An array of associative arrays, each representing one channel. + * or false on error + */ + public function searchChannels(array $params=[], string $query='', string $order='default') + { + if (!empty($query)) { + $params['q'] = $query; + } + if ($order === 'default') { + if (!empty($query)) { + $params['order'] = 'id'; + } else { + $params['order'] = 'activity'; + } + } + return $this->httpReq( + 'get', + $this->_baseUrl . 'channels/search?' . $this->buildQueryString($params) + ); + } + + + /** + * get a page of messages in channelid + */ + public function getMessages(int $channelid, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl.'channels/'.$channelid.'/messages?' + . $this->buildQueryString($params) + ); + } + + /** + * get a page of messages in channelid in a thread + */ + public function getMessageThread(int $channelid, int $messageid, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl.'channels/'.$channelid.'/messages/'.$messageid.'/thread?' + . $this->buildQueryString($params) + ); + } + + /** + * get a page of sticky messages in channelid + */ + public function getStickyMessages(int $channelid, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl.'channels/'.$channelid.'/sticky_messages?' + . $this->buildQueryString($params) + ); + } + + /** + * sticky messsage + */ + public function stickyMessage(int $channelid, int $messageid) + { + return $this->httpReq( + 'put', + $this->_baseUrl.'channels/'.$channelid.'/messages/'.$messageid.'/sticky' + ); + } + + /** + * unsticky messsage + */ + public function unstickyMessage(int $channelid, int $messageid) + { + return $this->httpReq( + 'delete', + $this->_baseUrl.'channels/'.$channelid.'/messages/'.$messageid.'/sticky' + ); + } + + /** + * create message + * @param string|int $channelid numeric or "pm" for auto-channel (type=io.pnut.core.pm) + * @param array $data array('text'=>'YOUR_MESSAGE') If a type=io.pnut.core.pm, then "destinations" key can be set to address as an array of people to send this PM too + * @param array $params query parameters + */ + public function createMessage($channelid, array $data, array $params=[]) + { + if (isset($data['destinations'])) { + if (is_string($data['destinations'])) { + $data['destinations'] = explode(',', str_replace(' ', ',', $data['destinations'])); + } + foreach($data['destinations'] as $key=>$user) { + if (!is_numeric($user) && substr($user, 0,1 ) !== '@') { + $data['destinations'][$key] = "@{$user}"; + } + } + } + $json = json_encode($data); + return $this->httpReq( + 'post', + $this->_baseUrl.'channels/'.$channelid.'/messages?' + . $this->buildQueryString($params), + $json, + 'application/json' + ); + } + + /** + * get message + */ + public function getMessage(int $channelid, int $messageid, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl.'channels/'.$channelid.'/messages/'.$messageid.'?' + . $this->buildQueryString($params) + ); + } + + /** + * Returns a list of Messages. + * @param array $message_ids The list of message IDs to retrieve + * @param array $params An associative array of optional general parameters. + * @return array An array of arrays representing the messages + */ + public function getMultipleMessages(array $message_ids, array $params=[]) + { + $params['ids'] = $message_ids; + + return $this->httpReq( + 'get', + $this->_baseUrl . 'channels/messages?' . $this->buildQueryString($params) + ); + } + + /** + * delete messsage + */ + public function deleteMessage(int $channelid, int $messageid) + { + return $this->httpReq( + 'delete', + $this->_baseUrl.'channels/'.$channelid.'/messages/'.$messageid + ); + } + + /** + * List the messages that match a specific search term + * @param array $params a list of filter, search query, and general Message parameters + * see: https://docs.pnut.io/resources/messages/search + * @param string $query The search query. Supports + * normal search terms. Searches common channel raw. + * @return string|array|false An array of associative arrays, each representing one channel. + * or false on error + */ + public function searchMessages(array $params=[], string $query='', string $order='default') + { + if (!is_array($params)) { + return false; + } + if (!empty($query)) { + $params['q'] = $query; + } + if ($order === 'default') { + if (!empty($query)) { + $params['order'] = 'id'; + } else { + $params['order'] = 'relevance'; + } + } + return $this->httpReq( + 'get', + $this->_baseUrl . 'channels/messages/search?' + . $this->buildQueryString($params) + ); + } + + /** + * Upload a file to a user's file store + * @param string $file A string containing the path of the file to upload. + * @param array $data Additional data about the file you're uploading. At the + * moment accepted keys are: mime-type, kind, type, name, public and raw. + * - If you don't specify mime-type, phpnut will attempt to guess the mime type + * based on the file, however this isn't always reliable. + * - If you don't specify kind phpnut will attempt to determine if the file is + * an image or not. + * - If you don't specify name, phpnut will use the filename of the first + * parameter. + * - If you don't specify is_public, your file will be uploaded as a private file. + * - Type is REQUIRED. + * @param array $params An associative array of optional general parameters. + * This will likely change as the API evolves, as of this writing allowed keys + * are: include_raw|include_file_raw. + * @return array An associative array representing the file + */ + public function createFile($file, array $data, array $params=[]) + { + if (!$file) { + throw new phpnutException('You must specify a path to a file'); + } + if (!file_exists($file)) { + throw new phpnutException('File path specified does not exist'); + } + if (!is_readable($file)) { + throw new phpnutException('File path specified is not readable'); + } + if (!array_key_exists('type', $data) || !$data['type']) { + throw new phpnutException('Type is required when creating a file'); + } + if (!array_key_exists('name', $data)) { + $data['name'] = basename($file); + } + if (array_key_exists('mime-type', $data)) { + $mimeType = $data['mime-type']; + unset($data['mime-type']); + } else { + $mimeType = null; + } + if (!array_key_exists('kind', $data)) { + $test = @getimagesize($file); + if ($test && array_key_exists('mime', $test)) { + $data['kind'] = 'image'; + if (!$mimeType) { + $mimeType = $test['mime']; + } + } + else { + $data['kind'] = 'other'; + } + } + if (!$mimeType) { + $finfo = finfo_open(FILEINFO_MIME_TYPE); + $mimeType = finfo_file($finfo, $file); + finfo_close($finfo); + } + if (!$mimeType) { + throw new phpnutException('Unable to determine mime type of file, try specifying it explicitly'); + } + $data['content'] = new \CurlFile($file, $mimeType); + return $this->httpReq( + 'post-raw', + "{$this->_baseUrl}files", + $data, + 'multipart/form-data' + ); + } + + public function createFilePlaceholder($file, array $params=[]) + { + $name = basename($file); + $data = [ + 'raw' => $params['raw'], + 'kind' => $params['kind'], + 'name' => $name, + 'type' => $params['metadata'] + ]; + $json = json_encode($data); + return $this->httpReq( + 'post', + $this->_baseUrl.'files', + $json, + 'application/json' + ); + } + + public function updateFileContent(int $fileid, string $file) + { + $data = file_get_contents($file); + $finfo = finfo_open(FILEINFO_MIME_TYPE); + $mime = finfo_file($finfo, $file); + finfo_close($finfo); + return $this->httpReq( + 'put', + $this->_baseUrl.'files/'.$fileid.'/content', + $data, + $mime + ); + } + + /** + * Allows for file rename and annotation changes. + * @param integer $file_id The ID of the file to update + * @param array $params An associative array of file parameters. + * @return array An associative array representing the updated file + */ + public function updateFile(int $file_id, array $params=[]) + { + $data = [ + 'raw' => $params['raw'], + 'name' => $params['name'], + ]; + $json = json_encode($data); + return $this->httpReq( + 'put', + $this->_baseUrl.'files/'.urlencode($file_id), + $json, + 'application/json' + ); + } + + /** + * Returns a specific File. + * @param integer $file_id The ID of the file to retrieve + * @param array $params An associative array of optional general parameters. + * This will likely change as the API evolves, as of this writing allowed keys + * are: include_raw|include_file_raw. + * @return array An associative array representing the file + */ + public function getFile(int $file_id, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl.'files/'.urlencode($file_id).'?' + . $this->buildQueryString($params) + ); + } + + public function getFileContent(int $file_id, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl.'files/'.urlencode($file_id).'/content?' + . $this->buildQueryString($params) + ); + } + + /** $file_key : derived_file_key */ + public function getDerivedFileContent(int $file_id, string $file_key, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl.'files/'.urlencode($file_id).'/content/'.urlencode($file_key).'?'.$this->buildQueryString($params) + ); + } + + /** + * Returns file objects. + * @param array $file_ids The IDs of the files to retrieve + * @param array $params An associative array of optional general parameters. + * This will likely change as the API evolves, as of this writing allowed keys + * are: include_raw|include_file_raw. + * @return array An associative array representing the file data. + */ + public function getFiles(array $file_ids, array $params=[]) + { + $ids = ''; + foreach($file_ids as $id) { + $ids .= $id . ','; + } + $params['ids'] = substr($ids, 0, -1); + return $this->httpReq( + 'get', + $this->_baseUrl.'files?'.$this->buildQueryString($params) + ); + } + + /** + * Returns a user's file objects. + * @param array $params An associative array of optional general parameters. + * This will likely change as the API evolves, as of this writing allowed keys + * are: include_raw|include_file_raw|include_user_raw. + * @return array An associative array representing the file data. + */ + public function getUserFiles(array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl.'users/me/files?'.$this->buildQueryString($params) + ); + } + + /** + * Delete a File. The current user must be the same user who created the File. + * It returns the deleted File on success. + * @param integer $file_id The ID of the file to delete + * @return array An associative array representing the file that was deleted + */ + public function deleteFile(int $file_id) + { + return $this->httpReq( + 'delete', + $this->_baseUrl.'files/'.urlencode($file_id) + ); + } + + /** + * Create a poll + * @param array $data An associative array of the required parameters. + * @param array $params An associative array of optional general parameters. + * Allowed keys: include_raw,include_poll_raw, ... + * @return array An associative array representing the poll + */ + public function createPoll(array $data, array $params=[]) + { + $json = json_encode($data); + return $this->httpReq( + 'post', + $this->_baseUrl.'polls?'.$this->buildQueryString($params), + $json, + 'application/json' + ); + } + + /** + * Responds to a poll. + * @param integer $poll_id The ID of the poll to respond to + * @param array $positions list of positions for the poll response + * @param array $params An associative array of optional general parameters. + */ + public function respondToPoll(int $poll_id, array $positions, array $params=[]) + { + $json = json_encode(['positions' => $positions]); + return $this->httpReq( + 'put', + $this->_baseUrl.'polls/'.urlencode($poll_id).'/response?'.$this->buildQueryString($params), + $json, + 'application/json' + ); + } + + /** + * Returns a specific Poll. + * @param integer $poll_id The ID of the poll to retrieve + * @param array $params An associative array of optional general parameters. + * @return array An associative array representing the poll + */ + public function getPoll(int $poll_id, array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl.'polls/'.urlencode($poll_id).'?'.$this->buildQueryString($params) + ); + } + + /** + * Returns a list of Polls. + * @param array $poll_ids The list of poll IDs to retrieve + * @param array $params An associative array of optional general parameters. + * @return array An array of arrays representing the polls + */ + public function getMultiplePolls(array $poll_ids, array $params=[]) + { + $params['ids'] = $poll_ids; + + return $this->httpReq( + 'get', + $this->_baseUrl . 'polls?' . $this->buildQueryString($params) + ); + } + + /** + * Returns a user's poll objects. + * @param array $params An associative array of optional general parameters. + * @return array An associative array representing the poll data. + */ + public function getUserPolls(array $params=[]) + { + return $this->httpReq( + 'get', + $this->_baseUrl.'users/me/polls?'.$this->buildQueryString($params) + ); + } + + /** + * Delete a Poll. The current user must be the same user who created the Poll. + * @param integer $poll_id The ID of the poll to delete + * @param array $params An associative array of optional general parameters. + * @return array An associative array representing the poll that was deleted + */ + public function deletePoll(int $poll_id, array $params=[]) + { + return $this->httpReq( + 'delete', + $this->_baseUrl.'polls/'.urlencode($poll_id).'?'.$this->buildQueryString($params) + ); + } + + /** + * List the polls that match a specific search term + * @param array $params a list of filter, search query, and general Poll parameters + * see: https://docs.pnut.io/resources/channels/search + * @return array An array of associative arrays, each representing one poll. + * or false on error + */ + public function searchPolls(array $params=[], string $order='id') + { + $params['order'] = $order; + + return $this->httpReq( + 'get', + $this->_baseUrl . 'polls/search?' . $this->buildQueryString($params) + ); + } + + + /** + * Get Application Information + */ + public function getAppTokenInfo() + { + // requires appAccessToken + if (!$this->_appAccessToken) { + $this->getAppAccessToken(); + } + // ensure request is made with our appAccessToken + $params['access_token'] = $this->_appAccessToken; + return $this->httpReq( + 'get', + "{$this->_baseUrl}token", + $params + ); + } + + /** + * Get User Information + */ + public function getUserTokenInfo() + { + return $this->httpReq( + 'get', + "{$this->_baseUrl}token" + ); + } + + /** + * Get Application Authorized User IDs + */ + public function getAppUserIDs() + { + // requires appAccessToken + if (!$this->_appAccessToken) { + $this->getAppAccessToken(); + } + // ensure request is made with our appAccessToken + $params['access_token'] = $this->_appAccessToken; + return $this->httpReq( + 'get', + "{$this->_baseUrl}apps/me/users/ids", + $params + ); + } + + /** + * Get Application Authorized User Tokens + */ + public function getAppUserTokens() + { + // requires appAccessToken + if (!$this->_appAccessToken) { + $this->getAppAccessToken(); + } + // ensure request is made with our appAccessToken + $params['access_token'] = $this->_appAccessToken; + return $this->httpReq( + 'get', + "{$this->_baseUrl}apps/me/users/tokens", + $params + ); + } + + /** + * Registers your function (or an array of object and method) to be called + * whenever an event is received via an open pnut.io stream. Your function + * will receive a single parameter, which is the object wrapper containing + * the meta and data. + * @param mixed $function A PHP callback (either a string containing the function name, + * or an array where the first element is the class/object and the second + * is the method). + */ + public function registerStreamFunction($function): void + { + $this->_streamCallback = $function; + } + + /** + * Opens a stream that's been created for this user/app and starts sending + * events/objects to your defined callback functions. You must define at + * least one callback function before opening a stream. + * @param mixed $stream Either a stream ID or the endpoint of a stream + * you've already created. This stream must exist and must be valid for + * your current access token. If you pass a stream ID, the library will + * make an API call to get the endpoint. + * + * This function will return immediately, but your callback functions + * will continue to receive events until you call closeStream() or until + * pnut.io terminates the stream from their end with an error. + * + * If you're disconnected due to a network error, the library will + * automatically attempt to reconnect you to the same stream, no action + * on your part is necessary for this. However if the pnut.io API returns + * an error, a reconnection attempt will not be made. + * + * Note there is no closeStream, because once you open a stream you + * can't stop it (unless you exit() or die() or throw an uncaught + * exception, or something else that terminates the script). + * @return boolean True + * @see createStream() + */ + public function openStream($stream): bool + { + // if there's already a stream running, don't allow another + if ($this->_currentStream) { + throw new phpnutException('There is already a stream being consumed, only one stream can be consumed per phpnutStream instance'); + } + // must register a callback (or the exercise is pointless) + if (!$this->_streamCallback) { + throw new phpnutException('You must define your callback function using registerStreamFunction() before calling openStream'); + } + // if the stream is a numeric value, get the stream info from the api + if (is_numeric($stream)) { + $stream = $this->getStream($stream); + $this->_streamUrl = $stream['endpoint']; + } + else { + $this->_streamUrl = $stream; + } + // continue doing this until we get an error back or something...? + $this->httpStream( + 'get', + $this->_streamUrl + ); + return true; + } + + /** + * Close the currently open stream. + */ + public function closeStream(): void + { + if (!$this->_lastStreamActivity) { + // never opened + return; + } + if (!$this->_multiStream) { + throw new phpnutException('You must open a stream before calling closeStream()'); + } + curl_close($this->_currentStream); + curl_multi_remove_handle($this->_multiStream, $this->_currentStream); + curl_multi_close($this->_multiStream); + $this->_currentStream = null; + $this->_multiStream = null; + } + + /** + * Retrieve all streams for the current access token. + * @return array An array of stream definitions. + */ + public function getAllStreams() + { + return $this->httpReq( + 'get', + "{$this->_baseUrl}streams" + ); + } + + /** + * Returns a single stream specified by a stream ID. The stream must have been + * created with the current access token. + * @return array A stream definition + */ + public function getStream(string $streamId) + { + return $this->httpReq( + 'get', + $this->_baseUrl.'streams/'.urlencode($streamId) + ); + } + + /** + * Creates a stream for the current app access token. + * + * @param array $objectTypes The objects you want to retrieve data for from the + * stream. At time of writing these can be 'post', 'bookmark', 'user_follow', 'mute', 'block', 'stream_marker', 'message', 'channel', 'channel_subscription', 'token', and/or 'user'. + * If you don't specify, a few standard events will be retrieved. + */ + public function createStream(?array $objectTypes=null) + { + // default object types to everything + if (is_null($objectTypes)) { + $objectTypes = [ + 'post', + 'bookmark', + 'user_follow', + ]; + } + $data = [ + 'object_types'=>$objectTypes, + 'type'=>'long_poll', + ]; + $data = json_encode($data); + $response = $this->httpReq( + 'post', + "{$this->_baseUrl}streams", + $data, + 'application/json' + ); + return $response; + } + + /** + * Update stream for the current app access token + * + * @param string $streamId The stream ID to update. This stream must have been + * created by the current access token. + * @param array $data allows object_types, type, filter_id and key to be updated. filter_id/key can be omitted + */ + public function updateStream(string $streamId, array $data) + { + // objectTypes is likely required + if (is_null($data['object_types'])) { + $data['object_types'] = [ + 'post', + 'bookmark', + 'user_follow', + ]; + } + // type can still only be long_poll + if (is_null($data['type'])) { + $data['type'] = 'long_poll'; + } + $data = json_encode($data); + $response = $this->httpReq( + 'put', + $this->_baseUrl.'streams/'.urlencode($streamId), + $data, + 'application/json' + ); + return $response; + } + + /** + * Deletes a stream if you no longer need it. + * + * @param string $streamId The stream ID to delete. This stream must have been + * created by the current access token. + */ + public function deleteStream(string $streamId) + { + return $this->httpReq( + 'delete', + $this->_baseUrl.'streams/'.urlencode($streamId) + ); + } + + /** + * Deletes all streams created by the current access token. + */ + public function deleteAllStreams() + { + return $this->httpReq( + 'delete', + "{$this->_baseUrl}streams" + ); + } + + /** + * Internal function used to process incoming chunks from the stream. This is only + * public because it needs to be accessed by CURL. Do not call or use this function + * in your own code. + * @ignore + */ + public function httpStreamReceive($ch, $data) + { + $this->_lastStreamActivity = time(); + $this->_streamBuffer .= $data; + if (!$this->_streamHeaders) { + $pos = strpos($this->_streamBuffer, "\r\n\r\n"); + if ($pos !== false) { + $this->_streamHeaders = substr($this->_streamBuffer, 0, $pos); + $this->_streamBuffer = substr($this->_streamBuffer, $pos+4); + } + } else { + $pos = strpos($this->_streamBuffer, "\r\n"); + while ($pos !== false) { + $command = substr($this->_streamBuffer, 0, $pos); + $this->_streamBuffer = substr($this->_streamBuffer, $pos+2); + $command = json_decode($command, true); + if ($command) { + call_user_func($this->_streamCallback, $command); + } + $pos = strpos($this->_streamBuffer, "\r\n"); + } + } + return strlen($data); + } + + /** + * Opens a long lived HTTP connection to the pnut.io servers, and sends data + * received to the httpStreamReceive function. As a general rule you should not + * directly call this method, it's used by openStream(). + */ + protected function httpStream(string $act, $req, array $params=[], string $contentType='application/x-www-form-urlencoded'): void + { + if ($this->_currentStream) { + throw new phpnutException('There is already an open stream, you must close the existing one before opening a new one'); + } + $headers = []; + $this->_streamBuffer = ''; + if ($this->_accessToken) { + $headers[] = "Authorization: Bearer {$this->_accessToken}"; + } + $this->_currentStream = curl_init($req); + curl_setopt($this->_currentStream, CURLOPT_HTTPHEADER, $headers); + curl_setopt($this->_currentStream, CURLOPT_RETURNTRANSFER, true); + curl_setopt($this->_currentStream, CURLINFO_HEADER_OUT, true); + curl_setopt($this->_currentStream, CURLOPT_HEADER, true); + if ($this->_sslCA) { + curl_setopt($this->_currentStream, CURLOPT_CAINFO, $this->_sslCA); + } + // every time we receive a chunk of data, forward it to httpStreamReceive + curl_setopt($this->_currentStream, CURLOPT_WRITEFUNCTION, array($this, 'httpStreamReceive')); + // curl_exec($ch); + // return; + $this->_multiStream = curl_multi_init(); + $this->_lastStreamActivity = time(); + curl_multi_add_handle($this->_multiStream, $this->_currentStream); + } + + public function reconnectStream(): void + { + $this->closeStream(); + $this->_connectFailCounter++; + // if we've failed a few times, back off + if ($this->_connectFailCounter > 1) { + $sleepTime = pow(2, $this->_connectFailCounter); + // don't sleep more than 60 seconds + if ($sleepTime > 60) { + $sleepTime = 60; + } + sleep($sleepTime); + } + $this->httpStream('get', $this->_streamUrl); + } + + /** + * Process an open stream for x microseconds, then return. This is useful if you want + * to be doing other things while processing the stream. If you just want to + * consume the stream without other actions, you can call processForever() instead. + * @param null|float $microseconds The number of microseconds to process for before + * returning. There are 1,000,000 microseconds in a second. + * + * @return void + */ + public function processStream($microseconds=null): void + { + if (!$this->_multiStream) { + throw new phpnutException('You must open a stream before calling processStream()'); + } + $start = microtime(true); + $active = null; + $inQueue = null; + $sleepFor = 0; + do { + // if we haven't received anything within 5.5 minutes, reconnect + // keepalives are sent every 5 minutes (measured on 2013-3-12 by @ryantharp) + if (time()-$this->_lastStreamActivity >= 330) { + $this->reconnectStream(); + } + curl_multi_exec($this->_multiStream, $active); + if (!$active) { + $httpCode = curl_getinfo($this->_currentStream, CURLINFO_HTTP_CODE); + // don't reconnect on 400 errors + if ($httpCode >= 400 && $httpCode <= 499) { + throw new phpnutException("Received HTTP error {$httpCode} check your URL and credentials before reconnecting"); + } + $this->reconnectStream(); + } + // sleep for a max of 2/10 of a second + $timeSoFar = (microtime(true)-$start)*1000000; + $sleepFor = $this->streamingSleepFor; + if ($timeSoFar+$sleepFor > $microseconds) { + $sleepFor = $microseconds - $timeSoFar; + } + if ($sleepFor > 0) { + usleep($sleepFor); + } + } while ($timeSoFar+$sleepFor < $microseconds); + } + + /** + * Process an open stream forever. This function will never return, if you + * want to perform other actions while consuming the stream, you should use + * processFor() instead. + * @return void This function will never return + * @see processFor(); + */ + public function processStreamForever(): void + { + while (true) { + $this->processStream(600); + } + } +} diff --git a/pnut/lib/phpnutException.php b/pnut/lib/phpnutException.php new file mode 100644 index 00000000..77e768fe --- /dev/null +++ b/pnut/lib/phpnutException.php @@ -0,0 +1,5 @@ + + * Status: In Development + */ + +require_once 'addon/pnut/lib/phpnut.php'; +require_once 'addon/pnut/lib/phpnutException.php'; + +use Friendica\Content\Text\BBCode; +use Friendica\Content\Text\Plaintext; +use Friendica\Core\Config\Util\ConfigFileManager; +use Friendica\Core\Hook; +use Friendica\Core\Renderer; +use Friendica\Core\System; +use Friendica\DI; +use Friendica\Model\Item; +use Friendica\Model\Photo; +use phpnut\phpnutException; + +const PNUT_LIMIT = 256; + +function pnut_install() +{ + Hook::register('load_config', __FILE__, 'pnut_load_config'); + Hook::register('hook_fork', __FILE__, 'pnut_hook_fork'); + Hook::register('post_local', __FILE__, 'pnut_post_local'); + Hook::register('notifier_normal', __FILE__, 'pnut_post_hook'); + Hook::register('jot_networks', __FILE__, 'pnut_jot_nets'); + Hook::register('connector_settings', __FILE__, 'pnut_settings'); + Hook::register('connector_settings_post', __FILE__, 'pnut_settings_post'); +} + +function pnut_module() {} + +function pnut_content() +{ + if (!DI::userSession()->getLocalUserId()) { + DI::sysmsg()->addNotice(DI::l10n()->t('Permission denied.')); + return ''; + } + + if (isset(DI::args()->getArgv()[1])) { + switch (DI::args()->getArgv()[1]) { + case 'connect': + $o = pnut_connect(); + break; + + default: + $o = print_r(DI::args()->getArgv(), true); + break; + } + } else { + $o = pnut_connect(); + } + return $o; +} + +function pnut_connect() +{ + $client_id = DI::config()->get('pnut', 'client_id'); + $client_secret = DI::config()->get('pnut', 'client_secret'); + + if (empty($client_id) || empty($client_secret)) { + $client_id = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pnut', 'client_id'); + $client_secret = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pnut', 'client_secret'); + } + + $callback_url = DI::baseUrl() . '/pnut/connect'; + + $nut = new phpnut\phpnut($client_id, $client_secret); + + try { + $token = $nut->getAccessToken($callback_url); + DI::logger()->debug('Got Token', [$token]); + $o = DI::l10n()->t('You are now authenticated with pnut.io.'); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pnut', 'access_token', $token); + } catch (phpnutException $e) { + $o = DI::l10n()->t('Error fetching token. Please try again.', ['code' => $e->getCode(), 'message' => $e->getMessage()]); + } + + $o .= '
' . DI::l10n()->t("return to the connector page") . ''; + + return $o; +} + +function pnut_load_config(ConfigFileManager $loader) +{ + DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('pnut'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); +} + +function pnut_addon_admin(string &$o) +{ + $client_id = DI::config()->get('pnut', 'client_id'); + $client_secret = DI::config()->get('pnut', 'client_secret'); + + $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/pnut/'); + + $o = Renderer::replaceMacros($t, [ + '$submit' => DI::l10n()->t('Save Settings'), + '$client_id' => ['pnut_client_id', DI::l10n()->t('Client ID'), $client_id], + '$client_secret' => ['pnut_client_secret', DI::l10n()->t('Client Secret'), $client_secret], + ]); +} + +function pnut_addon_admin_post() +{ + DI::config()->set('pnut', 'client_id', $_POST['pnut_client_id']); + DI::config()->set('pnut', 'client_secret', $_POST['pnut_client_secret']); +} + +function pnut_settings(array &$data) +{ + if (!DI::userSession()->getLocalUserId()) { + return; + } + + $redirectUri = DI::baseUrl() . '/pnut/connect'; + $scope = ['write_post', 'files']; + + $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pnut', 'post') ?? false; + $def_enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pnut', 'post_by_default') ?? false; + $client_id = DI::config()->get('pnut', 'client_id'); + $client_secret = DI::config()->get('pnut', 'client_secret'); + $token = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pnut', 'access_token'); + + $user_client = empty($client_id) || empty($client_secret); + if ($user_client) { + $client_id = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pnut', 'client_id'); + $client_secret = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pnut', 'client_secret'); + } + + if (!empty($client_id) && !empty($client_secret) && empty($token)) { + $nut = new phpnut\phpnut($client_id, $client_secret); + $authorize_url = $nut->getAuthUrl($redirectUri, $scope); + $authorize_text = DI::l10n()->t('Authenticate with pnut.io'); + } + + if (!empty($token)) { + $disconn_btn = DI::l10n()->t('Disconnect'); + } + + $t = Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/pnut/'); + $html = Renderer::replaceMacros($t, [ + '$enable' => ['pnut', DI::l10n()->t('Enable Pnut Post Addon'), $enabled], + '$bydefault' => ['pnut_bydefault', DI::l10n()->t('Post to Pnut by default'), $def_enabled], + '$client_id' => ['pnut_client_id', DI::l10n()->t('Client ID'), $client_id], + '$client_secret' => ['pnut_client_secret', DI::l10n()->t('Client Secret'), $client_secret], + '$access_token' => ['pnut_access_token', DI::l10n()->t('Access Token'), $token, '', '', 'readonly'], + '$authorize_url' => $authorize_url ?? '', + '$authorize_text' => $authorize_text ?? '', + '$disconn_btn' => $disconn_btn ?? '', + 'user_client' => $user_client, + ]); + + $data = [ + 'connector' => 'pnut', + 'title' => DI::l10n()->t('Pnut Export'), + 'image' => 'addon/pnut/pnut.svg', + 'enabled' => $enabled, + 'html' => $html, + ]; +} + +function pnut_settings_post(array &$b) +{ + if (empty($_POST['pnut-submit']) && empty($_POST['pnut-disconnect'])) { + return; + } + + if (!empty($_POST['pnut-disconnect'])) { + DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'pnut', 'post'); + DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'pnut', 'post_by_default'); + DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'pnut', 'client_id'); + DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'pnut', 'client_secret'); + DI::pConfig()->delete(DI::userSession()->getLocalUserId(), 'pnut', 'access_token'); + } else { + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pnut', 'post', intval($_POST['pnut'])); + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pnut', 'post_by_default', intval($_POST['pnut_bydefault'])); + if (!empty($_POST['pnut_client_id'])) { + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pnut', 'client_id', $_POST['pnut_client_id']); + } + if (!empty($_POST['pnut_client_secret'])) { + DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pnut', 'client_secret', $_POST['pnut_client_secret']); + } + } +} + +function pnut_jot_nets(array &$jotnets_fields) +{ + if (!DI::userSession()->getLocalUserId()) { + return; + } + + if (DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pnut', 'post')) { + $jotnets_fields[] = [ + 'type' => 'checkbox', + 'field' => [ + 'pnut_enable', + DI::l10n()->t('Post to Pnut'), + DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pnut', 'post_by_default') + ] + ]; + } +} + +function pnut_hook_fork(array &$b) +{ + if ($b['name'] != 'notifier_normal') { + return; + } + + $post = $b['data']; + + if (($post['created'] !== $post['edited']) && !$post['deleted']) { + DI::logger()->info('Editing is not supported by the addon'); + $b['execute'] = false; + return; + } + + if (!strstr($post['postopts'] ?? '', 'pnut') || ($post['gravity'] != Item::GRAVITY_PARENT) || ($post['private'] == Item::PRIVATE)) { + $b['execute'] = false; + return; + } +} + +function pnut_post_local(array &$b) +{ + if (!DI::userSession()->getLocalUserId() || (DI::userSession()->getLocalUserId() != $b['uid'])) { + return; + } + + if ($b['edit'] || ($b['private'] == Item::PRIVATE) || ($b['gravity'] != Item::GRAVITY_PARENT)) { + return; + } + + $pnut_post = intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pnut', 'post')); + $pnut_enable = (($pnut_post && !empty($_REQUEST['pnut_enable'])) ? intval($_REQUEST['pnut_enable']) : 0); + + // if API is used, default to the chosen settings + if ($b['api_source'] && intval(DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pnut', 'post_by_default'))) { + $pnut_enable = 1; + } + + if (!$pnut_enable) { + return; + } + + if (strlen($b['postopts'])) { + $b['postopts'] .= ','; + } + + $b['postopts'] .= 'pnut'; +} + +function pnut_post_hook(array &$b) +{ + /** + * Post to pnut.io + */ + if ($b['deleted'] || ($b['private'] == Item::PRIVATE) || ($b['created'] !== $b['edited'])) { + return; + } + + if (Item::isGroupPost($b['uri-id'])) { + return; + } + + DI::logger()->notice('PNUT post invoked', ['id' => $b['id'], 'guid' => $b['guid'], 'plink' => $b['plink']]); + DI::logger()->debug('PNUT array', $b); + + $token = DI::pConfig()->get($b['uid'], 'pnut', 'access_token'); + $nut = new phpnut\phpnut($token); + + $msgarr = Plaintext::getPost($b, PNUT_LIMIT, true, BBCode::EXTERNAL); + $text = $msgarr['text']; + $raw = []; + + DI::logger()->debug('PNUT msgarr', $msgarr); + + if (count($msgarr['parts']) > 1) { + $tstamp = time(); + $raw['nl.chimpnut.blog.post'][] = ['body' => $b['body'], 'tstamp' => $tstamp]; + $text = Plaintext::shorten($text, 252 - strlen($b['plink']), $b['uid']); + $text .= "\n" . $b['plink']; + } + + if ($msgarr['type'] == 'link') { + $text .= "\n[" . $msgarr['title'] . "](" . $msgarr['url'] . ")"; + } + + if ($msgarr['type'] == 'photo') { + $fileraw = ['type' => 'dev.mcmillian.friendica.image', 'kind' => 'image', 'is_public' => true]; + foreach ($msgarr['images'] as $image) { + DI::logger()->debug('PNUT image', $image); + + if (!empty($image['id'])) { + $photo = Photo::selectFirst([], ['id' => $image['id']]); + DI::logger()->debug('PNUT selectFirst'); + } else { + $photo = Photo::createPhotoForExternalResource($image['url']); + DI::logger()->debug('PNUT createPhotoForExternalResource'); + } + $picturedata = Photo::getImageForPhoto($photo); + + DI::logger()->debug('PNUT photo', $photo); + $picurefile = tempnam(System::getTempPath(), 'pnut'); + file_put_contents($picurefile, $picturedata); + DI::logger()->debug('PNUT got file?', ['filename' => $picurefile]); + $imagefile = $nut->createFile($picurefile, $fileraw); + DI::logger()->debug('PNUT file', ['pnutimagefile' => $imagefile]); + unlink($picurefile); + + $raw['io.pnut.core.oembed'][] = ['+io.pnut.core.file' => ['file_id' => $imagefile['id'], 'file_token' => $imagefile['file_token'], 'format' => 'oembed']]; + } + } + + $raw['io.pnut.core.crosspost'][] = ['canonical_url' => $b['plink']]; + $nut->createPost($text, ['raw' => $raw]); + + DI::logger()->debug('PNUT post complete', ['id' => $b['id'], 'text' => $text, 'raw' => $raw]); +} diff --git a/pnut/pnut.svg b/pnut/pnut.svg new file mode 100644 index 00000000..6cc64b01 --- /dev/null +++ b/pnut/pnut.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/pnut/templates/admin.tpl b/pnut/templates/admin.tpl new file mode 100644 index 00000000..b4cc3651 --- /dev/null +++ b/pnut/templates/admin.tpl @@ -0,0 +1,3 @@ +{{include file="field_input.tpl" field=$client_id}} +{{include file="field_input.tpl" field=$client_secret}} +
diff --git a/pnut/templates/connector_settings.tpl b/pnut/templates/connector_settings.tpl new file mode 100644 index 00000000..6662a5ae --- /dev/null +++ b/pnut/templates/connector_settings.tpl @@ -0,0 +1,14 @@ +

{{$status}}

+{{include file="field_checkbox.tpl" field=$enable}} +{{include file="field_checkbox.tpl" field=$bydefault}} +{{if $user_client}} + {{include file="field_input.tpl" field=$client_id}} + {{include file="field_input.tpl" field=$client_secret}} + {{include file="field_input.tpl" field=$access_token}} +{{/if}} +{{if $authorize_url}} + {{$authorize_text}} +{{/if}} +{{if $disconn_btn}} +
+{{/if}} diff --git a/public_server/lang/bg/messages.po b/public_server/lang/bg/messages.po new file mode 100644 index 00000000..c0091e35 --- /dev/null +++ b/public_server/lang/bg/messages.po @@ -0,0 +1,48 @@ +# ADDON public_server +# Copyright (C) +# This file is distributed under the same license as the Friendica public_server addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2014-06-23 11:24+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: public_server.php:64 +msgid "Administrator" +msgstr "" + +#: public_server.php:118 +#, php-format +msgid "Your account on %s will expire in a few days." +msgstr "" + +#: public_server.php:119 +msgid "Your Friendica account is about to expire." +msgstr "" + +#: public_server.php:120 +#, php-format +msgid "" +"Hi %1$s,\n" +"\n" +"Your account on %2$s will expire in less than five days. You may keep your account by logging in at least once every 30 days" +msgstr "" + +#: public_server.php:158 +msgid "Save Settings" +msgstr "" + +#: public_server.php:160 +msgid "Set any of these options to 0 to deactivate it." +msgstr "" diff --git a/public_server/lang/bg/strings.php b/public_server/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/public_server/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: public_server.php:64 +msgid "Administrator" +msgstr "" + +#: public_server.php:118 +#, php-format +msgid "Your account on %s will expire in a few days." +msgstr "" + +#: public_server.php:119 +msgid "Your Friendica account is about to expire." +msgstr "" + +#: public_server.php:120 +#, php-format +msgid "" +"Hi %1$s,\n" +"\n" +"Your account on %2$s will expire in less than five days. You may keep your account by logging in at least once every 30 days" +msgstr "" + +#: public_server.php:158 +msgid "Save Settings" +msgstr "" + +#: public_server.php:160 +msgid "Set any of these options to 0 to deactivate it." +msgstr "" diff --git a/public_server/lang/ca/strings.php b/public_server/lang/ca/strings.php index ead9e954..d34874f6 100644 --- a/public_server/lang/ca/strings.php +++ b/public_server/lang/ca/strings.php @@ -1,5 +1,7 @@ -strings["Administrator"] = "Administrador"; -$a->strings["Your account on %s will expire in a few days."] = "El teu compte en %s expirarà en pocs dies."; -$a->strings["Your Friendica account is about to expire."] = "El teu compte de Friendica està a punt de caducar."; +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: public_server.php:64 +msgid "Administrator" +msgstr "" + +#: public_server.php:118 +#, php-format +msgid "Your account on %s will expire in a few days." +msgstr "" + +#: public_server.php:119 +msgid "Your Friendica account is about to expire." +msgstr "" + +#: public_server.php:120 +#, php-format +msgid "" +"Hi %1$s,\n" +"\n" +"Your account on %2$s will expire in less than five days. You may keep your account by logging in at least once every 30 days" +msgstr "" + +#: public_server.php:158 +msgid "Save Settings" +msgstr "" + +#: public_server.php:160 +msgid "Set any of these options to 0 to deactivate it." +msgstr "" diff --git a/public_server/lang/eo/strings.php b/public_server/lang/eo/strings.php index 91fc41f6..68e8a64c 100644 --- a/public_server/lang/eo/strings.php +++ b/public_server/lang/eo/strings.php @@ -1,5 +1,7 @@ -strings["Administrator"] = "Administranto"; -$a->strings["Your account on %s will expire in a few days."] = "Via konto ĉe %s senvalidiĝos post kelkaj tagoj."; -$a->strings["Your Friendica account is about to expire."] = "Via konto ĉe Friendica baldaŭ senvalidiĝos."; +\n" +"Language-Team: Estonian (http://app.transifex.com/Friendica/friendica/language/et/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: et\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: public_server.php:64 +msgid "Administrator" +msgstr "" + +#: public_server.php:118 +#, php-format +msgid "Your account on %s will expire in a few days." +msgstr "" + +#: public_server.php:119 +msgid "Your Friendica account is about to expire." +msgstr "" + +#: public_server.php:120 +#, php-format +msgid "" +"Hi %1$s,\n" +"\n" +"Your account on %2$s will expire in less than five days. You may keep your account by logging in at least once every 30 days" +msgstr "" + +#: public_server.php:158 +msgid "Save Settings" +msgstr "" + +#: public_server.php:160 +msgid "Set any of these options to 0 to deactivate it." +msgstr "" diff --git a/public_server/lang/et/strings.php b/public_server/lang/et/strings.php new file mode 100644 index 00000000..dfe78358 --- /dev/null +++ b/public_server/lang/et/strings.php @@ -0,0 +1,7 @@ +, 2022 # StefOfficiel , 2015 msgid "" @@ -12,8 +13,8 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-02-01 18:15+0100\n" "PO-Revision-Date: 2014-06-23 11:24+0000\n" -"Last-Translator: Hypolite Petovan , 2022\n" -"Language-Team: French (http://www.transifex.com/Friendica/friendica/language/fr/)\n" +"Last-Translator: cracrayol, 2025\n" +"Language-Team: French (http://app.transifex.com/Friendica/friendica/language/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -43,7 +44,7 @@ msgstr "%1$s,\n\nVotre compte sur %2$s va expirer dans moins de 5 jours. Vous po #: public_server.php:158 msgid "Save Settings" -msgstr "Enregistrer les paramètres" +msgstr "Sauvegarder les paramètres" #: public_server.php:160 msgid "Set any of these options to 0 to deactivate it." diff --git a/public_server/lang/fr/strings.php b/public_server/lang/fr/strings.php index add86c16..0ac61152 100644 --- a/public_server/lang/fr/strings.php +++ b/public_server/lang/fr/strings.php @@ -13,5 +13,5 @@ $a->strings['Hi %1$s, Your account on %2$s will expire in less than five days. You may keep your account by logging in at least once every 30 days'] = '%1$s, Votre compte sur %2$s va expirer dans moins de 5 jours. Vous pouvez conserver votre compte en vous identifiant au moins une fois tous les 30 jours'; -$a->strings['Save Settings'] = 'Enregistrer les paramètres'; +$a->strings['Save Settings'] = 'Sauvegarder les paramètres'; $a->strings['Set any of these options to 0 to deactivate it.'] = 'Entrez 0 comme valeur pour n\'importe quelle de ces options pour la désactiver.'; diff --git a/public_server/lang/gd/messages.po b/public_server/lang/gd/messages.po new file mode 100644 index 00000000..c716b211 --- /dev/null +++ b/public_server/lang/gd/messages.po @@ -0,0 +1,48 @@ +# ADDON public_server +# Copyright (C) +# This file is distributed under the same license as the Friendica public_server addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2014-06-23 11:24+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: public_server.php:64 +msgid "Administrator" +msgstr "" + +#: public_server.php:118 +#, php-format +msgid "Your account on %s will expire in a few days." +msgstr "" + +#: public_server.php:119 +msgid "Your Friendica account is about to expire." +msgstr "" + +#: public_server.php:120 +#, php-format +msgid "" +"Hi %1$s,\n" +"\n" +"Your account on %2$s will expire in less than five days. You may keep your account by logging in at least once every 30 days" +msgstr "" + +#: public_server.php:158 +msgid "Save Settings" +msgstr "" + +#: public_server.php:160 +msgid "Set any of these options to 0 to deactivate it." +msgstr "" diff --git a/public_server/lang/gd/strings.php b/public_server/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/public_server/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/public_server/lang/is/messages.po b/public_server/lang/is/messages.po new file mode 100644 index 00000000..b41a4e10 --- /dev/null +++ b/public_server/lang/is/messages.po @@ -0,0 +1,48 @@ +# ADDON public_server +# Copyright (C) +# This file is distributed under the same license as the Friendica public_server addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-02-01 18:15+0100\n" +"PO-Revision-Date: 2014-06-23 11:24+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: public_server.php:64 +msgid "Administrator" +msgstr "" + +#: public_server.php:118 +#, php-format +msgid "Your account on %s will expire in a few days." +msgstr "" + +#: public_server.php:119 +msgid "Your Friendica account is about to expire." +msgstr "" + +#: public_server.php:120 +#, php-format +msgid "" +"Hi %1$s,\n" +"\n" +"Your account on %2$s will expire in less than five days. You may keep your account by logging in at least once every 30 days" +msgstr "" + +#: public_server.php:158 +msgid "Save Settings" +msgstr "" + +#: public_server.php:160 +msgid "Set any of these options to 0 to deactivate it." +msgstr "" diff --git a/public_server/lang/is/strings.php b/public_server/lang/is/strings.php index fc5424b3..975c341e 100644 --- a/public_server/lang/is/strings.php +++ b/public_server/lang/is/strings.php @@ -1,5 +1,7 @@ -strings["Administrator"] = "Kerfisstjóri"; -$a->strings["Your account on %s will expire in a few days."] = ""; -$a->strings["Your Friendica account is about to expire."] = ""; +\n" +"Language-Team: Russian (http://app.transifex.com/Friendica/friendica/language/ru/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ru\n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" + +#: public_server.php:64 +msgid "Administrator" +msgstr "" + +#: public_server.php:118 +#, php-format +msgid "Your account on %s will expire in a few days." +msgstr "" + +#: public_server.php:119 +msgid "Your Friendica account is about to expire." +msgstr "" + +#: public_server.php:120 +#, php-format +msgid "" +"Hi %1$s,\n" +"\n" +"Your account on %2$s will expire in less than five days. You may keep your account by logging in at least once every 30 days" +msgstr "" + +#: public_server.php:158 +msgid "Save Settings" +msgstr "" + +#: public_server.php:160 +msgid "Set any of these options to 0 to deactivate it." +msgstr "" diff --git a/public_server/lang/ru/strings.php b/public_server/lang/ru/strings.php index 405a408f..0579fc21 100644 --- a/public_server/lang/ru/strings.php +++ b/public_server/lang/ru/strings.php @@ -1,5 +1,7 @@ -strings["Administrator"] = "Администратор"; -$a->strings["Your account on %s will expire in a few days."] = ""; -$a->strings["Your Friendica account is about to expire."] = ""; +=2 && $n%10<=4 && ($n%100<12 || $n%100>14)) { return 1; } else if ($n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)) { return 2; } else { return 3; } +}} diff --git a/public_server/public_server.php b/public_server/public_server.php index 7591c7d0..9cd0f667 100644 --- a/public_server/public_server.php +++ b/public_server/public_server.php @@ -6,10 +6,8 @@ * Author: Keith Fernie */ -use Friendica\App; use Friendica\BaseModule; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\Database\DBA; use Friendica\DI; @@ -29,7 +27,7 @@ function public_server_install() function public_server_load_config(ConfigFileManager $loader) { - DI::app()->getConfigCache()->load($loader->loadAddonConfig('public_server'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); + DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('public_server'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); } function public_server_register_account($b) @@ -48,7 +46,7 @@ function public_server_register_account($b) function public_server_cron($b) { - Logger::notice("public_server: cron start"); + DI::logger()->notice("public_server: cron start"); $users = DBA::selectToArray('user', [], ["`account_expires_on` > ? AND `account_expires_on` < ? AND `expire_notification_sent` <= ?", DBA::NULL_DATETIME, DateTimeFormat::utc('now + 5 days'), DBA::NULL_DATETIME]); @@ -97,7 +95,7 @@ function public_server_cron($b) } } - Logger::notice("public_server: cron end"); + DI::logger()->notice("public_server: cron end"); } function public_server_enotify(array &$b) diff --git a/pumpio/lang/C/messages.po b/pumpio/lang/C/messages.po index baac56e6..7e14cd79 100644 --- a/pumpio/lang/C/messages.po +++ b/pumpio/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-21 19:17-0500\n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,76 +17,76 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: pumpio.php:57 +#: pumpio.php:62 msgid "Permission denied." msgstr "" -#: pumpio.php:152 +#: pumpio.php:156 #, php-format msgid "Unable to register the client at the pump.io server '%s'." msgstr "" -#: pumpio.php:192 +#: pumpio.php:196 msgid "You are now authenticated to pumpio." msgstr "" -#: pumpio.php:193 +#: pumpio.php:197 msgid "return to the connector page" msgstr "" -#: pumpio.php:213 +#: pumpio.php:217 msgid "Post to pumpio" msgstr "" -#: pumpio.php:237 +#: pumpio.php:241 msgid "Save Settings" msgstr "" -#: pumpio.php:239 +#: pumpio.php:243 msgid "Delete this preset" msgstr "" -#: pumpio.php:245 +#: pumpio.php:249 msgid "Authenticate your pump.io connection" msgstr "" -#: pumpio.php:252 +#: pumpio.php:256 msgid "Pump.io servername (without \"http://\" or \"https://\" )" msgstr "" -#: pumpio.php:253 +#: pumpio.php:257 msgid "Pump.io username (without the servername)" msgstr "" -#: pumpio.php:254 +#: pumpio.php:258 msgid "Import the remote timeline" msgstr "" -#: pumpio.php:255 +#: pumpio.php:259 msgid "Enable Pump.io Post Addon" msgstr "" -#: pumpio.php:256 +#: pumpio.php:260 msgid "Post to Pump.io by default" msgstr "" -#: pumpio.php:257 +#: pumpio.php:261 msgid "Should posts be public?" msgstr "" -#: pumpio.php:258 +#: pumpio.php:262 msgid "Mirror all public posts" msgstr "" -#: pumpio.php:263 +#: pumpio.php:267 msgid "Pump.io Import/Export/Mirror" msgstr "" -#: pumpio.php:920 +#: pumpio.php:924 msgid "status" msgstr "" -#: pumpio.php:924 +#: pumpio.php:928 #, php-format msgid "%1$s likes %2$s's %3$s" msgstr "" diff --git a/pumpio/lang/bg/messages.po b/pumpio/lang/bg/messages.po new file mode 100644 index 00000000..d8cbfb7d --- /dev/null +++ b/pumpio/lang/bg/messages.po @@ -0,0 +1,93 @@ +# ADDON pumpio +# Copyright (C) +# This file is distributed under the same license as the Friendica pumpio addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" +"PO-Revision-Date: 2014-06-23 11:30+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: pumpio.php:62 +msgid "Permission denied." +msgstr "" + +#: pumpio.php:156 +#, php-format +msgid "Unable to register the client at the pump.io server '%s'." +msgstr "" + +#: pumpio.php:196 +msgid "You are now authenticated to pumpio." +msgstr "" + +#: pumpio.php:197 +msgid "return to the connector page" +msgstr "" + +#: pumpio.php:217 +msgid "Post to pumpio" +msgstr "" + +#: pumpio.php:241 +msgid "Save Settings" +msgstr "" + +#: pumpio.php:243 +msgid "Delete this preset" +msgstr "" + +#: pumpio.php:249 +msgid "Authenticate your pump.io connection" +msgstr "" + +#: pumpio.php:256 +msgid "Pump.io servername (without \"http://\" or \"https://\" )" +msgstr "" + +#: pumpio.php:257 +msgid "Pump.io username (without the servername)" +msgstr "" + +#: pumpio.php:258 +msgid "Import the remote timeline" +msgstr "" + +#: pumpio.php:259 +msgid "Enable Pump.io Post Addon" +msgstr "" + +#: pumpio.php:260 +msgid "Post to Pump.io by default" +msgstr "" + +#: pumpio.php:261 +msgid "Should posts be public?" +msgstr "" + +#: pumpio.php:262 +msgid "Mirror all public posts" +msgstr "" + +#: pumpio.php:267 +msgid "Pump.io Import/Export/Mirror" +msgstr "" + +#: pumpio.php:924 +msgid "status" +msgstr "" + +#: pumpio.php:928 +#, php-format +msgid "%1$s likes %2$s's %3$s" +msgstr "" diff --git a/pumpio/lang/bg/strings.php b/pumpio/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/pumpio/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: pumpio.php:62 +msgid "Permission denied." +msgstr "" + +#: pumpio.php:156 +#, php-format +msgid "Unable to register the client at the pump.io server '%s'." +msgstr "" + +#: pumpio.php:196 +msgid "You are now authenticated to pumpio." +msgstr "" + +#: pumpio.php:197 +msgid "return to the connector page" +msgstr "" + +#: pumpio.php:217 +msgid "Post to pumpio" +msgstr "" + +#: pumpio.php:241 +msgid "Save Settings" +msgstr "" + +#: pumpio.php:243 +msgid "Delete this preset" +msgstr "" + +#: pumpio.php:249 +msgid "Authenticate your pump.io connection" +msgstr "" + +#: pumpio.php:256 +msgid "Pump.io servername (without \"http://\" or \"https://\" )" +msgstr "" + +#: pumpio.php:257 +msgid "Pump.io username (without the servername)" +msgstr "" + +#: pumpio.php:258 +msgid "Import the remote timeline" +msgstr "" + +#: pumpio.php:259 +msgid "Enable Pump.io Post Addon" +msgstr "" + +#: pumpio.php:260 +msgid "Post to Pump.io by default" +msgstr "" + +#: pumpio.php:261 +msgid "Should posts be public?" +msgstr "" + +#: pumpio.php:262 +msgid "Mirror all public posts" +msgstr "" + +#: pumpio.php:267 +msgid "Pump.io Import/Export/Mirror" +msgstr "" + +#: pumpio.php:924 +msgid "status" +msgstr "" + +#: pumpio.php:928 +#, php-format +msgid "%1$s likes %2$s's %3$s" +msgstr "" diff --git a/pumpio/lang/ca/strings.php b/pumpio/lang/ca/strings.php new file mode 100644 index 00000000..d34874f6 --- /dev/null +++ b/pumpio/lang/ca/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: pumpio.php:62 +msgid "Permission denied." +msgstr "" + +#: pumpio.php:156 +#, php-format +msgid "Unable to register the client at the pump.io server '%s'." +msgstr "" + +#: pumpio.php:196 +msgid "You are now authenticated to pumpio." +msgstr "" + +#: pumpio.php:197 +msgid "return to the connector page" +msgstr "" + +#: pumpio.php:217 +msgid "Post to pumpio" +msgstr "" + +#: pumpio.php:241 +msgid "Save Settings" +msgstr "" + +#: pumpio.php:243 +msgid "Delete this preset" +msgstr "" + +#: pumpio.php:249 +msgid "Authenticate your pump.io connection" +msgstr "" + +#: pumpio.php:256 +msgid "Pump.io servername (without \"http://\" or \"https://\" )" +msgstr "" + +#: pumpio.php:257 +msgid "Pump.io username (without the servername)" +msgstr "" + +#: pumpio.php:258 +msgid "Import the remote timeline" +msgstr "" + +#: pumpio.php:259 +msgid "Enable Pump.io Post Addon" +msgstr "" + +#: pumpio.php:260 +msgid "Post to Pump.io by default" +msgstr "" + +#: pumpio.php:261 +msgid "Should posts be public?" +msgstr "" + +#: pumpio.php:262 +msgid "Mirror all public posts" +msgstr "" + +#: pumpio.php:267 +msgid "Pump.io Import/Export/Mirror" +msgstr "" + +#: pumpio.php:924 +msgid "status" +msgstr "" + +#: pumpio.php:928 +#, php-format +msgid "%1$s likes %2$s's %3$s" +msgstr "" diff --git a/pumpio/lang/eo/strings.php b/pumpio/lang/eo/strings.php new file mode 100644 index 00000000..68e8a64c --- /dev/null +++ b/pumpio/lang/eo/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Estonian (http://app.transifex.com/Friendica/friendica/language/et/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: et\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: pumpio.php:62 +msgid "Permission denied." +msgstr "" + +#: pumpio.php:156 +#, php-format +msgid "Unable to register the client at the pump.io server '%s'." +msgstr "" + +#: pumpio.php:196 +msgid "You are now authenticated to pumpio." +msgstr "" + +#: pumpio.php:197 +msgid "return to the connector page" +msgstr "" + +#: pumpio.php:217 +msgid "Post to pumpio" +msgstr "" + +#: pumpio.php:241 +msgid "Save Settings" +msgstr "" + +#: pumpio.php:243 +msgid "Delete this preset" +msgstr "" + +#: pumpio.php:249 +msgid "Authenticate your pump.io connection" +msgstr "" + +#: pumpio.php:256 +msgid "Pump.io servername (without \"http://\" or \"https://\" )" +msgstr "" + +#: pumpio.php:257 +msgid "Pump.io username (without the servername)" +msgstr "" + +#: pumpio.php:258 +msgid "Import the remote timeline" +msgstr "" + +#: pumpio.php:259 +msgid "Enable Pump.io Post Addon" +msgstr "" + +#: pumpio.php:260 +msgid "Post to Pump.io by default" +msgstr "" + +#: pumpio.php:261 +msgid "Should posts be public?" +msgstr "" + +#: pumpio.php:262 +msgid "Mirror all public posts" +msgstr "" + +#: pumpio.php:267 +msgid "Pump.io Import/Export/Mirror" +msgstr "" + +#: pumpio.php:924 +msgid "status" +msgstr "" + +#: pumpio.php:928 +#, php-format +msgid "%1$s likes %2$s's %3$s" +msgstr "" diff --git a/pumpio/lang/et/strings.php b/pumpio/lang/et/strings.php new file mode 100644 index 00000000..dfe78358 --- /dev/null +++ b/pumpio/lang/et/strings.php @@ -0,0 +1,7 @@ +, 2022 # ea1cd8241cb389ffb6f92bc6891eff5d_dc12308 <70dced5587d47e18d88f9298024d96f8_93383>, 2015 # StefOfficiel , 2015 @@ -11,86 +12,86 @@ msgid "" msgstr "" "Project-Id-Version: friendica\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-11-21 19:17-0500\n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" "PO-Revision-Date: 2014-06-23 11:30+0000\n" -"Last-Translator: Hypolite Petovan , 2022\n" -"Language-Team: French (http://www.transifex.com/Friendica/friendica/language/fr/)\n" +"Last-Translator: Florent C., 2023\n" +"Language-Team: French (http://app.transifex.com/Friendica/friendica/language/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: fr\n" "Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n" -#: pumpio.php:57 +#: pumpio.php:62 msgid "Permission denied." msgstr "Permission refusée." -#: pumpio.php:152 +#: pumpio.php:156 #, php-format msgid "Unable to register the client at the pump.io server '%s'." msgstr "Impossible d'enregistrer le client sur le serveur pump.io \"%s\"." -#: pumpio.php:192 +#: pumpio.php:196 msgid "You are now authenticated to pumpio." msgstr "Vous êtes maintenant authentifié sur pump.io." -#: pumpio.php:193 +#: pumpio.php:197 msgid "return to the connector page" msgstr "Retourner à la page du connecteur" -#: pumpio.php:213 +#: pumpio.php:217 msgid "Post to pumpio" msgstr "Publier sur pump.io" -#: pumpio.php:237 +#: pumpio.php:241 msgid "Save Settings" msgstr "Sauvegarder les paramètres" -#: pumpio.php:239 +#: pumpio.php:243 msgid "Delete this preset" msgstr "Supprimer ce préréglage" -#: pumpio.php:245 +#: pumpio.php:249 msgid "Authenticate your pump.io connection" msgstr "Identifiez votre connexion à pump.io" -#: pumpio.php:252 +#: pumpio.php:256 msgid "Pump.io servername (without \"http://\" or \"https://\" )" msgstr "Domaine du serveur Pump.io (sans \"http://\" ou \"https://\")" -#: pumpio.php:253 +#: pumpio.php:257 msgid "Pump.io username (without the servername)" msgstr "Nom d'utilisateur Pump.io (sans le domaine de serveur)" -#: pumpio.php:254 +#: pumpio.php:258 msgid "Import the remote timeline" -msgstr "Importer la timeline distante" +msgstr "Importer le flux distant" -#: pumpio.php:255 +#: pumpio.php:259 msgid "Enable Pump.io Post Addon" msgstr "Activer l'extension Pump.io" -#: pumpio.php:256 +#: pumpio.php:260 msgid "Post to Pump.io by default" msgstr "Publier sur Pump.io par défaut" -#: pumpio.php:257 +#: pumpio.php:261 msgid "Should posts be public?" msgstr "Les messages devraient être publiques ?" -#: pumpio.php:258 +#: pumpio.php:262 msgid "Mirror all public posts" msgstr "Refléter toutes les publications publiques" -#: pumpio.php:263 +#: pumpio.php:267 msgid "Pump.io Import/Export/Mirror" msgstr "Import/Export/Miroir Pump.io" -#: pumpio.php:920 +#: pumpio.php:924 msgid "status" msgstr "statut" -#: pumpio.php:924 +#: pumpio.php:928 #, php-format msgid "%1$s likes %2$s's %3$s" msgstr "%1$s aime lea %3$s de %2$s" diff --git a/pumpio/lang/fr/strings.php b/pumpio/lang/fr/strings.php index bdbbc462..14ddade1 100644 --- a/pumpio/lang/fr/strings.php +++ b/pumpio/lang/fr/strings.php @@ -15,7 +15,7 @@ $a->strings['Delete this preset'] = 'Supprimer ce préréglage'; $a->strings['Authenticate your pump.io connection'] = 'Identifiez votre connexion à pump.io'; $a->strings['Pump.io servername (without "http://" or "https://" )'] = 'Domaine du serveur Pump.io (sans "http://" ou "https://")'; $a->strings['Pump.io username (without the servername)'] = 'Nom d\'utilisateur Pump.io (sans le domaine de serveur)'; -$a->strings['Import the remote timeline'] = 'Importer la timeline distante'; +$a->strings['Import the remote timeline'] = 'Importer le flux distant'; $a->strings['Enable Pump.io Post Addon'] = 'Activer l\'extension Pump.io'; $a->strings['Post to Pump.io by default'] = 'Publier sur Pump.io par défaut'; $a->strings['Should posts be public?'] = 'Les messages devraient être publiques ?'; diff --git a/pumpio/lang/gd/messages.po b/pumpio/lang/gd/messages.po new file mode 100644 index 00000000..0cefa2cd --- /dev/null +++ b/pumpio/lang/gd/messages.po @@ -0,0 +1,93 @@ +# ADDON pumpio +# Copyright (C) +# This file is distributed under the same license as the Friendica pumpio addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" +"PO-Revision-Date: 2014-06-23 11:30+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: pumpio.php:62 +msgid "Permission denied." +msgstr "" + +#: pumpio.php:156 +#, php-format +msgid "Unable to register the client at the pump.io server '%s'." +msgstr "" + +#: pumpio.php:196 +msgid "You are now authenticated to pumpio." +msgstr "" + +#: pumpio.php:197 +msgid "return to the connector page" +msgstr "" + +#: pumpio.php:217 +msgid "Post to pumpio" +msgstr "" + +#: pumpio.php:241 +msgid "Save Settings" +msgstr "" + +#: pumpio.php:243 +msgid "Delete this preset" +msgstr "" + +#: pumpio.php:249 +msgid "Authenticate your pump.io connection" +msgstr "" + +#: pumpio.php:256 +msgid "Pump.io servername (without \"http://\" or \"https://\" )" +msgstr "" + +#: pumpio.php:257 +msgid "Pump.io username (without the servername)" +msgstr "" + +#: pumpio.php:258 +msgid "Import the remote timeline" +msgstr "" + +#: pumpio.php:259 +msgid "Enable Pump.io Post Addon" +msgstr "" + +#: pumpio.php:260 +msgid "Post to Pump.io by default" +msgstr "" + +#: pumpio.php:261 +msgid "Should posts be public?" +msgstr "" + +#: pumpio.php:262 +msgid "Mirror all public posts" +msgstr "" + +#: pumpio.php:267 +msgid "Pump.io Import/Export/Mirror" +msgstr "" + +#: pumpio.php:924 +msgid "status" +msgstr "" + +#: pumpio.php:928 +#, php-format +msgid "%1$s likes %2$s's %3$s" +msgstr "" diff --git a/pumpio/lang/gd/strings.php b/pumpio/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/pumpio/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/pumpio/lang/is/messages.po b/pumpio/lang/is/messages.po new file mode 100644 index 00000000..a1c9b37d --- /dev/null +++ b/pumpio/lang/is/messages.po @@ -0,0 +1,93 @@ +# ADDON pumpio +# Copyright (C) +# This file is distributed under the same license as the Friendica pumpio addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2023-06-03 15:50-0400\n" +"PO-Revision-Date: 2014-06-23 11:30+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: pumpio.php:62 +msgid "Permission denied." +msgstr "" + +#: pumpio.php:156 +#, php-format +msgid "Unable to register the client at the pump.io server '%s'." +msgstr "" + +#: pumpio.php:196 +msgid "You are now authenticated to pumpio." +msgstr "" + +#: pumpio.php:197 +msgid "return to the connector page" +msgstr "" + +#: pumpio.php:217 +msgid "Post to pumpio" +msgstr "" + +#: pumpio.php:241 +msgid "Save Settings" +msgstr "" + +#: pumpio.php:243 +msgid "Delete this preset" +msgstr "" + +#: pumpio.php:249 +msgid "Authenticate your pump.io connection" +msgstr "" + +#: pumpio.php:256 +msgid "Pump.io servername (without \"http://\" or \"https://\" )" +msgstr "" + +#: pumpio.php:257 +msgid "Pump.io username (without the servername)" +msgstr "" + +#: pumpio.php:258 +msgid "Import the remote timeline" +msgstr "" + +#: pumpio.php:259 +msgid "Enable Pump.io Post Addon" +msgstr "" + +#: pumpio.php:260 +msgid "Post to Pump.io by default" +msgstr "" + +#: pumpio.php:261 +msgid "Should posts be public?" +msgstr "" + +#: pumpio.php:262 +msgid "Mirror all public posts" +msgstr "" + +#: pumpio.php:267 +msgid "Pump.io Import/Export/Mirror" +msgstr "" + +#: pumpio.php:924 +msgid "status" +msgstr "" + +#: pumpio.php:928 +#, php-format +msgid "%1$s likes %2$s's %3$s" +msgstr "" diff --git a/pumpio/lang/is/strings.php b/pumpio/lang/is/strings.php new file mode 100644 index 00000000..975c341e --- /dev/null +++ b/pumpio/lang/is/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Russian (http://app.transifex.com/Friendica/friendica/language/ru/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ru\n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" + +#: pumpio.php:62 +msgid "Permission denied." +msgstr "" + +#: pumpio.php:156 +#, php-format +msgid "Unable to register the client at the pump.io server '%s'." +msgstr "" + +#: pumpio.php:196 +msgid "You are now authenticated to pumpio." +msgstr "" + +#: pumpio.php:197 +msgid "return to the connector page" +msgstr "" + +#: pumpio.php:217 +msgid "Post to pumpio" +msgstr "" + +#: pumpio.php:241 +msgid "Save Settings" +msgstr "" + +#: pumpio.php:243 +msgid "Delete this preset" +msgstr "" + +#: pumpio.php:249 +msgid "Authenticate your pump.io connection" +msgstr "" + +#: pumpio.php:256 +msgid "Pump.io servername (without \"http://\" or \"https://\" )" +msgstr "" + +#: pumpio.php:257 +msgid "Pump.io username (without the servername)" +msgstr "" + +#: pumpio.php:258 +msgid "Import the remote timeline" +msgstr "" + +#: pumpio.php:259 +msgid "Enable Pump.io Post Addon" +msgstr "" + +#: pumpio.php:260 +msgid "Post to Pump.io by default" +msgstr "" + +#: pumpio.php:261 +msgid "Should posts be public?" +msgstr "" + +#: pumpio.php:262 +msgid "Mirror all public posts" +msgstr "" + +#: pumpio.php:267 +msgid "Pump.io Import/Export/Mirror" +msgstr "" + +#: pumpio.php:924 +msgid "status" +msgstr "" + +#: pumpio.php:928 +#, php-format +msgid "%1$s likes %2$s's %3$s" +msgstr "" diff --git a/pumpio/lang/ru/strings.php b/pumpio/lang/ru/strings.php new file mode 100644 index 00000000..0579fc21 --- /dev/null +++ b/pumpio/lang/ru/strings.php @@ -0,0 +1,7 @@ +=2 && $n%10<=4 && ($n%100<12 || $n%100>14)) { return 1; } else if ($n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)) { return 2; } else { return 3; } +}} diff --git a/pumpio/oauth/http.php b/pumpio/oauth/http.php index 5d5e23f0..3045e509 100644 --- a/pumpio/oauth/http.php +++ b/pumpio/oauth/http.php @@ -109,9 +109,11 @@ class http_class var $connected_port = -1; var $connected_ssl = 0; + private $content_length_set; + /* Private methods - DO NOT CALL */ - Function Tokenize($string,$separator="") + private function Tokenize($string,$separator="") { if(!strcmp($separator,"")) { @@ -135,18 +137,18 @@ class http_class } } - Function CookieEncode($value, $name) + private function CookieEncode($value, $name) { return($name ? str_replace("=", "%25", $value) : str_replace(";", "%3B", $value)); } - Function SetError($error, $error_code = HTTP_CLIENT_ERROR_UNSPECIFIED_ERROR) + private function SetError($error, $error_code = HTTP_CLIENT_ERROR_UNSPECIFIED_ERROR) { $this->error_code = $error_code; return($this->error=$error); } - Function SetPHPError($error, &$php_error_message, $error_code = HTTP_CLIENT_ERROR_UNSPECIFIED_ERROR) + private function SetPHPError($error, &$php_error_message, $error_code = HTTP_CLIENT_ERROR_UNSPECIFIED_ERROR) { if(IsSet($php_error_message) && strlen($php_error_message)) @@ -154,7 +156,7 @@ class http_class return($this->SetError($error, $error_code)); } - Function SetDataAccessError($error,$check_connection=0) + private function SetDataAccessError($error,$check_connection=0) { $this->error=$error; $this->error_code = HTTP_CLIENT_ERROR_COMMUNICATION_FAILURE; @@ -174,7 +176,7 @@ class http_class } } - Function OutputDebug($message) + private function OutputDebug($message) { if($this->log_debug) error_log($message); @@ -188,7 +190,7 @@ class http_class } } - Function GetLine() + private function GetLine() { for($line="";;) { @@ -227,7 +229,7 @@ class http_class } } - Function PutLine($line) + private function PutLine($line) { if($this->debug) $this->OutputDebug("C $line"); @@ -239,7 +241,7 @@ class http_class return(1); } - Function PutData($data) + private function PutData($data) { if(strlen($data)) { @@ -254,7 +256,7 @@ class http_class return(1); } - Function FlushData() + private function FlushData() { if(!fflush($this->connection)) { @@ -264,7 +266,7 @@ class http_class return(1); } - Function ReadChunkSize() + private function ReadChunkSize() { if($this->remaining_chunk==0) { @@ -289,7 +291,7 @@ class http_class return(""); } - Function ReadBytes($length) + private function ReadBytes($length) { if($this->use_curl) { @@ -356,7 +358,7 @@ class http_class return($bytes); } - Function EndOfInput() + private function EndOfInput() { if($this->use_curl) return($this->read_response>=strlen($this->response)); @@ -367,7 +369,7 @@ class http_class return(feof($this->connection)); } - Function Resolve($domain, &$ip, $server_type) + private function Resolve($domain, &$ip, $server_type) { if(preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/',$domain)) $ip=$domain; @@ -385,7 +387,7 @@ class http_class return(''); } - Function Connect($host_name, $host_port, $ssl, $server_type = 'HTTP') + private function Connect($host_name, $host_port, $ssl, $server_type = 'HTTP') { $domain=$host_name; $port = $host_port; @@ -552,7 +554,7 @@ class http_class } } - Function Disconnect() + private function Disconnect() { if($this->debug) $this->OutputDebug("Disconnected from ".$this->connected_host); @@ -569,7 +571,7 @@ class http_class /* Public methods */ - Function GetRequestArguments($url, &$arguments) + public function GetRequestArguments($url, &$arguments) { $this->error = ''; $this->error_code = HTTP_CLIENT_ERROR_NO_ERROR; @@ -621,7 +623,7 @@ class http_class return(""); } - Function Open($arguments) + public function Open($arguments) { if(strlen($this->error)) return($this->error); @@ -750,7 +752,7 @@ class http_class return(""); } - Function Close($force = 0) + public function Close($force = 0) { if($this->state=="Disconnected") return("1 already disconnected"); @@ -767,7 +769,7 @@ class http_class return($this->Disconnect()); } - Function PickCookies(&$cookies,$secure) + private function PickCookies(&$cookies,$secure) { if(IsSet($this->cookies[$secure])) { @@ -803,7 +805,7 @@ class http_class } } - Function GetFileDefinition($file, &$definition) + private function GetFileDefinition($file, &$definition) { $name=""; if(IsSet($file["FileName"])) @@ -990,9 +992,6 @@ class http_class if(GetType($length=@filesize($file["FileName"]))!="integer") { $error="it was not possible to determine the length of the file ".$file["FileName"]; - if(IsSet($php_errormsg) - && strlen($php_errormsg)) - $error.=": ".$php_errormsg; if(!file_exists($file["FileName"])) $error="it was not possible to access the file ".$file["FileName"]; return($error); @@ -1007,7 +1006,7 @@ class http_class return(""); } - Function ConnectFromProxy($arguments, &$headers) + private function ConnectFromProxy($arguments, &$headers) { if(!$this->PutLine('CONNECT '.$this->host_name.':'.($this->host_port ? $this->host_port : 443).' HTTP/1.0') || (strlen($this->user_agent) @@ -1052,7 +1051,7 @@ class http_class return(""); } - Function SendRequest($arguments) + public function SendRequest($arguments) { if(strlen($this->error)) return($this->error); @@ -1440,7 +1439,7 @@ class http_class return(""); } - Function SetCookie($name, $value, $expires="" , $path="/" , $domain="" , $secure=0, $verbatim=0) + private function SetCookie($name, $value, $expires="" , $path="/" , $domain="" , $secure=0, $verbatim=0) { if(strlen($this->error)) return($this->error); @@ -1472,7 +1471,7 @@ class http_class return(""); } - Function SendRequestBody($data, $end_of_data) + private function SendRequestBody($data, $end_of_data) { if(strlen($this->error)) return($this->error); @@ -1508,7 +1507,7 @@ class http_class return(""); } - Function ReadReplyHeadersResponse(&$headers) + private function ReadReplyHeadersResponse(&$headers) { $headers=array(); if(strlen($this->error)) @@ -1635,7 +1634,7 @@ class http_class return(""); } - Function Redirect(&$headers) + private function Redirect(&$headers) { if($this->follow_redirect) { @@ -1678,7 +1677,7 @@ class http_class return(""); } - Function Authenticate(&$headers, $proxy, &$proxy_authorization, &$user, &$password, &$realm, &$workstation) + private function Authenticate(&$headers, $proxy, &$proxy_authorization, &$user, &$password, &$realm, &$workstation) { if($proxy) { @@ -1697,9 +1696,10 @@ class http_class if(IsSet($headers[$authenticate_header]) && $this->sasl_authenticate) { - if(function_exists("class_exists") - && !class_exists("sasl_client_class")) + if(!class_exists('sasl_client_class')) + { return($this->SetError("the SASL client class needs to be loaded to be able to authenticate".($proxy ? " with the proxy server" : "")." and access this site", HTTP_CLIENT_ERROR_INVALID_PARAMETERS)); + } if(GetType($headers[$authenticate_header])=="array") $authenticate=$headers[$authenticate_header]; else @@ -1719,7 +1719,7 @@ class http_class else $mechanisms[]=$mechanism; } - $sasl=new sasl_client_class; + $sasl=new \sasl_client_class(); if(IsSet($user)) $sasl->SetCredential("user",$user); if(IsSet($password)) @@ -1731,6 +1731,8 @@ class http_class $sasl->SetCredential("uri",$this->request_uri); $sasl->SetCredential("method",$this->request_method); $sasl->SetCredential("session",$this->session); + $message = ''; + $interactions = []; do { $status=$sasl->Start($mechanisms,$message,$interactions); @@ -1906,8 +1908,8 @@ class http_class } return(""); } - - Function ReadReplyHeaders(&$headers) + + public function ReadReplyHeaders(&$headers) { if(strlen($error=$this->ReadReplyHeadersResponse($headers))) return($error); @@ -1938,7 +1940,7 @@ class http_class return(""); } - Function ReadReplyBody(&$body,$length) + private function ReadReplyBody(&$body,$length) { $body=""; if(strlen($this->error)) @@ -1980,7 +1982,7 @@ class http_class return(""); } - Function ReadWholeReplyBody(&$body) + public function ReadWholeReplyBody(&$body) { $body = ''; for(;;) @@ -1993,7 +1995,7 @@ class http_class } } - Function SaveCookies(&$cookies, $domain='', $secure_only=0, $persistent_only=0) + private function SaveCookies(&$cookies, $domain='', $secure_only=0, $persistent_only=0) { $now=gmdate("Y-m-d H-i-s"); $cookies=array(); @@ -2034,17 +2036,17 @@ class http_class } } - Function SavePersistentCookies(&$cookies, $domain='', $secure_only=0) + private function SavePersistentCookies(&$cookies, $domain='', $secure_only=0) { $this->SaveCookies($cookies, $domain, $secure_only, 1); } - Function GetPersistentCookies(&$cookies, $domain='', $secure_only=0) + private function GetPersistentCookies(&$cookies, $domain='', $secure_only=0) { $this->SavePersistentCookies($cookies, $domain, $secure_only); } - Function RestoreCookies($cookies, $clear=1) + private function RestoreCookies($cookies, $clear=1) { $new_cookies=($clear ? array() : $this->cookies); for($secure_cookies=0, Reset($cookies); $secure_cookies */ -use Friendica\App; use Friendica\Content\Text\BBCode; use Friendica\Content\Text\HTML; -use Friendica\Core\Addon; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Protocol; use Friendica\Core\Renderer; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; -use Friendica\Model\Group; +use Friendica\Model\Circle; use Friendica\Model\Item; use Friendica\Model\Post; use Friendica\Model\User; @@ -108,7 +105,7 @@ function pumpio_registerclient($host) $params['logo_url'] = DI::baseUrl() . '/images/friendica-256.png'; $params['redirect_uris'] = DI::baseUrl() . '/pumpio/connect'; - Logger::info('pumpio_registerclient: ' . $url . ' parameters', $params); + DI::logger()->info('pumpio_registerclient: ' . $url . ' parameters', $params); // @TODO Rewrite this to our own HTTP client $ch = curl_init($url); @@ -123,10 +120,10 @@ function pumpio_registerclient($host) if ($curl_info['http_code'] == '200') { $values = json_decode($s); - Logger::info('pumpio_registerclient: success ', (array)$values); + DI::logger()->info('pumpio_registerclient: success ', (array)$values); return $values; } - Logger::info('pumpio_registerclient: failed: ', $curl_info); + DI::logger()->info('pumpio_registerclient: failed: ', $curl_info); return false; } @@ -139,7 +136,7 @@ function pumpio_connect() $hostname = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pumpio', 'host'); if ((($consumer_key == '') || ($consumer_secret == '')) && ($hostname != '')) { - Logger::notice('pumpio_connect: register client'); + DI::logger()->notice('pumpio_connect: register client'); $clientdata = pumpio_registerclient($hostname); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pumpio', 'consumer_key', $clientdata->client_id); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pumpio', 'consumer_secret', $clientdata->client_secret); @@ -147,11 +144,11 @@ function pumpio_connect() $consumer_key = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pumpio', 'consumer_key'); $consumer_secret = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'pumpio', 'consumer_secret'); - Logger::info('pumpio_connect: ckey: ' . $consumer_key . ' csecrect: ' . $consumer_secret); + DI::logger()->info('pumpio_connect: ckey: ' . $consumer_key . ' csecrect: ' . $consumer_secret); } if (($consumer_key == '') || ($consumer_secret == '')) { - Logger::notice('pumpio_connect: '.sprintf('Unable to register the client at the pump.io server "%s".', $hostname)); + DI::logger()->notice('pumpio_connect: '.sprintf('Unable to register the client at the pump.io server "%s".', $hostname)); return DI::l10n()->t("Unable to register the client at the pump.io server '%s'.", $hostname); } @@ -180,7 +177,7 @@ function pumpio_connect() if (($success = $client->Initialize())) { if (($success = $client->Process())) { if (strlen($client->access_token)) { - Logger::info('pumpio_connect: otoken: ' . $client->access_token . ', osecrect: ' . $client->access_token_secret); + DI::logger()->info('pumpio_connect: otoken: ' . $client->access_token . ', osecrect: ' . $client->access_token_secret); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pumpio', 'oauth_token', $client->access_token); DI::pConfig()->set(DI::userSession()->getLocalUserId(), 'pumpio', 'oauth_token_secret', $client->access_token_secret); } @@ -192,11 +189,11 @@ function pumpio_connect() } if ($success) { - Logger::notice('pumpio_connect: authenticated'); + DI::logger()->notice('pumpio_connect: authenticated'); $o = DI::l10n()->t('You are now authenticated to pumpio.'); $o .= '
' . DI::l10n()->t('return to the connector page') . ''; } else { - Logger::notice('pumpio_connect: could not connect'); + DI::logger()->notice('pumpio_connect: could not connect'); $o = 'Could not connect to pumpio. Refresh the page or try again later.'; } @@ -320,7 +317,7 @@ function pumpio_settings_post(array &$b) function pumpio_load_config(ConfigFileManager $loader) { - DI::app()->getConfigCache()->load($loader->loadAddonConfig('pumpio'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); + DI::appHelper()->getConfigCache()->load($loader->loadAddonConfig('pumpio'), \Friendica\Core\Config\ValueObject\Cache::SOURCE_STATIC); } function pumpio_hook_fork(array &$b) @@ -345,14 +342,14 @@ function pumpio_hook_fork(array &$b) if (DI::pConfig()->get($post['uid'], 'pumpio', 'import')) { // Don't fork if it isn't a reply to a pump.io post - if (($post['parent'] != $post['id']) && !Post::exists(['id' => $post['parent'], 'network' => Protocol::PUMPIO])) { - Logger::notice('No pump.io parent found for item ' . $post['id']); + if (($post['gravity'] != Item::GRAVITY_PARENT) && !Post::exists(['id' => $post['parent'], 'network' => Protocol::PUMPIO])) { + DI::logger()->notice('No pump.io parent found for item ' . $post['id']); $b['execute'] = false; return; } } else { // Comments are never exported when we don't import the pumpio timeline - if (!strstr($post['postopts'], 'pumpio') || ($post['parent'] != $post['id']) || $post['private']) { + if (!strstr($post['postopts'], 'pumpio') || ($post['gravity'] != Item::GRAVITY_PARENT)|| ($post['private'] == Item::PRIVATE)) { $b['execute'] = false; return; } @@ -390,7 +387,11 @@ function pumpio_send(array &$b) return; } - Logger::debug('pumpio_send: parameter ', $b); + if (Item::isGroupPost($b['uri-id'])) { + return; + } + + DI::logger()->debug('pumpio_send: parameter ', $b); $b['body'] = Post\Media::addAttachmentsToBody($b['uri-id'], DI::contentItem()->addSharedPost($b)); @@ -400,7 +401,7 @@ function pumpio_send(array &$b) $orig_post = Post::selectFirst([], $condition); if (!DBA::isResult($orig_post)) { - Logger::notice('pumpio_send: no pumpio post ' . $b['parent']); + DI::logger()->notice('pumpio_send: no pumpio post ' . $b['parent']); return; } else { $iscomment = true; @@ -410,14 +411,14 @@ function pumpio_send(array &$b) $receiver = pumpio_getreceiver($b); - Logger::notice('pumpio_send: receiver ', $receiver); + DI::logger()->notice('pumpio_send: receiver ', $receiver); - if (!count($receiver) && ($b['private'] || !strstr($b['postopts'], 'pumpio'))) { + if (!count($receiver) && ($b['private'] == Item::PRIVATE) || !strstr($b['postopts'], 'pumpio')) { return; } // Dont't post if the post doesn't belong to us. - // This is a check for forum postings + // This is a check for group postings $self = User::getOwnerDataById($b['uid']); if ($b['contact-id'] != $self['id']) { return; @@ -544,13 +545,13 @@ function pumpio_send(array &$b) } $post_id = $user->object->id; - Logger::notice('pumpio_send ' . $username . ': success ' . $post_id); + DI::logger()->notice('pumpio_send ' . $username . ': success ' . $post_id); if ($post_id && $iscomment) { - Logger::notice('pumpio_send ' . $username . ': Update extid ' . $post_id . ' for post id ' . $b['id']); + DI::logger()->notice('pumpio_send ' . $username . ': Update extid ' . $post_id . ' for post id ' . $b['id']); Item::update(['extid' => $post_id], ['id' => $b['id']]); } } else { - Logger::notice('pumpio_send '.$username.': '.$url.' general error: ' . print_r($user, true)); + DI::logger()->notice('pumpio_send '.$username.': '.$url.' general error: ' . print_r($user, true)); Worker::defer(); } } @@ -582,6 +583,8 @@ function pumpio_action(int $uid, string $uri, string $action, string $content = $uri = $orig_post['uri']; } + $objectType = ''; + if (($orig_post['object-type'] != '') && (strstr($orig_post['object-type'], ActivityNamespace::ACTIVITY_SCHEMA))) { $objectType = str_replace(ActivityNamespace::ACTIVITY_SCHEMA, '', $orig_post['object-type']); } elseif (strstr($uri, '/api/comment/')) { @@ -618,16 +621,18 @@ function pumpio_action(int $uid, string $uri, string $action, string $content = } if ($success) { - Logger::notice('pumpio_action '.$username.' '.$action.': success '.$uri); + DI::logger()->notice('pumpio_action '.$username.' '.$action.': success '.$uri); } else { - Logger::notice('pumpio_action '.$username.' '.$action.': general error: '.$uri); + DI::logger()->notice('pumpio_action '.$username.' '.$action.': general error: '.$uri); Worker::defer(); } } function pumpio_sync() { - if (!Addon::isEnabled('pumpio')) { + $addonHelper = DI::addonHelper(); + + if (!$addonHelper->isAddonEnabled('pumpio')) { return; } @@ -638,15 +643,15 @@ function pumpio_sync() if ($last) { $next = $last + ($poll_interval * 60); if ($next > time()) { - Logger::notice('pumpio: poll intervall not reached'); + DI::logger()->notice('pumpio: poll intervall not reached'); return; } } - Logger::notice('pumpio: cron_start'); + DI::logger()->notice('pumpio: cron_start'); $pconfigs = DBA::selectToArray('pconfig', ['uid'], ['cat' => 'pumpio', 'k' => 'mirror', 'v' => '1']); foreach ($pconfigs as $rr) { - Logger::notice('pumpio: mirroring user '.$rr['uid']); + DI::logger()->notice('pumpio: mirroring user '.$rr['uid']); pumpio_fetchtimeline($rr['uid']); } @@ -661,12 +666,12 @@ function pumpio_sync() foreach ($pconfigs as $rr) { if ($abandon_days != 0) { if (DBA::exists('user', ["uid = ? AND `login_date` >= ?", $rr['uid'], $abandon_limit])) { - Logger::notice('abandoned account: timeline from user '.$rr['uid'].' will not be imported'); + DI::logger()->notice('abandoned account: timeline from user '.$rr['uid'].' will not be imported'); continue; } } - Logger::notice('pumpio: importing timeline from user '.$rr['uid']); + DI::logger()->notice('pumpio: importing timeline from user '.$rr['uid']); pumpio_fetchinbox($rr['uid']); // check for new contacts once a day @@ -683,7 +688,7 @@ function pumpio_sync() } } - Logger::notice('pumpio: cron_end'); + DI::logger()->notice('pumpio: cron_end'); DI::keyValue()->set('pumpio_last_poll', time()); } @@ -728,7 +733,7 @@ function pumpio_fetchtimeline(int $uid) $url = 'https://'.$hostname.'/api/user/'.$username.'/feed/major'; - Logger::notice('pumpio: fetching for user ' . $uid . ' ' . $url . ' C:' . $client->client_id . ' CS:' . $client->client_secret . ' T:' . $client->access_token . ' TS:' . $client->access_token_secret); + DI::logger()->notice('pumpio: fetching for user ' . $uid . ' ' . $url . ' C:' . $client->client_id . ' CS:' . $client->client_secret . ' T:' . $client->access_token . ' TS:' . $client->access_token_secret); $useraddr = $username.'@'.$hostname; @@ -740,7 +745,7 @@ function pumpio_fetchtimeline(int $uid) } if (!$success) { - Logger::notice('pumpio: error fetching posts for user ' . $uid . ' ' . $useraddr . ' ', $user); + DI::logger()->notice('pumpio: error fetching posts for user ' . $uid . ' ' . $useraddr . ' ', $user); return; } @@ -800,11 +805,11 @@ function pumpio_fetchtimeline(int $uid) } } - Logger::notice('pumpio: posting for user ' . $uid); + DI::logger()->notice('pumpio: posting for user ' . $uid); Item::insert($postarray, true); - Logger::notice('pumpio: posting done - user ' . $uid); + DI::logger()->notice('pumpio: posting done - user ' . $uid); } } } @@ -827,6 +832,7 @@ function pumpio_dounlike(int $uid, array $self, $post, string $own_id) } $contactid = 0; + $contact = []; if (Strings::compareLink($post->actor->url, $own_id)) { $contactid = $self['id']; @@ -844,16 +850,16 @@ function pumpio_dounlike(int $uid, array $self, $post, string $own_id) Item::markForDeletion(['verb' => Activity::LIKE, 'uid' => $uid, 'contact-id' => $contactid, 'thr-parent' => $orig_post['uri']]); if (DBA::isResult($contact)) { - Logger::notice('pumpio_dounlike: unliked existing like. User ' . $own_id . ' ' . $uid . ' Contact: ' . $contactid . ' URI ' . $orig_post['uri']); + DI::logger()->notice('pumpio_dounlike: unliked existing like. User ' . $own_id . ' ' . $uid . ' Contact: ' . $contactid . ' URI ' . $orig_post['uri']); } else { - Logger::notice('pumpio_dounlike: not found. User ' . $own_id . ' ' . $uid . ' Contact: ' . $contactid . ' Url ' . $orig_post['uri']); + DI::logger()->notice('pumpio_dounlike: not found. User ' . $own_id . ' ' . $uid . ' Contact: ' . $contactid . ' Url ' . $orig_post['uri']); } } function pumpio_dolike(int $uid, array $self, $post, string $own_id, $threadcompletion = true) { if (empty($post->object->id)) { - Logger::info('Got empty like: '.print_r($post, true)); + DI::logger()->info('Got empty like: '.print_r($post, true)); return; } @@ -898,7 +904,7 @@ function pumpio_dolike(int $uid, array $self, $post, string $own_id, $threadcomp ]; if (Post::exists($condition)) { - Logger::notice('pumpio_dolike: found existing like. User ' . $own_id . ' ' . $uid . ' Contact: ' . $contactid . ' URI ' . $orig_post['uri']); + DI::logger()->notice('pumpio_dolike: found existing like. User ' . $own_id . ' ' . $uid . ' Contact: ' . $contactid . ' URI ' . $orig_post['uri']); return; } @@ -932,7 +938,7 @@ function pumpio_dolike(int $uid, array $self, $post, string $own_id, $threadcomp $ret = Item::insert($likedata); - Logger::notice('pumpio_dolike: ' . $ret . ' User ' . $own_id . ' ' . $uid . ' Contact: ' . $contactid . ' URI ' . $orig_post['uri']); + DI::logger()->notice('pumpio_dolike: ' . $ret . ' User ' . $own_id . ' ' . $uid . ' Contact: ' . $contactid . ' URI ' . $orig_post['uri']); } function pumpio_get_contact($uid, $contact, $no_insert = false) @@ -976,7 +982,7 @@ function pumpio_get_contact($uid, $contact, $no_insert = false) $contact_id = $r['id']; - Group::addMember(User::getDefaultGroup($uid), $contact_id); + Circle::addMember(User::getDefaultCircle($uid), $contact_id); } else { $contact_id = $r['id']; } @@ -1319,7 +1325,7 @@ function pumpio_getreceiver(array $b) { $receiver = []; - if (!$b['private']) { + if ($b['private'] != Item::PRIVATE) { if (!strstr($b['postopts'], 'pumpio')) { return $receiver; } @@ -1353,8 +1359,8 @@ function pumpio_getreceiver(array $b) $gid = trim($gid, ' <>'); $contacts = DBA::p("SELECT `contact`.`name`, `contact`.`nick`, `contact`.`url`, `contact`.`network` - FROM `group_member`, `contact` WHERE `group_member`.`gid` = ? - AND `contact`.`id` = `group_member`.`contact-id` AND `contact`.`network` = ?", + FROM `group_member` AS `circle_member`, `contact` WHERE `circle_member`.`gid` = ? + AND `contact`.`id` = `circle_member`.`contact-id` AND `contact`.`network` = ?", $gid, Protocol::PUMPIO); while ($row = DBA::fetch($contacts)) { @@ -1403,7 +1409,7 @@ function pumpio_fetchallcomments($uid, $id) $hostname = DI::pConfig()->get($uid, 'pumpio', 'host'); $username = DI::pConfig()->get($uid, 'pumpio', 'user'); - Logger::notice('pumpio_fetchallcomments: completing comment for user ' . $uid . ' post id ' . $id); + DI::logger()->notice('pumpio_fetchallcomments: completing comment for user ' . $uid . ' post id ' . $id); $own_id = 'https://' . $hostname . '/' . $username; @@ -1428,7 +1434,9 @@ function pumpio_fetchallcomments($uid, $id) $client->access_token = $otoken; $client->access_token_secret = $osecret; - Logger::notice('pumpio_fetchallcomments: fetching comment for user ' . $uid . ', URL ' . $url); + DI::logger()->notice('pumpio_fetchallcomments: fetching comment for user ' . $uid . ', URL ' . $url); + + $item = new \stdClass(); if (pumpio_reachable($url)) { $success = $client->CallAPI($url, 'GET', [], ['FailOnAccessError' => true], $item); @@ -1491,7 +1499,7 @@ function pumpio_fetchallcomments($uid, $id) $post->object = $item; - Logger::notice('pumpio_fetchallcomments: posting comment ' . $post->object->id . ' ', json_decode(json_encode($post), true)); + DI::logger()->notice('pumpio_fetchallcomments: posting comment ' . $post->object->id . ' ', json_decode(json_encode($post), true)); pumpio_dopost($client, $uid, $self, $post, $own_id, false); } } diff --git a/pumpio/pumpio_sync.php b/pumpio/pumpio_sync.php index beaf6e81..09548c6d 100644 --- a/pumpio/pumpio_sync.php +++ b/pumpio/pumpio_sync.php @@ -1,5 +1,5 @@ DI::config()->get('system', 'maxloadavg', 50)) { - Logger::notice('system: load ' . $load[0] . ' too high. Pumpio sync deferred to next scheduled run.'); + DI::logger()->notice('system: load ' . $load[0] . ' too high. Pumpio sync deferred to next scheduled run.'); return; } } diff --git a/qcomment/lang/bg/messages.po b/qcomment/lang/bg/messages.po new file mode 100644 index 00000000..d0b6c4b7 --- /dev/null +++ b/qcomment/lang/bg/messages.po @@ -0,0 +1,45 @@ +# ADDON qcomment +# Copyright (C) +# This file is distributed under the same license as the Friendica qcomment addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:16-0500\n" +"PO-Revision-Date: 2014-06-23 12:30+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: qcomment.php:45 +msgid ":-)" +msgstr "" + +#: qcomment.php:45 +msgid ":-(" +msgstr "" + +#: qcomment.php:45 +msgid "lol" +msgstr "" + +#: qcomment.php:49 +msgid "" +"Quick comments are found near comment boxes, sometimes hidden. Click them to" +" provide simple replies." +msgstr "" + +#: qcomment.php:50 +msgid "Enter quick comments, one per line" +msgstr "" + +#: qcomment.php:55 +msgid "Quick Comment Settings" +msgstr "" diff --git a/qcomment/lang/bg/strings.php b/qcomment/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/qcomment/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: qcomment.php:45 +msgid ":-)" +msgstr "" + +#: qcomment.php:45 +msgid ":-(" +msgstr "" + +#: qcomment.php:45 +msgid "lol" +msgstr "" + +#: qcomment.php:49 +msgid "" +"Quick comments are found near comment boxes, sometimes hidden. Click them to" +" provide simple replies." +msgstr "" + +#: qcomment.php:50 +msgid "Enter quick comments, one per line" +msgstr "" + +#: qcomment.php:55 +msgid "Quick Comment Settings" +msgstr "" diff --git a/qcomment/lang/ca/strings.php b/qcomment/lang/ca/strings.php index 257e9fe3..d34874f6 100644 --- a/qcomment/lang/ca/strings.php +++ b/qcomment/lang/ca/strings.php @@ -1,10 +1,7 @@ -strings[":-)"] = ":-)"; -$a->strings[":-("] = ":-("; -$a->strings["lol"] = "lol"; -$a->strings["Quick Comment Settings"] = "Configuració Ràpida dels Comentaris"; -$a->strings["Quick comments are found near comment boxes, sometimes hidden. Click them to provide simple replies."] = "Comentaris ràpids es troben prop de les caixes de comentaris, de vegades ocults. Feu clic a ells per donar respostes simples."; -$a->strings["Enter quick comments, one per line"] = "Introduïu els comentaris ràpids, un per línia"; -$a->strings["Submit"] = "Enviar"; -$a->strings["Quick Comment settings saved."] = "Guardada la configuració de comentaris ràpids."; +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: qcomment.php:45 +msgid ":-)" +msgstr "" + +#: qcomment.php:45 +msgid ":-(" +msgstr "" + +#: qcomment.php:45 +msgid "lol" +msgstr "" + +#: qcomment.php:49 +msgid "" +"Quick comments are found near comment boxes, sometimes hidden. Click them to" +" provide simple replies." +msgstr "" + +#: qcomment.php:50 +msgid "Enter quick comments, one per line" +msgstr "" + +#: qcomment.php:55 +msgid "Quick Comment Settings" +msgstr "" diff --git a/qcomment/lang/eo/strings.php b/qcomment/lang/eo/strings.php index 2c88b15f..68e8a64c 100644 --- a/qcomment/lang/eo/strings.php +++ b/qcomment/lang/eo/strings.php @@ -1,10 +1,7 @@ -strings[":-)"] = ":-)"; -$a->strings[":-("] = ":-("; -$a->strings["lol"] = "lol"; -$a->strings["Quick Comment Settings"] = "Agordoj pri Rapidaj Komentoj"; -$a->strings["Quick comments are found near comment boxes, sometimes hidden. Click them to provide simple replies."] = "Rapidaj komentoj troviĝas apud komentkampoj, kelkfoje kaŝita. Klaku ilin por provizi simplajn rispondojn."; -$a->strings["Enter quick comments, one per line"] = "Entajpu rapidaj komentoj, po unu je linio."; -$a->strings["Submit"] = "Sendi"; -$a->strings["Quick Comment settings saved."] = "Konservis agordojn pri rapidaj komentoj."; +\n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: qcomment.php:45 +msgid ":-)" +msgstr "" + +#: qcomment.php:45 +msgid ":-(" +msgstr "" + +#: qcomment.php:45 +msgid "lol" +msgstr "" + +#: qcomment.php:49 +msgid "" +"Quick comments are found near comment boxes, sometimes hidden. Click them to" +" provide simple replies." +msgstr "" + +#: qcomment.php:50 +msgid "Enter quick comments, one per line" +msgstr "" + +#: qcomment.php:55 +msgid "Quick Comment Settings" +msgstr "" diff --git a/qcomment/lang/gd/strings.php b/qcomment/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/qcomment/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/qcomment/lang/is/messages.po b/qcomment/lang/is/messages.po new file mode 100644 index 00000000..40e125c8 --- /dev/null +++ b/qcomment/lang/is/messages.po @@ -0,0 +1,45 @@ +# ADDON qcomment +# Copyright (C) +# This file is distributed under the same license as the Friendica qcomment addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-11-21 19:16-0500\n" +"PO-Revision-Date: 2014-06-23 12:30+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: qcomment.php:45 +msgid ":-)" +msgstr "" + +#: qcomment.php:45 +msgid ":-(" +msgstr "" + +#: qcomment.php:45 +msgid "lol" +msgstr "" + +#: qcomment.php:49 +msgid "" +"Quick comments are found near comment boxes, sometimes hidden. Click them to" +" provide simple replies." +msgstr "" + +#: qcomment.php:50 +msgid "Enter quick comments, one per line" +msgstr "" + +#: qcomment.php:55 +msgid "Quick Comment Settings" +msgstr "" diff --git a/qcomment/lang/is/strings.php b/qcomment/lang/is/strings.php index b0d3fd28..975c341e 100644 --- a/qcomment/lang/is/strings.php +++ b/qcomment/lang/is/strings.php @@ -1,10 +1,7 @@ -strings[":-)"] = ":-)"; -$a->strings[":-("] = ":-("; -$a->strings["lol"] = "lol"; -$a->strings["Quick Comment Settings"] = ""; -$a->strings["Quick comments are found near comment boxes, sometimes hidden. Click them to provide simple replies."] = ""; -$a->strings["Enter quick comments, one per line"] = ""; -$a->strings["Submit"] = "Senda inn"; -$a->strings["Quick Comment settings saved."] = ""; +\n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: randplace.php:161 +msgid "Enable Randplace Addon" +msgstr "" + +#: randplace.php:166 +msgid "Randplace Settings" +msgstr "" diff --git a/randplace/lang/bg/strings.php b/randplace/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/randplace/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: randplace.php:161 +msgid "Enable Randplace Addon" +msgstr "" + +#: randplace.php:166 +msgid "Randplace Settings" +msgstr "" diff --git a/randplace/lang/ca/strings.php b/randplace/lang/ca/strings.php index 120fab8c..d34874f6 100644 --- a/randplace/lang/ca/strings.php +++ b/randplace/lang/ca/strings.php @@ -1,5 +1,7 @@ -strings["Randplace Settings"] = "Configuració de Randplace"; -$a->strings["Enable Randplace Addon"] = "Habilitar el Addon de Randplace"; -$a->strings["Submit"] = "Enviar"; +\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: randplace.php:161 +msgid "Enable Randplace Addon" +msgstr "" + +#: randplace.php:166 +msgid "Randplace Settings" +msgstr "" diff --git a/randplace/lang/eo/strings.php b/randplace/lang/eo/strings.php index 38e6ebfa..68e8a64c 100644 --- a/randplace/lang/eo/strings.php +++ b/randplace/lang/eo/strings.php @@ -1,5 +1,7 @@ -strings["Randplace Settings"] = "Randplace agordoj."; -$a->strings["Enable Randplace Addon"] = "Aktivigi la Randplace kromprogramon."; -$a->strings["Submit"] = "Sendi"; +\n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: randplace.php:161 +msgid "Enable Randplace Addon" +msgstr "" + +#: randplace.php:166 +msgid "Randplace Settings" +msgstr "" diff --git a/randplace/lang/is/strings.php b/randplace/lang/is/strings.php index 85e49238..975c341e 100644 --- a/randplace/lang/is/strings.php +++ b/randplace/lang/is/strings.php @@ -1,5 +1,7 @@ -strings["Randplace Settings"] = "Stilla Randplace"; -$a->strings["Enable Randplace Addon"] = "Kveikja á Randplace einingu"; -$a->strings["Submit"] = "Senda inn"; +\n" +"Language-Team: Russian (http://app.transifex.com/Friendica/friendica/language/ru/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ru\n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" + +#: randplace.php:161 +msgid "Enable Randplace Addon" +msgstr "" + +#: randplace.php:166 +msgid "Randplace Settings" +msgstr "" diff --git a/randplace/lang/ru/strings.php b/randplace/lang/ru/strings.php index 46733dc6..0579fc21 100644 --- a/randplace/lang/ru/strings.php +++ b/randplace/lang/ru/strings.php @@ -1,5 +1,7 @@ -strings["Randplace Settings"] = "Настройки Случайного места"; -$a->strings["Enable Randplace Addon"] = "Включить Randplace плагин"; -$a->strings["Submit"] = "Подтвердить"; +=2 && $n%10<=4 && ($n%100<12 || $n%100>14)) { return 1; } else if ($n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)) { return 2; } else { return 3; } +}} diff --git a/randplace/randplace.php b/randplace/randplace.php index 34f48c6c..89a75f98 100644 --- a/randplace/randplace.php +++ b/randplace/randplace.php @@ -19,9 +19,7 @@ * */ -use Friendica\App; use Friendica\Core\Hook; -use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; @@ -41,7 +39,7 @@ function randplace_install() Hook::register('addon_settings', 'addon/randplace/randplace.php', 'randplace_settings'); Hook::register('addon_settings_post', 'addon/randplace/randplace.php', 'randplace_settings_post'); - Logger::notice("installed randplace"); + DI::logger()->notice("installed randplace"); } function randplace_uninstall() @@ -51,7 +49,7 @@ function randplace_uninstall() * * Except hooks, they are all unregistered automatically and don't need to be unregistered manually. */ - Logger::notice("removed randplace"); + DI::logger()->notice("removed randplace"); } function randplace_post_hook(&$item) @@ -62,7 +60,7 @@ function randplace_post_hook(&$item) * - A status post by a profile owner * - The profile owner must have allowed our addon */ - Logger::notice('randplace invoked'); + DI::logger()->notice('randplace invoked'); if (!DI::userSession()->getLocalUserId()) { /* non-zero if this is a logged in user of this system */ diff --git a/ratioed/RatioedPanel.php b/ratioed/RatioedPanel.php new file mode 100644 index 00000000..37e692a5 --- /dev/null +++ b/ratioed/RatioedPanel.php @@ -0,0 +1,323 @@ +getArgv()[1]) and DI::args()->getArgv()[1] === 'help') { + $template = Renderer::getMarkupTemplate('/help.tpl', 'addon/ratioed/'); + return Renderer::replaceMacros($template, array('$config' => DI::baseUrl() . '/settings/addon')); + } + + $uid = $this->parameters['uid'] ?? 0; + $user = []; + + if ($uid) { + $user = User::getById($uid, ['username', 'blocked']); + if (!$user) { + $this->systemMessages->addNotice($this->t('User not found')); + $this->baseUrl->redirect('ratioed'); + } + } + + $pager = new Pager($this->l10n, $this->args->getQueryString(), 100); + + $valid_orders = [ + 'name', + 'email', + 'register_date', + 'last-activity', + 'last-item', + 'page-flags', + ]; + + $order = 'last-item'; + $order_direction = '-'; + if (!empty($_REQUEST['o'])) { + $new_order = $_REQUEST['o']; + if ($new_order[0] !== '-') { + $order_direction = '+'; + $new_order = substr($new_order, 1); + } + + if (in_array($new_order, $valid_orders)) { + $order = $new_order; + } + } + + $users = User::getList($pager->getStart(), $pager->getItemsPerPage(), 'active', $order, ($order_direction == '-')); + + $users = array_map($this->setupUserCallback(), $users); + + $header_titles = [ + $this->t('Name'), + $this->t('Email'), + $this->t('Register date'), + $this->t('Last login'), + $this->t('Last public item'), + $this->t('Type'), + $this->t('Blocked by'), + $this->t('Comments last 24h'), + $this->t('Reactions last 24h'), + $this->t('Ratio last 24h'), + $this->t('Replies last month'), + $this->t('Reply likes'), + $this->t('Respondee likes'), + $this->t('OP likes'), + $this->t('Reply guy score'), + ]; + $field_names = [ + 'name', + 'email', + 'register_date', + 'login_date', + 'lastitem_date', + 'page_flags', + 'blocked_by', + 'comments', + 'reactions', + 'ratio', + 'reply_count', + 'reply_likes', + 'reply_respondee_likes', + 'reply_op_likes', + 'reply_guy_score', + ]; + $th_users = array_map(null, $header_titles, $valid_orders, $field_names); + + $count = $this->database->count('user', ["`verified` AND NOT `blocked` AND NOT `account_removed` AND NOT `account_expired` AND `uid` != ?", 0]); + + $t = Renderer::getMarkupTemplate('ratioed.tpl', 'addon/ratioed'); + return self::getTabsHTML('ratioed') . Renderer::replaceMacros($t, [ + // strings // + '$title' => $this->t('Moderation'), + '$help_url' => $this->baseUrl . '/ratioed/help', + '$page' => $this->t('Behaviour'), + '$select_all' => $this->t('select all'), + '$delete' => $this->t('Delete'), + '$block' => $this->t('Block'), + '$blocked' => $this->t('User blocked'), + '$siteadmin' => $this->t('Site admin'), + '$accountexpired' => $this->t('Account expired'), + '$h_newuser' => $this->t('Create a new user'), + + '$th_users' => $th_users, + '$order_users' => $order, + '$order_direction_users' => $order_direction, + + '$confirm_delete_multi' => $this->t('Selected users will be deleted!\n\nEverything these users had posted on this site will be permanently deleted!\n\nAre you sure?'), + '$confirm_delete' => $this->t('The user {0} will be deleted!\n\nEverything this user has posted on this site will be permanently deleted!\n\nAre you sure?'), + + '$form_security_token' => self::getFormSecurityToken('moderation_users_active'), + + // values // + '$baseurl' => $this->baseUrl, + '$query_string' => $this->args->getQueryString(), + + '$users' => $users, + '$count' => $count, + '$pager' => $pager->renderFull($count), + ]); + } + + protected function getReplyGuyRow($contact_uid) + { + $like_vid = Verb::getID(Activity::LIKE); + $post_vid = Verb::getID(Activity::POST); + + /* + * This is a complicated query. + * + * The innermost select retrieves a chain of four posts: an + * original post, a target comment (possibly deep down in the + * thread), a reply from our user, and a like for that reply. + * If there's no like, we still want to count the reply, so we + * use an outer join. + * + * The second select adds "points" for different kinds of + * likes. The outermost select then counts up these points, + * and the number of distinct replies. + */ + $reply_guy_result = DBA::p(' +SELECT + COUNT(distinct reply_id) AS replies_total, + SUM(like_point) AS like_total, + SUM(target_like_point) AS target_like_total, + SUM(original_like_point) AS original_like_total +FROM ( + SELECT + reply_id, + like_date, + like_date IS NOT NULL AS like_point, + like_author = target_author AS target_like_point, + like_author = original_author AS original_like_point + FROM ( + SELECT + original_post.`uri-id` AS original_id, + original_post.`author-id` AS original_author, + original_post.created AS original_date, + target_post.`uri-id` AS target_id, + target_post.`author-id` AS target_author, + target_post.created AS target_date, + reply_post.`uri-id` AS reply_id, + reply_post.`author-id` AS reply_author, + reply_post.created AS reply_date, + like_post.`uri-id` AS like_id, + like_post.`author-id` AS like_author, + like_post.created AS like_date + FROM + post AS original_post + JOIN + post AS target_post + ON + original_post.`uri-id` = target_post.`parent-uri-id` + JOIN + post AS reply_post + ON + target_post.`uri-id` = reply_post.`thr-parent-id` AND + reply_post.`author-id` = ? AND + reply_post.`author-id` != target_post.`author-id` AND + reply_post.`author-id` != original_post.`author-id` AND + reply_post.`uri-id` != reply_post.`thr-parent-id` AND + reply_post.vid = ? AND + reply_post.created > CURDATE() - INTERVAL 1 MONTH + LEFT OUTER JOIN + post AS like_post + ON + reply_post.`uri-id` = like_post.`thr-parent-id` AND + like_post.vid = ? AND + like_post.`author-id` != reply_post.`author-id` + ) AS post_meta +) AS reply_counts +', $contact_uid, $post_vid, $like_vid); + return $reply_guy_result; + } + + // https://stackoverflow.com/a/48283297/235936 + protected function sigFig($value, $digits) + { + if ($value == 0) { + $decimalPlaces = $digits - 1; + } elseif ($value < 0) { + $decimalPlaces = $digits - floor(log10($value * -1)) - 1; + } else { + $decimalPlaces = $digits - floor(log10($value)) - 1; + } + + $answer = ($decimalPlaces > 0) ? + number_format($value, $decimalPlaces) : round($value, $decimalPlaces); + return $answer; + } + + protected function fillReplyGuyData(&$user) + { + $reply_guy_result = $this->getReplyGuyRow($user['user_contact_uid']); + if (DBA::isResult($reply_guy_result)) { + $reply_guy_result_row = DBA::fetch($reply_guy_result); + $user['reply_count'] = (int) $reply_guy_result_row['replies_total'] ?? 0; + $user['reply_likes'] = (int) $reply_guy_result_row['like_total'] ?? 0; + $user['reply_respondee_likes'] = (int) $reply_guy_result_row['target_like_total'] ?? 0; + $user['reply_op_likes'] = (int) $reply_guy_result_row['original_like_total'] ?? 0; + + $denominator = $user['reply_likes'] + $user['reply_respondee_likes'] + $user['reply_op_likes']; + if ($user['reply_count'] === 0) { + $user['reply_guy'] = false; + $user['reply_guy_score'] = 0; + } elseif ($denominator == 0) { + $user['reply_guy'] = true; + $user['reply_guy_score'] = '∞'; + } else { + $reply_guy_score = $user['reply_count'] / $denominator; + $user['reply_guy'] = $reply_guy_score >= 1.0; + $user['reply_guy_score'] = $this->sigFig($reply_guy_score, 2); + } + } else { + $user['reply_count'] = "error"; + $user['reply_likes'] = "error"; + $user['reply_respondee_likes'] = "error"; + $user['reply_op_likes'] = "error"; + $user['reply_guy'] = false; + $user['reply_guy_score'] = 0; + } + } + + protected function setupUserCallback(): \Closure + { + DI::logger()->debug("ratioed: setupUserCallback"); + $parentCallback = parent::setupUserCallback(); + return function ($user) use ($parentCallback) { + $blocked_count = DBA::count('user-contact', ['uid' => $user['uid'], 'is-blocked' => 1]); + $user['blocked_by'] = $blocked_count; + + $self_contact_result = DBA::p('SELECT admin_contact.id AS user_contact_uid FROM contact AS admin_contact JOIN contact AS user_contact ON admin_contact.`uri-id` = user_contact.`uri-id` AND admin_contact.self = 0 AND user_contact.self = 1 WHERE user_contact.uid = ?', $user['uid']); + if (DBA::isResult($self_contact_result)) { + $self_contact_result_row = DBA::fetch($self_contact_result); + $user['user_contact_uid'] = $self_contact_result_row['user_contact_uid']; + } else { + $user['user_contact_uid'] = null; + } + + if ($user['user_contact_uid']) { + $post_engagement_result = DBA::p('SELECT SUM(`comments`) AS `comment_count`, SUM(`activities`) AS `activities_count` FROM `post-engagement` WHERE `post-engagement`.created > DATE_SUB(now(), INTERVAL 1 DAY) AND `post-engagement`.`owner-id` = ?', $user['user_contact_uid']); + if (DBA::isResult($post_engagement_result)) { + $post_engagement_result_row = DBA::fetch($post_engagement_result); + $user['comments'] = $post_engagement_result_row['comment_count']; + $user['reactions'] = $post_engagement_result_row['activities_count']; + if ($user['reactions'] > 0) { + $user['ratio'] = number_format($user['comments'] / $user['reactions'], 1, '.', ''); + $user['ratioed'] = (float)($user['ratio']) >= 2.0; + } else { + $user['reactions'] = 0; + if ($user['comments'] == 0) { + $user['comments'] = 0; + $user['ratio'] = 0; + $user['ratioed'] = false; + } else { + $user['ratio'] = '∞'; + $user['ratioed'] = false; + } + } + } else { + $user['comments'] = 'error'; + $user['reactions'] = 'error'; + $user['ratio'] = 'error'; + $user['ratioed'] = false; + } + } else { + $user['comments'] = 'error'; + $user['reactions'] = 'error'; + $user['ratio'] = 'error'; + $user['ratioed'] = false; + } + + $this->fillReplyGuyData($user); + + $user = $parentCallback($user); + DI::logger()->debug("ratioed: setupUserCallback", [ + 'uid' => $user['uid'], + 'blocked_by' => $user['blocked_by'], + 'comments' => $user['comments'], + 'reactions' => $user['reactions'], + 'ratio' => $user['ratio'], + 'ratioed' => $user['ratioed'], + ]); + return $user; + }; + } +} diff --git a/ratioed/lang/C/messages.po b/ratioed/lang/C/messages.po new file mode 100644 index 00000000..58e61175 --- /dev/null +++ b/ratioed/lang/C/messages.po @@ -0,0 +1,130 @@ +# ADDON ratioed +# Copyright (C) +# This file is distributed under the same license as the Friendica ratioed addon package. +# +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2025-11-08 13:50+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: RatioedPanel.php:34 +msgid "User not found" +msgstr "" + +#: RatioedPanel.php:69 +msgid "Name" +msgstr "" + +#: RatioedPanel.php:70 +msgid "Email" +msgstr "" + +#: RatioedPanel.php:71 +msgid "Register date" +msgstr "" + +#: RatioedPanel.php:72 +msgid "Last login" +msgstr "" + +#: RatioedPanel.php:73 +msgid "Last public item" +msgstr "" + +#: RatioedPanel.php:74 +msgid "Type" +msgstr "" + +#: RatioedPanel.php:75 +msgid "Blocked by" +msgstr "" + +#: RatioedPanel.php:76 +msgid "Comments last 24h" +msgstr "" + +#: RatioedPanel.php:77 +msgid "Reactions last 24h" +msgstr "" + +#: RatioedPanel.php:78 +msgid "Ratio last 24h" +msgstr "" + +#: RatioedPanel.php:79 +msgid "Replies last month" +msgstr "" + +#: RatioedPanel.php:80 +msgid "Reply likes" +msgstr "" + +#: RatioedPanel.php:81 +msgid "Respondee likes" +msgstr "" + +#: RatioedPanel.php:82 +msgid "OP likes" +msgstr "" + +#: RatioedPanel.php:83 +msgid "Reply guy score" +msgstr "" + +#: RatioedPanel.php:109 +msgid "Moderation" +msgstr "" + +#: RatioedPanel.php:111 ratioed.php:39 +msgid "Behaviour" +msgstr "" + +#: RatioedPanel.php:112 +msgid "select all" +msgstr "" + +#: RatioedPanel.php:113 +msgid "Delete" +msgstr "" + +#: RatioedPanel.php:114 +msgid "Block" +msgstr "" + +#: RatioedPanel.php:115 +msgid "User blocked" +msgstr "" + +#: RatioedPanel.php:116 +msgid "Site admin" +msgstr "" + +#: RatioedPanel.php:117 +msgid "Account expired" +msgstr "" + +#: RatioedPanel.php:118 +msgid "Create a new user" +msgstr "" + +#: RatioedPanel.php:124 +msgid "Selected users will be deleted!\\n\\nEverything these users had posted on this site will be permanently deleted!\\n\\nAre you sure?" +msgstr "" + +#: RatioedPanel.php:125 +msgid "The user {0} will be deleted!\\n\\nEverything this user has posted on this site will be permanently deleted!\\n\\nAre you sure?" +msgstr "" + +#: ratioed.php:42 +msgid "Statistics about users behaviour" +msgstr "" diff --git a/ratioed/ratioed.php b/ratioed/ratioed.php new file mode 100644 index 00000000..5cc6d539 --- /dev/null +++ b/ratioed/ratioed.php @@ -0,0 +1,57 @@ + + */ + +use Friendica\Addon\ratioed\RatioedPanel; +use Friendica\Core\Hook; +use Friendica\DI; + +/** + * Sets up the addon hooks and updates data in the database if needed + */ +function ratioed_install() +{ + Hook::register('moderation_users_tabs', 'addon/ratioed/ratioed.php', 'ratioed_users_tabs'); + + DI::logger()->info("ratioed: installed"); +} + +/** + * This is a statement rather than an actual function definition. The simple + * existence of this method is checked to figure out if the addon offers a + * module. + */ +function ratioed_module() {} + +/** + * @brief Adds additional users tab to the moderation panel + * + * @param array $arr Parameters, including "tabs" which is the list to modify, and "selectedTab", which is the currently selected tab ID + */ +function ratioed_users_tabs(array &$arr) { + DI::logger()->debug("ratioed: users tabs"); + + array_push($arr['tabs'], [ + 'label' => DI::l10n()->t('Behaviour'), + 'url' => 'ratioed', + 'sel' => $arr['selectedTab'] == 'ratioed' ? 'active' : '', + 'title' => DI::l10n()->t('Statistics about users behaviour'), + 'id' => 'admin-users-ratioed', + 'accesskey' => 'r', + ]); +} + +/** + * @brief Displays the ratioed tab in the moderation panel + */ +function ratioed_content() { + DI::logger()->debug("ratioed: content"); + + $ratioed = DI::getDice()->create(RatioedPanel::class, [$_SERVER]); + $httpException = DI::getDice()->create(Friendica\Module\Special\HTTPException::class); + $ratioed->run($httpException); +} diff --git a/ratioed/templates/help.tpl b/ratioed/templates/help.tpl new file mode 100644 index 00000000..0d012ca7 --- /dev/null +++ b/ratioed/templates/help.tpl @@ -0,0 +1,145 @@ +
+
+

Ratioed Plugin Help

+

+ This plugin provides moderators with additional statistics about + the behaviour of users. These may be useful as early warning signs + that warrant more carefully watching the behaviour of a user. They + are not suitable as a trigger for instantly blocking, + muting, or reporting a user, since they lack context. +

+

+ The name of the plugin comes + from "The + Ratio", a well-known quick rule of thumb: +

+
+ If the Replies:RT ratio is greater than 2:1, you done messed up. +
+

+ To "get ratioed" is to receive a large number of comments in a short + space of time, with relatively few likes or boosts. If commenters + were enthusiastic about the posts, they would also have liked or + boosted them. Receiving many comments without such likes or boosts + indicates the comments were probably angry. This anger may or may + not be justified, but either way this is probably something + moderators should be aware of. +

+

+ This plugin allows viewing of an actual ratio, calculated over the + last 24 hours. This is a useful timeframe for sudden dogpiling + events that moderators might not otherwise notice. The plugin + also calculates other statistics. +

+

Explanation of Statistics

+

Blocked by

+

+ This summarises the number of users on remote servers that have + blocked this user. +

+

+ Note that the ActivityPub spec expressly says that + implementations "SHOULD NOT" forward such block messages to + remote servers. Nevertheless some implementations do this + anyway, notably Mastodon. This statistic can only count block + messages from servers that do this, as well as blocks from local + users. As such, it is usually an undercount. +

+

+ The reason the spec recommends against forwarding these messages + is that they can lead to retaliation. For this reason, this + plugin deliberately does not provide any way to investigate + exactly who blocked the user. +

+

Comments last 24h

+

+ This gives the number of comments made on the top-level posts that + this user made within the last 24 hours. +

+

Reactions last 24h

+

+ This collects the number of likes, boosts, or other "one-click" + interactions made on the user's top-level posts within the last 24 + hours. +

+

Ratio last 24h

+

+ This is the ratio between "Comments last 24h" and "Reactions last + 24h". It is intended to approximate the traditional ratio as + understood on Twitter. +

+

Replies last month

+

+ This is the number of times the user posted a reply to someone + else, on a thread the user did not start, any time in the last + month. +

+

Reply likes

+

+ This is the number of likes received by the user on their + replies to other people's posts in the last month. Replies that + receive likes can be assumed to be more of a valuable + contribution than replies that do not. +

+

Respondee likes

+

+ The number of times in the last month the user replied to + someone else's comment and that person then liked the reply. + Likes to replies are not necessarily a positive thing, but if + the person you're replying to approves the reply, that's a very + good sign. Of course it's also common in a debate for neither + side to like the other side's comments without that indicating + an unhealthy interaction, so interpret this statistic cautiously. +

+

OP likes

+

+ The number of times in the last month the user replied on a + thread and the original poster that started the thread liked the + reply. While there is no formal concept of "ownership" of a + thread, conventionally the original poster is assumed to have + started the thread for a reason, and making replies that do not + fulfil that purpose are bad etiquette. Getting approval from + the original poster therefore is a good sign that the user is + posting replies that are wanted. +

+

Reply guy score

+

+ A "reply + guy" is a common Internet phenomenon of people + (disproportionately male) posting unwanted comments on other + (disproportionately female) people's threads, derailing the + conversation. This score loosely quantifies this phenomenon, + as the ratio betwen the number of replies and the sum of likes, + respondee likes, and OP likes. This formula gives extra weight + to particularly relevant likes: a reply to a top-level post that + is liked by the original poster scores the maximum of 3 + "points". A score above 1.0 might indicate cause for concern + for moderators. +

+

+ Since this is indicative of long-term behaviour, the score is + calculated over a month instead of 24 hours. +

+

+

Performance

+

+ The statistics are computed from scratch each time the page loads. + It's possible that this might put a heavy load on the database, and + the page may take a long time to load. +

+

Extending

+

+ Suggestions for additional statistics are welcome, especially from + moderators. This plugin should be considered a sandbox for + experimentation, so it is not necessary to prove that any statistic + is correlated with unwanted behaviour. +

+

+ However, this plugin does deal with potentially sensitive + information. Even if moderators do in principle have access to all + information, it should not necessarily be highlighted. Statistics + should be kept anonymous and neutral. Also, they should be + presented only to moderators, not to the users themselves. +

+
+
diff --git a/ratioed/templates/ratioed.tpl b/ratioed/templates/ratioed.tpl new file mode 100644 index 00000000..2413ed9d --- /dev/null +++ b/ratioed/templates/ratioed.tpl @@ -0,0 +1,131 @@ + + + +
+

+ {{$title}} - {{$page}} ({{$count}}) + +

+
+ + + + + + + {{foreach $th_users as $k=>$th}} + {{if $k < 2 || $order_users == $th.1 || ($k==4 && !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.5.1])) }} + + {{/if}} + {{/foreach}} + + + + + {{foreach $users as $u}} + + + + + + {{if $order_users == $th_users.2.1}} + + {{/if}} + + {{if $order_users == $th_users.3.1}} + + {{/if}} + + {{if $order_users == $th_users.5.1}} + + {{/if}} + + {{if !in_array($order_users,[$th_users.2.1, $th_users.3.1, $th_users.5.1]) }} + + {{/if}} + + + + + + + + + {{/foreach}} + +
+ + {{if $order_users == $th.1}} + {{if $order_direction_users == "+"}} + ↓ + {{else}} + ↑ + {{/if}} + {{else}} + ↕ + {{/if}} + {{$th.0}} + +
{{$u.name}}{{$u.email}}{{$u.register_date}}{{$u.login_date}} + + + {{if $u.page_flags_raw==0 && $u.account_type_raw > 0}} + + {{/if}} + {{if $u.is_admin}}{{/if}} + {{if $u.account_expired}}{{/if}} + {{$u.lastitem_date}} + +
+ {{$pager nofilter}} +
+
diff --git a/rendertime/lang/bg/messages.po b/rendertime/lang/bg/messages.po new file mode 100644 index 00000000..f55f683f --- /dev/null +++ b/rendertime/lang/bg/messages.po @@ -0,0 +1,53 @@ +# ADDON rendertime +# Copyright (C) +# This file is distributed under the same license as the Friendica rendertime addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-12 22:09+0000\n" +"PO-Revision-Date: 2014-06-23 12:36+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Bulgarian (http://app.transifex.com/Friendica/friendica/language/bg/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: bg\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: rendertime.php:30 +msgid "Save Settings" +msgstr "" + +#: rendertime.php:31 +msgid "Show callstack" +msgstr "" + +#: rendertime.php:31 +msgid "" +"Show detailed performance measures in the callstack. When deactivated, only " +"the summary will be displayed." +msgstr "" + +#: rendertime.php:32 +msgid "Minimal time" +msgstr "" + +#: rendertime.php:32 +msgid "Minimal time that an activity needs to be listed in the callstack." +msgstr "" + +#: rendertime.php:57 +#, php-format +msgid "" +"Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: " +"%s, Total: %s" +msgstr "" + +#: rendertime.php:74 +#, php-format +msgid "Class-Init: %s, Boot: %s, Init: %s, Content: %s, Other: %s, Total: %s" +msgstr "" diff --git a/rendertime/lang/bg/strings.php b/rendertime/lang/bg/strings.php new file mode 100644 index 00000000..d912b572 --- /dev/null +++ b/rendertime/lang/bg/strings.php @@ -0,0 +1,7 @@ +\n" +"Language-Team: Catalan (http://app.transifex.com/Friendica/friendica/language/ca/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ca\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: rendertime.php:30 +msgid "Save Settings" +msgstr "" + +#: rendertime.php:31 +msgid "Show callstack" +msgstr "" + +#: rendertime.php:31 +msgid "" +"Show detailed performance measures in the callstack. When deactivated, only " +"the summary will be displayed." +msgstr "" + +#: rendertime.php:32 +msgid "Minimal time" +msgstr "" + +#: rendertime.php:32 +msgid "Minimal time that an activity needs to be listed in the callstack." +msgstr "" + +#: rendertime.php:57 +#, php-format +msgid "" +"Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: " +"%s, Total: %s" +msgstr "" + +#: rendertime.php:74 +#, php-format +msgid "Class-Init: %s, Boot: %s, Init: %s, Content: %s, Other: %s, Total: %s" +msgstr "" diff --git a/rendertime/lang/ca/strings.php b/rendertime/lang/ca/strings.php index ab4fa67a..d34874f6 100644 --- a/rendertime/lang/ca/strings.php +++ b/rendertime/lang/ca/strings.php @@ -1,2 +1,7 @@ -\n" +"Language-Team: Esperanto (http://app.transifex.com/Friendica/friendica/language/eo/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: eo\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: rendertime.php:30 +msgid "Save Settings" +msgstr "" + +#: rendertime.php:31 +msgid "Show callstack" +msgstr "" + +#: rendertime.php:31 +msgid "" +"Show detailed performance measures in the callstack. When deactivated, only " +"the summary will be displayed." +msgstr "" + +#: rendertime.php:32 +msgid "Minimal time" +msgstr "" + +#: rendertime.php:32 +msgid "Minimal time that an activity needs to be listed in the callstack." +msgstr "" + +#: rendertime.php:57 +#, php-format +msgid "" +"Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: " +"%s, Total: %s" +msgstr "" + +#: rendertime.php:74 +#, php-format +msgid "Class-Init: %s, Boot: %s, Init: %s, Content: %s, Other: %s, Total: %s" +msgstr "" diff --git a/rendertime/lang/eo/strings.php b/rendertime/lang/eo/strings.php index ab4fa67a..68e8a64c 100644 --- a/rendertime/lang/eo/strings.php +++ b/rendertime/lang/eo/strings.php @@ -1,2 +1,7 @@ -\n" +"Language-Team: Estonian (http://app.transifex.com/Friendica/friendica/language/et/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: et\n" +"Plural-Forms: nplurals=2; plural=(n != 1);\n" + +#: rendertime.php:30 +msgid "Save Settings" +msgstr "" + +#: rendertime.php:31 +msgid "Show callstack" +msgstr "" + +#: rendertime.php:31 +msgid "" +"Show detailed performance measures in the callstack. When deactivated, only " +"the summary will be displayed." +msgstr "" + +#: rendertime.php:32 +msgid "Minimal time" +msgstr "" + +#: rendertime.php:32 +msgid "Minimal time that an activity needs to be listed in the callstack." +msgstr "" + +#: rendertime.php:57 +#, php-format +msgid "" +"Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: " +"%s, Total: %s" +msgstr "" + +#: rendertime.php:74 +#, php-format +msgid "Class-Init: %s, Boot: %s, Init: %s, Content: %s, Other: %s, Total: %s" +msgstr "" diff --git a/rendertime/lang/et/strings.php b/rendertime/lang/et/strings.php new file mode 100644 index 00000000..dfe78358 --- /dev/null +++ b/rendertime/lang/et/strings.php @@ -0,0 +1,7 @@ +, 2022 # Nicolas Derive, 2022 # Thecross, 2017 @@ -13,8 +14,8 @@ msgstr "" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-12-12 22:09+0000\n" "PO-Revision-Date: 2014-06-23 12:36+0000\n" -"Last-Translator: Nicolas Derive, 2022\n" -"Language-Team: French (http://www.transifex.com/Friendica/friendica/language/fr/)\n" +"Last-Translator: cracrayol, 2025\n" +"Language-Team: French (http://app.transifex.com/Friendica/friendica/language/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -23,7 +24,7 @@ msgstr "" #: rendertime.php:30 msgid "Save Settings" -msgstr "Enregistrer les paramètres" +msgstr "Sauvegarder les paramètres" #: rendertime.php:31 msgid "Show callstack" diff --git a/rendertime/lang/fr/strings.php b/rendertime/lang/fr/strings.php index d6aed6fa..2d21fdad 100644 --- a/rendertime/lang/fr/strings.php +++ b/rendertime/lang/fr/strings.php @@ -5,7 +5,7 @@ function string_plural_select_fr($n){ $n = intval($n); if (($n == 0 || $n == 1)) { return 0; } else if ($n != 0 && $n % 1000000 == 0) { return 1; } else { return 2; } }} -$a->strings['Save Settings'] = 'Enregistrer les paramètres'; +$a->strings['Save Settings'] = 'Sauvegarder les paramètres'; $a->strings['Show callstack'] = 'Afficher le callstack'; $a->strings['Show detailed performance measures in the callstack. When deactivated, only the summary will be displayed.'] = 'Affiche les performances détaillées dans le callstack. Si désactivé, seul le résumé sera affiché.'; $a->strings['Minimal time'] = 'Temps minimal'; diff --git a/rendertime/lang/gd/messages.po b/rendertime/lang/gd/messages.po new file mode 100644 index 00000000..9362eb06 --- /dev/null +++ b/rendertime/lang/gd/messages.po @@ -0,0 +1,53 @@ +# ADDON rendertime +# Copyright (C) +# This file is distributed under the same license as the Friendica rendertime addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-12 22:09+0000\n" +"PO-Revision-Date: 2014-06-23 12:36+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Gaelic, Scottish (http://app.transifex.com/Friendica/friendica/language/gd/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: gd\n" +"Plural-Forms: nplurals=4; plural=(n==1 || n==11) ? 0 : (n==2 || n==12) ? 1 : (n > 2 && n < 20) ? 2 : 3;\n" + +#: rendertime.php:30 +msgid "Save Settings" +msgstr "" + +#: rendertime.php:31 +msgid "Show callstack" +msgstr "" + +#: rendertime.php:31 +msgid "" +"Show detailed performance measures in the callstack. When deactivated, only " +"the summary will be displayed." +msgstr "" + +#: rendertime.php:32 +msgid "Minimal time" +msgstr "" + +#: rendertime.php:32 +msgid "Minimal time that an activity needs to be listed in the callstack." +msgstr "" + +#: rendertime.php:57 +#, php-format +msgid "" +"Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: " +"%s, Total: %s" +msgstr "" + +#: rendertime.php:74 +#, php-format +msgid "Class-Init: %s, Boot: %s, Init: %s, Content: %s, Other: %s, Total: %s" +msgstr "" diff --git a/rendertime/lang/gd/strings.php b/rendertime/lang/gd/strings.php new file mode 100644 index 00000000..dcbcfe0a --- /dev/null +++ b/rendertime/lang/gd/strings.php @@ -0,0 +1,7 @@ + 2 && $n < 20)) { return 2; } else { return 3; } +}} diff --git a/rendertime/lang/is/messages.po b/rendertime/lang/is/messages.po new file mode 100644 index 00000000..9812a11f --- /dev/null +++ b/rendertime/lang/is/messages.po @@ -0,0 +1,53 @@ +# ADDON rendertime +# Copyright (C) +# This file is distributed under the same license as the Friendica rendertime addon package. +# +# +# Translators: +msgid "" +msgstr "" +"Project-Id-Version: friendica\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2021-12-12 22:09+0000\n" +"PO-Revision-Date: 2014-06-23 12:36+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Icelandic (http://app.transifex.com/Friendica/friendica/language/is/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: is\n" +"Plural-Forms: nplurals=2; plural=(n % 10 != 1 || n % 100 == 11);\n" + +#: rendertime.php:30 +msgid "Save Settings" +msgstr "" + +#: rendertime.php:31 +msgid "Show callstack" +msgstr "" + +#: rendertime.php:31 +msgid "" +"Show detailed performance measures in the callstack. When deactivated, only " +"the summary will be displayed." +msgstr "" + +#: rendertime.php:32 +msgid "Minimal time" +msgstr "" + +#: rendertime.php:32 +msgid "Minimal time that an activity needs to be listed in the callstack." +msgstr "" + +#: rendertime.php:57 +#, php-format +msgid "" +"Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: " +"%s, Total: %s" +msgstr "" + +#: rendertime.php:74 +#, php-format +msgid "Class-Init: %s, Boot: %s, Init: %s, Content: %s, Other: %s, Total: %s" +msgstr "" diff --git a/rendertime/lang/is/strings.php b/rendertime/lang/is/strings.php index ab4fa67a..975c341e 100644 --- a/rendertime/lang/is/strings.php +++ b/rendertime/lang/is/strings.php @@ -1,2 +1,7 @@ -\n" +"Language-Team: Russian (http://app.transifex.com/Friendica/friendica/language/ru/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Language: ru\n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" + +#: rendertime.php:30 +msgid "Save Settings" +msgstr "" + +#: rendertime.php:31 +msgid "Show callstack" +msgstr "" + +#: rendertime.php:31 +msgid "" +"Show detailed performance measures in the callstack. When deactivated, only " +"the summary will be displayed." +msgstr "" + +#: rendertime.php:32 +msgid "Minimal time" +msgstr "" + +#: rendertime.php:32 +msgid "Minimal time that an activity needs to be listed in the callstack." +msgstr "" + +#: rendertime.php:57 +#, php-format +msgid "" +"Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: " +"%s, Total: %s" +msgstr "" + +#: rendertime.php:74 +#, php-format +msgid "Class-Init: %s, Boot: %s, Init: %s, Content: %s, Other: %s, Total: %s" +msgstr "" diff --git a/rendertime/lang/ru/strings.php b/rendertime/lang/ru/strings.php index ab4fa67a..0579fc21 100644 --- a/rendertime/lang/ru/strings.php +++ b/rendertime/lang/ru/strings.php @@ -1,2 +1,7 @@ -=2 && $n%10<=4 && ($n%100<12 || $n%100>14)) { return 1; } else if ($n%10==0 || ($n%10>=5 && $n%10<=9) || ($n%100>=11 && $n%100<=14)) { return 2; } else { return 3; } +}} diff --git a/rendertime/rendertime.php b/rendertime/rendertime.php index 731cf003..4523d911 100644 --- a/rendertime/rendertime.php +++ b/rendertime/rendertime.php @@ -7,7 +7,6 @@ * */ -use Friendica\App; use Friendica\Core\Hook; use Friendica\Core\Renderer; use Friendica\DI; @@ -60,7 +59,7 @@ function rendertime_page_end(string &$o) if (DI::userSession()->isSiteAdmin() && (($_GET['mode'] ?? '') != 'minimal') && !DI::mode()->isMobile() && !DI::mode()->isMobile() && !$ignored) { - $o = $o . '
' . DI::l10n()->t("Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: %s, Total: %s", + $o = $o . '