From db809d672d25f2d20581313f3265edfd694591a5 Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Wed, 21 Apr 2021 10:12:08 +0200 Subject: [PATCH 01/13] namespaces as import --- config/common.php | 268 +++++++++++++++++++++++++++------------------- 1 file changed, 157 insertions(+), 111 deletions(-) diff --git a/config/common.php b/config/common.php index a51558e..bca6473 100644 --- a/config/common.php +++ b/config/common.php @@ -1,5 +1,60 @@ [ 'log', 'redirects', - 'queue', + 'queue' ], 'aliases' => [ 'backend' => '@vendor/dmstr/yii2-backend-module/src', 'storage' => '/mnt/storage', 'bower' => '@vendor/bower-asset', - 'npm' => '@vendor/npm-asset', + 'npm' => '@vendor/npm-asset' ], 'params' => [ 'adminEmail' => getenv('APP_ADMIN_EMAIL'), @@ -77,87 +125,85 @@ 'defaultRoles' => ['Default'], 'cache' => 'cache' ], - Da\User\Controller\AdminController::class => [ - 'layout' => $boxLayout, + AdminController::class => [ + 'layout' => $boxLayout ], - Da\User\Controller\PermissionController::class => [ - 'layout' => $boxLayout, + PermissionController::class => [ + 'layout' => $boxLayout ], - Da\User\Controller\RoleController::class => [ - 'layout' => $boxLayout, + RoleController::class => [ + 'layout' => $boxLayout ], - Da\User\Controller\RuleController::class => [ - 'layout' => $boxLayout, + RuleController::class => [ + 'layout' => $boxLayout ] ] ], 'components' => [ 'assetManager' => [ 'dirMode' => 0775, - 'hashCallback' => getenv('APP_ASSET_FORCE_PUBLISH') ? - \dmstr\helpers\AssetHash::byFileTime(!YII_DEBUG) - : null, + 'hashCallback' => getenv('APP_ASSET_FORCE_PUBLISH') ? AssetHash::byFileTime(!YII_DEBUG) : null, // Note: You need to bundle asset with `yii asset` for development/debugging 'bundles' => $bundles, - 'basePath' => '@app/../web/assets/', + 'basePath' => '@app/../web/assets/' ], 'cache' => [ 'class' => getenv('APP_NO_CACHE') ? - \yii\caching\DummyCache::class : \yii\redis\Cache::class, + DummyCache::class : Cache::class ], 'db' => [ - 'class' => \yii\db\Connection::class, + 'class' => Connection::class, 'dsn' => getenv('DATABASE_DSN'), 'username' => getenv('DATABASE_USER'), 'password' => getenv('DATABASE_PASSWORD'), 'charset' => 'utf8', 'tablePrefix' => getenv('DATABASE_TABLE_PREFIX'), - 'enableSchemaCache' => !getenv('APP_DB_DISABLE_SCHEMA_CACHE'), + 'enableSchemaCache' => !getenv('APP_DB_DISABLE_SCHEMA_CACHE') ], 'fsLocal' => [ - 'class' => \creocoder\flysystem\LocalFilesystem::class, - 'path' => '@storage', + 'class' => LocalFilesystem::class, + 'path' => '@storage' ], 'fsS3' => [ - 'class' => \creocoder\flysystem\AwsS3Filesystem::class, + 'class' => AwsS3Filesystem::class, 'key' => getenv('AMAZON_S3_BUCKET_PUBLIC_KEY'), 'secret' => getenv('AMAZON_S3_BUCKET_SECRET_KEY'), 'bucket' => getenv('AMAZON_S3_BUCKET_NAME'), 'prefix' => getenv('APP_NAME') . '/public', - 'region' => getenv('AMAZON_S3_BUCKET_REGION'), + 'region' => getenv('AMAZON_S3_BUCKET_REGION') ], 'fsRuntime' => [ - 'class' => \creocoder\flysystem\LocalFilesystem::class, - 'path' => '@runtime', + 'class' => LocalFilesystem::class, + 'path' => '@runtime' ], 'i18n' => [ 'translations' => [ '*' => [ - 'class' => \yii\i18n\DbMessageSource::class, + 'class' => DbMessageSource::class, 'db' => 'db', 'sourceLanguage' => 'en', 'sourceMessageTable' => '{{%language_source}}', 'messageTable' => '{{%language_translate}}', 'cachingDuration' => 86400, - 'enableCaching' => !YII_ENV_DEV, - ], - ], + 'enableCaching' => !YII_ENV_DEV + ] + ] ], 'log' => [ 'traceLevel' => getenv('YII_TRACE_LEVEL') ?: 0, 'targets' => [ 'common' => [ - 'class' => \codemix\streamlog\Target::class, + 'class' => Target::class, 'url' => 'php://stderr', 'levels' => ['error', 'warning'], 'logVars' => [], - 'replaceNewline' => (APP_TYPE == 'console') ? null : '', - ], - ], + 'replaceNewline' => APP_TYPE === 'console' ? null : '' + ] + ] ], 'mailer' => [ - 'class' => \yii\swiftmailer\Mailer::class, + 'class' => Mailer::class, 'fileTransportPath' => '@runtime/mail', 'enableSwiftMailerLogging' => true, 'useFileTransport' => getenv('APP_MAILER_USE_FILE_TRANSPORT'), @@ -167,40 +213,40 @@ 'port' => getenv('APP_MAILER_PORT'), 'encryption' => getenv('APP_MAILER_ENCRYPTION'), 'username' => getenv('APP_MAILER_USERNAME'), - 'password' => getenv('APP_MAILER_PASSWORD'), + 'password' => getenv('APP_MAILER_PASSWORD') ], 'messageConfig' => [ 'charset' => 'UTF-8', 'returnPath' => getenv('APP_MAILER_RETURN_PATH'), - 'from' => [getenv('APP_MAILER_FROM') => getenv('APP_TITLE')], - ], + 'from' => [getenv('APP_MAILER_FROM') => getenv('APP_TITLE')] + ] ], 'queue' => [ - 'class' => \yii\queue\redis\Queue::class, + 'class' => Queue::class, 'channel' => getenv('APP_QUEUE_CHANNEL'), - 'as log' => \yii\queue\LogBehavior::class, - 'as queuemanager' => \ignatenkovnikita\queuemanager\behaviors\QueueManagerBehavior::class + 'as log' => LogBehavior::class, + 'as queuemanager' => QueueManagerBehavior::class ], 'redis' => [ 'class' => \yii\redis\Connection::class, 'hostname' => getenv('REDIS_PORT_6379_TCP_ADDR'), - 'port' => getenv('REDIS_PORT_6379_TCP_PORT'), + 'port' => getenv('REDIS_PORT_6379_TCP_PORT') ], 'session' => [ - 'class' => \yii\web\DbSession::class + 'class' => DbSession::class ], 'settings' => [ - 'class' => \pheme\settings\components\Settings::class + 'class' => Settings::class ], 'user' => [ - 'class' => \dmstr\web\User::class, + 'class' => User::class, 'enableAutoLogin' => true, 'loginUrl' => ['/user/security/login'], 'identityClass' => Da\User\Model\User::class, - 'rootUsers' => ['admin'], + 'rootUsers' => ['admin'] ], 'urlManager' => [ - 'class' => \codemix\localeurls\UrlManager::class, + 'class' => UrlManager::class, 'enablePrettyUrl' => getenv('APP_PRETTY_URLS'), 'showScriptName' => false, 'enableDefaultLanguageUrlCode' => true, @@ -208,33 +254,33 @@ 'rules' => [ [ 'class' => ImageUrlRule::class, - 'suffix' => ',p', - ], + 'suffix' => ',p' + ] ], 'ignoreLanguageUrlPatterns' => [ // route pattern => url pattern '#^img/stream#' => '#^img/stream#', - '#^filefly/api#' => '#^filefly/api#', + '#^filefly/api#' => '#^filefly/api#' ], - 'languages' => $languages, + 'languages' => $languages ], 'view' => [ - 'class' => 'yii\web\View', + 'class' => View::class, 'renderers' => [ 'twig' => [ - 'class' => \yii\twig\ViewRenderer::class, + 'class' => ViewRenderer::class, 'cachePath' => '@runtime/Twig/cache', 'options' => [ - 'auto_reload' => true, + 'auto_reload' => true ], 'globals' => [ - 'Html' => ['class' => \yii\helpers\Html::class], - 'Json' => ['class' => \yii\helpers\Json::class], - 'Tree' => ['class' => \dmstr\modules\pages\models\Tree::class], - 'FA' => ['class' => \rmrevin\yii\fontawesome\FA::class], + 'Html' => ['class' => Html::class], + 'Json' => ['class' => Json::class], + 'Tree' => ['class' => Tree::class], + 'FA' => ['class' => FA::class], 'FileUrl' => ['class' => \hrzg\filemanager\helpers\Url::class], - 'Url' => ['class' => \yii\helpers\Url::class], - 'Markdown' => ['class' => \yii\helpers\Markdown::class], + 'Url' => ['class' => Url::class], + 'Markdown' => ['class' => Markdown::class] ], 'functions' => [ 'image' => function ($imageSource, $preset = null) { @@ -260,37 +306,37 @@ }, 't' => function ($category, $message, $params = [], $language = null) { return Yii::t($category, $message, $params, $language); - }, + } ], 'uses' => [ - 'yii\bootstrap', - ], - ], - ], - ], + 'yii\bootstrap' + ] + ] + ] + ] ], 'modules' => [ 'audit' => [ - 'class' => \bedezign\yii2\audit\Audit::class, + 'class' => Audit::class, 'accessRoles' => ['audit-module'], 'layout' => $boxLayout, 'panels' => [ 'audit/trail' => [ - 'class' => \bedezign\yii2\audit\panels\TrailPanel::class, - 'maxAge' => null, + 'class' => TrailPanel::class, + 'maxAge' => null ], 'audit/mail' => [ - 'class' => \bedezign\yii2\audit\panels\MailPanel::class, - 'maxAge' => null, + 'class' => MailPanel::class, + 'maxAge' => null ], // Links the extra error reporting functions (`exception()` and `errorMessage()`) 'audit/error' => [ - 'class' => \bedezign\yii2\audit\panels\ErrorPanel::class, - 'maxAge' => 30, + 'class' => ErrorPanel::class, + 'maxAge' => 30 ], 'audit/extra' => [ - 'class' => \bedezign\yii2\audit\panels\ExtraDataPanel::class, - 'maxAge' => 30, + 'class' => ExtraDataPanel::class, + 'maxAge' => 30 ], // see https://github.com/bedezign/yii2-audit for detailed config ], @@ -304,62 +350,62 @@ 'debug/*', 'resque/*', 'db/create', - 'migrate/up', + 'migrate/up' ], - 'maxAge' => 7, + 'maxAge' => 7 ], 'backend' => [ - 'class' => \dmstr\modules\backend\Module::class, + 'class' => BackendModule::class, 'layout' => '@backend/views/layouts/main', 'modulesDashboardBlacklist' => [ 'noty', - 'treemanager', - ], + 'treemanager' + ] ], 'contact' => [ - 'class' => dmstr\modules\contact\Module::class + 'class' => ContactModule::class ], 'filefly' => [ - 'class' => \hrzg\filefly\Module::class, - 'layout' => '@backend/views/layouts/main', + 'class' => FileFlyModule::class, + 'layout' => $boxLayout, 'filesystem' => getenv('APP_FILEFLY_DEFAULT_FILESYSTEM'), 'filesystemComponents' => [ 's3' => 'fsS3', 'local' => 'fsLocal', - 'runtime' => 'fsRuntime', - ], + 'runtime' => 'fsRuntime' + ] ], 'gridview' => [ - 'class' => \kartik\grid\Module::class + 'class' => GridViewModule::class ], 'noty' => [ - 'class' => \lo\modules\noty\Module::class, + 'class' => NotyModule::class, ], 'queuemanager' => [ - 'class' => \ignatenkovnikita\queuemanager\QueueManager::class, - 'layout' => $boxLayout, + 'class' => QueueManagerModule::class, + 'layout' => $boxLayout ], 'pages' => [ - 'class' => \dmstr\modules\pages\Module::class, - 'layout' => '@backend/views/layouts/main', + 'class' => PagesModule::class, + 'layout' => $boxLayout ], 'prototype' => [ - 'class' => \dmstr\modules\prototype\Module::class, - 'layout' => $boxLayout, + 'class' => PrototypeModule::class, + 'layout' => $boxLayout ], 'publication' => [ - 'class' => dmstr\modules\publication\Module::class + 'class' => PublicationModule::class ], 'redirects' => [ - 'class' => \dmstr\modules\redirect\Module::class, - 'layout' => '@backend/views/layouts/main', + 'class' => RedirectModule::class, + 'layout' => $boxLayout ], 'resque' => [ - 'class' => \hrzg\resque\Module::class, - 'layout' => '@backend/views/layouts/main', + 'class' => ResqueModule::class, + 'layout' => $boxLayout ], 'translatemanager' => [ - 'class' => \lajax\translatemanager\Module::class, + 'class' => TranslatemanagerModule::class, 'layout' => $boxLayout, 'root' => '@app/views', 'tables' => [ @@ -381,10 +427,10 @@ ScannerDatabase::class ], 'allowedIPs' => ['*'], - 'roles' => ['translate-module'], + 'roles' => ['translate-module'] ], 'user' => [ - 'class' => Da\User\Module::class, + 'class' => UserModule::class, 'layout' => '@app/views/layouts/container', 'defaultRoute' => 'admin', 'administratorPermissionName' => 'user-module', @@ -393,15 +439,15 @@ 'enableRegistration' => getenv('APP_USER_ENABLE_REGISTRATION'), 'mailParams' => [ 'fromEmail' => getenv('APP_MAILER_FROM') - ], + ] ], 'widgets' => [ - 'class' => \hrzg\widget\Module::class, - 'layout' => '@backend/views/layouts/main', + 'class' => WidgetsModule::class, + 'layout' => $boxLayout, 'frontendRouteMap' => [ 'app/site/index' => '/', 'pages/default/page' => 'pages/default/page', - ], - ], - ], + ] + ] + ] ]; From 240386ad0545c3e5ddc5445f66a38544a9bc2fe6 Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Wed, 21 Apr 2021 10:13:32 +0200 Subject: [PATCH 02/13] bumped up to stable browser versions for browser support plugin --- config/common.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/common.php b/config/common.php index bca6473..c8017bc 100644 --- a/config/common.php +++ b/config/common.php @@ -109,11 +109,11 @@ 'context.menuItems' => [], 'backend.iframe.name' => getenv('APP_PARAMS_BACKEND_IFRAME_NAME') ?: '_self', 'backend.browserSupport' => [ - 'Chrome' => 72, + 'Chrome' => 87, 'Edge' => false, 'Safari' => false, 'MobileSafari' => false, - 'Firefox' => 65, + 'Firefox' => 88, 'Opera' => false, 'Vivaldi' => false, 'IE' => false From 81b3a96e107de0b2d215525847e1406c10d92227 Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Wed, 21 Apr 2021 10:14:17 +0200 Subject: [PATCH 03/13] added translation for noty module to fix bug --- config/common.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/config/common.php b/config/common.php index c8017bc..d8937d3 100644 --- a/config/common.php +++ b/config/common.php @@ -187,6 +187,14 @@ 'messageTable' => '{{%language_translate}}', 'cachingDuration' => 86400, 'enableCaching' => !YII_ENV_DEV + ], + 'noty' => [ + 'class' => DbMessageSource::class, + 'sourceLanguage' => 'xx-XX', + 'sourceMessageTable' => '{{%language_source}}', + 'messageTable' => '{{%language_translate}}', + 'cachingDuration' => 86400, + 'enableCaching' => !YII_ENV_DEV ] ] ], From 58c80167047429a9aa0cfc314186112b85e4994f Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Wed, 21 Apr 2021 10:31:41 +0200 Subject: [PATCH 04/13] removed old and deprecated method --- config/common.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config/common.php b/config/common.php index d8937d3..5424d18 100644 --- a/config/common.php +++ b/config/common.php @@ -75,7 +75,7 @@ $bundles = include Yii::getAlias('@web/bundles') . '/config.php'; // disable loading of bundles skin file, when using bundled assets Yii::$container->set( - AdminLteAsset::className(), + AdminLteAsset::class, [ 'skin' => false, ] @@ -286,7 +286,6 @@ 'Json' => ['class' => Json::class], 'Tree' => ['class' => Tree::class], 'FA' => ['class' => FA::class], - 'FileUrl' => ['class' => \hrzg\filemanager\helpers\Url::class], 'Url' => ['class' => Url::class], 'Markdown' => ['class' => Markdown::class] ], From 4ec7807509bbf28fe2e41479c2a572371d35ffce Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Wed, 21 Apr 2021 10:44:15 +0200 Subject: [PATCH 05/13] added more translation roots --- config/common.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/config/common.php b/config/common.php index 5424d18..9841fdc 100644 --- a/config/common.php +++ b/config/common.php @@ -1,6 +1,6 @@ [ 'audit' => [ - 'class' => Audit::class, + 'class' => AuditModule::class, 'accessRoles' => ['audit-module'], 'layout' => $boxLayout, 'panels' => [ @@ -414,7 +414,14 @@ 'translatemanager' => [ 'class' => TranslatemanagerModule::class, 'layout' => $boxLayout, - 'root' => '@app/views', + 'root' => [ + '@app/views', + '@vendor/loveorigami/yii2-notification-wrapper/src', + '@vendor/dmstr', + '@vendor/lajax/yii2-translate-manager', + '@vendor/bedezign/yii2-audit/src', + '@vendor/ignatenkovnikita/yii2-queuemanager' + ], 'tables' => [ [ 'connection' => 'db', From 7599b7879cfdeaf7d73a85773326f89dd1e67204 Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Wed, 21 Apr 2021 10:51:38 +0200 Subject: [PATCH 06/13] use db system --- config/common.php | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/config/common.php b/config/common.php index 9841fdc..82d9397 100644 --- a/config/common.php +++ b/config/common.php @@ -40,8 +40,9 @@ use lo\modules\noty\Module as NotyModule; use pheme\settings\components\Settings; use rmrevin\yii\fontawesome\FA; +use yii\caching\ArrayCache; use yii\caching\DummyCache; -use yii\db\Connection; +use yii\db\Connection as DbConnection; use yii\helpers\Html; use yii\helpers\Json; use yii\helpers\Markdown; @@ -50,6 +51,7 @@ use yii\queue\LogBehavior; use yii\queue\redis\Queue; use yii\redis\Cache; +use yii\redis\Connection as RedisConnection; use yii\swiftmailer\Mailer; use yii\twig\ViewRenderer; use yii\web\DbSession; @@ -147,13 +149,14 @@ 'bundles' => $bundles, 'basePath' => '@app/../web/assets/' ], - 'cache' => - [ - 'class' => getenv('APP_NO_CACHE') ? - DummyCache::class : Cache::class - ], + 'cache' => [ + 'class' => getenv('APP_NO_CACHE') ? DummyCache::class : Cache::class + ], + 'cacheSystem' => [ + 'class' => ArrayCache::class + ], 'db' => [ - 'class' => Connection::class, + 'class' => DbConnection::class, 'dsn' => getenv('DATABASE_DSN'), 'username' => getenv('DATABASE_USER'), 'password' => getenv('DATABASE_PASSWORD'), @@ -161,6 +164,16 @@ 'tablePrefix' => getenv('DATABASE_TABLE_PREFIX'), 'enableSchemaCache' => !getenv('APP_DB_DISABLE_SCHEMA_CACHE') ], + 'dbSystem' => [ + 'class' => DbConnection::class, + 'dsn' => getenv('DATABASE_DSN'), + 'username' => getenv('DATABASE_USER'), + 'password' => getenv('DATABASE_PASSWORD'), + 'charset' => 'utf8', + 'tablePrefix' => getenv('DATABASE_TABLE_PREFIX'), + 'enableSchemaCache' => true, + 'schemaCache' => 'cacheSystem' + ], 'fsLocal' => [ 'class' => LocalFilesystem::class, 'path' => '@storage' @@ -182,7 +195,7 @@ '*' => [ 'class' => DbMessageSource::class, 'db' => 'db', - 'sourceLanguage' => 'en', + 'sourceLanguage' => 'xx-XX', 'sourceMessageTable' => '{{%language_source}}', 'messageTable' => '{{%language_translate}}', 'cachingDuration' => 86400, @@ -236,12 +249,13 @@ 'as queuemanager' => QueueManagerBehavior::class ], 'redis' => [ - 'class' => \yii\redis\Connection::class, + 'class' => RedisConnection::class, 'hostname' => getenv('REDIS_PORT_6379_TCP_ADDR'), 'port' => getenv('REDIS_PORT_6379_TCP_PORT') ], 'session' => [ - 'class' => DbSession::class + 'class' => DbSession::class, + 'db' => 'dbSystem' ], 'settings' => [ 'class' => Settings::class @@ -344,7 +358,7 @@ 'audit/extra' => [ 'class' => ExtraDataPanel::class, 'maxAge' => 30 - ], + ] // see https://github.com/bedezign/yii2-audit for detailed config ], 'ignoreActions' => [ @@ -359,7 +373,8 @@ 'db/create', 'migrate/up' ], - 'maxAge' => 7 + 'maxAge' => 7, + 'db' => 'dbSystem' ], 'backend' => [ 'class' => BackendModule::class, From 25241fef73095721aa5fd8205c7a26c2f5db0ecd Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Wed, 21 Apr 2021 10:54:23 +0200 Subject: [PATCH 07/13] secure cookies via env --- config/common.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/config/common.php b/config/common.php index 82d9397..d82d7d0 100644 --- a/config/common.php +++ b/config/common.php @@ -54,6 +54,7 @@ use yii\redis\Connection as RedisConnection; use yii\swiftmailer\Mailer; use yii\twig\ViewRenderer; +use yii\web\Cookie; use yii\web\DbSession; use yii\web\View; @@ -84,6 +85,8 @@ ); } +$isHttps = getenv('HTTPS') === 'on'; + $boxLayout = '@backend/views/layouts/box'; // Basic configuration, used in web and console applications @@ -138,6 +141,9 @@ ], RuleController::class => [ 'layout' => $boxLayout + ], + Cookie::class => [ + 'secure' => $isHttps ] ] ], @@ -255,7 +261,10 @@ ], 'session' => [ 'class' => DbSession::class, - 'db' => 'dbSystem' + 'db' => 'dbSystem', + 'cookieParams' => [ + 'secure' => $isHttps + ] ], 'settings' => [ 'class' => Settings::class @@ -284,7 +293,10 @@ '#^img/stream#' => '#^img/stream#', '#^filefly/api#' => '#^filefly/api#' ], - 'languages' => $languages + 'languages' => $languages, + 'languageCookieOptions' => [ + 'secure' => $isHttps + ] ], 'view' => [ 'class' => View::class, From bebe6a6da8c5aecf9daf73d669ee44d98e9ccaee Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Wed, 21 Apr 2021 11:10:21 +0200 Subject: [PATCH 08/13] use helper for twig image url helper --- config/common.php | 21 +-- src/composer.lock | 307 ++++++++++++++++++++++++++++------------- src/composer.phd5.json | 1 + 3 files changed, 213 insertions(+), 116 deletions(-) diff --git a/config/common.php b/config/common.php index d82d7d0..8e1b828 100644 --- a/config/common.php +++ b/config/common.php @@ -26,6 +26,7 @@ use dmstr\modules\redirect\Module as RedirectModule; use dmstr\web\AdminLteAsset; use dmstr\web\User; +use dmstr\willnorrisImageproxy\Url as ImageUrlHelper; use hrzg\filefly\components\ImageUrlRule; use hrzg\filefly\Module as FileFlyModule; use hrzg\resque\Module as ResqueModule; @@ -317,25 +318,7 @@ ], 'functions' => [ 'image' => function ($imageSource, $preset = null) { - // sanitize input - $preset = trim($preset, "/"); - $baseUrl = trim(Yii::$app->settings->get('imgBaseUrl', 'app.frontend'), "/"); - $prefix = trim(Yii::$app->settings->get('imgHostPrefix', 'app.frontend'), "/"); - $imageSourceFull = $imageSource . Yii::$app->settings->get('imgHostSuffix', 'app.frontend'); - - // build remote URL - $remoteUrl = implode('/', array_filter([$prefix, $imageSourceFull])); - - // add HMAC sign key to preset when using imageproxy, see also https://github.com/willnorris/imageproxy#examples - if (getenv('IMAGEPROXY_SIGNATURE_KEY')) { - $key = getenv('IMAGEPROXY_SIGNATURE_KEY'); - $preset .= ',s' . strtr( - base64_encode(hash_hmac('sha256', $remoteUrl, $key, 1)), - '/+', - '_-' - ); - } - return implode('/', array_filter([$baseUrl, $preset, $remoteUrl])); + return ImageUrlHelper::image($imageSource, $preset); }, 't' => function ($category, $message, $params = [], $language = null) { return Yii::t($category, $message, $params, $language); diff --git a/src/composer.lock b/src/composer.lock index acd0a60..6a5ceef 100644 --- a/src/composer.lock +++ b/src/composer.lock @@ -356,16 +356,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.174.1", + "version": "3.178.6", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "b481fd0dab83b9ed6eab35279e1a43e3a875c87e" + "reference": "0aa83b522d5ffa794c02e7411af87a0e241a3082" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/b481fd0dab83b9ed6eab35279e1a43e3a875c87e", - "reference": "b481fd0dab83b9ed6eab35279e1a43e3a875c87e", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/0aa83b522d5ffa794c02e7411af87a0e241a3082", + "reference": "0aa83b522d5ffa794c02e7411af87a0e241a3082", "shasum": "" }, "require": { @@ -437,7 +437,7 @@ "s3", "sdk" ], - "time": "2021-03-16T18:18:56+00:00" + "time": "2021-04-19T18:13:17+00:00" }, { "name": "bedezign/yii2-audit", @@ -2588,6 +2588,49 @@ ], "time": "2020-07-03T08:29:15+00:00" }, + { + "name": "dmstr/yii2-willnorris-imageproxy", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/dmstr/yii2-willnorris-imageproxy.git", + "reference": "4dc9401f7cae1aa55ef2e4c02c3b389487f63afb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dmstr/yii2-willnorris-imageproxy/zipball/4dc9401f7cae1aa55ef2e4c02c3b389487f63afb", + "reference": "4dc9401f7cae1aa55ef2e4c02c3b389487f63afb", + "shasum": "" + }, + "require": { + "php": "^7.3" + }, + "require-dev": { + "phan/phan": "^2.4", + "phpunit/phpunit": "^9.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "dmstr\\willnorrisImageproxy\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "description": "_____", + "homepage": "https://www.dmstr.io/", + "keywords": [ + "_____" + ], + "time": "2020-05-11T14:42:25+00:00" + }, { "name": "doctrine/lexer", "version": "1.2.1", @@ -2696,16 +2739,16 @@ }, { "name": "egulias/email-validator", - "version": "3.1.0", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/egulias/EmailValidator.git", - "reference": "62c3b73c581c834885acf6e120b412b76acc495a" + "reference": "c81f18a3efb941d8c4d2e025f6183b5c6d697307" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/62c3b73c581c834885acf6e120b412b76acc495a", - "reference": "62c3b73c581c834885acf6e120b412b76acc495a", + "url": "https://api.github.com/repos/egulias/EmailValidator/zipball/c81f18a3efb941d8c4d2e025f6183b5c6d697307", + "reference": "c81f18a3efb941d8c4d2e025f6183b5c6d697307", "shasum": "" }, "require": { @@ -2756,7 +2799,7 @@ "type": "github" } ], - "time": "2021-03-07T14:33:28+00:00" + "time": "2021-04-01T18:37:14+00:00" }, { "name": "eluhr/yii2-aceeditor", @@ -3017,16 +3060,16 @@ }, { "name": "guzzlehttp/psr7", - "version": "1.7.0", + "version": "1.8.1", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3" + "reference": "35ea11d335fd638b5882ff1725228b3d35496ab1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/53330f47520498c0ae1f61f7e2c90f55690c06a3", - "reference": "53330f47520498c0ae1f61f7e2c90f55690c06a3", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/35ea11d335fd638b5882ff1725228b3d35496ab1", + "reference": "35ea11d335fd638b5882ff1725228b3d35496ab1", "shasum": "" }, "require": { @@ -3084,7 +3127,7 @@ "uri", "url" ], - "time": "2020-09-30T07:37:11+00:00" + "time": "2021-03-21T16:25:00+00:00" }, { "name": "ignatenkovnikita/yii2-queuemanager", @@ -3517,16 +3560,16 @@ }, { "name": "kartik-v/yii2-krajee-base", - "version": "v2.0.5", + "version": "v2.0.6", "source": { "type": "git", "url": "https://github.com/kartik-v/yii2-krajee-base.git", - "reference": "9ddb662bdf49fdb671a90853912a40418a26a0dd" + "reference": "9b6bc8335e8e561e3953826efefd57b1df7bdce0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/9ddb662bdf49fdb671a90853912a40418a26a0dd", - "reference": "9ddb662bdf49fdb671a90853912a40418a26a0dd", + "url": "https://api.github.com/repos/kartik-v/yii2-krajee-base/zipball/9b6bc8335e8e561e3953826efefd57b1df7bdce0", + "reference": "9b6bc8335e8e561e3953826efefd57b1df7bdce0", "shasum": "" }, "suggest": { @@ -3565,7 +3608,7 @@ "widget", "yii2" ], - "time": "2019-03-13T17:14:54+00:00" + "time": "2021-04-08T18:07:22+00:00" }, { "name": "kartik-v/yii2-mpdf", @@ -4936,16 +4979,16 @@ }, { "name": "opis/closure", - "version": "3.6.1", + "version": "3.6.2", "source": { "type": "git", "url": "https://github.com/opis/closure.git", - "reference": "943b5d70cc5ae7483f6aff6ff43d7e34592ca0f5" + "reference": "06e2ebd25f2869e54a306dda991f7db58066f7f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/opis/closure/zipball/943b5d70cc5ae7483f6aff6ff43d7e34592ca0f5", - "reference": "943b5d70cc5ae7483f6aff6ff43d7e34592ca0f5", + "url": "https://api.github.com/repos/opis/closure/zipball/06e2ebd25f2869e54a306dda991f7db58066f7f6", + "reference": "06e2ebd25f2869e54a306dda991f7db58066f7f6", "shasum": "" }, "require": { @@ -4993,7 +5036,7 @@ "serialization", "serialize" ], - "time": "2020-11-07T02:01:34+00:00" + "time": "2021-04-09T13:42:10+00:00" }, { "name": "paragonie/random_compat", @@ -5226,16 +5269,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "2.0.30", + "version": "2.0.31", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "136b9ca7eebef78be14abf90d65c5e57b6bc5d36" + "reference": "233a920cb38636a43b18d428f9a8db1f0a1a08f4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/136b9ca7eebef78be14abf90d65c5e57b6bc5d36", - "reference": "136b9ca7eebef78be14abf90d65c5e57b6bc5d36", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/233a920cb38636a43b18d428f9a8db1f0a1a08f4", + "reference": "233a920cb38636a43b18d428f9a8db1f0a1a08f4", "shasum": "" }, "require": { @@ -5327,7 +5370,7 @@ "type": "tidelift" } ], - "time": "2020-12-17T05:42:04+00:00" + "time": "2021-04-06T13:56:45+00:00" }, { "name": "phpspec/php-diff", @@ -5711,12 +5754,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "fe6ef201f838f07770873731a99f359ebb64fa50" + "reference": "593c4de369ca852cf3b86037f19435d47c136448" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/fe6ef201f838f07770873731a99f359ebb64fa50", - "reference": "fe6ef201f838f07770873731a99f359ebb64fa50", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/593c4de369ca852cf3b86037f19435d47c136448", + "reference": "593c4de369ca852cf3b86037f19435d47c136448", "shasum": "" }, "conflict": { @@ -5760,7 +5803,7 @@ "doctrine/doctrine-module": "<=0.7.1", "doctrine/mongodb-odm": ">=1,<1.0.2", "doctrine/mongodb-odm-bundle": ">=2,<3.0.1", - "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1", + "doctrine/orm": ">=2,<2.4.8|>=2.5,<2.5.1|>=2.8.3,<2.8.4", "dolibarr/dolibarr": "<11.0.4", "dompdf/dompdf": ">=0.6,<0.6.2", "drupal/core": ">=7,<7.74|>=8,<8.8.11|>=8.9,<8.9.9|>=9,<9.0.8", @@ -5775,18 +5818,19 @@ "ezsystems/ezplatform": ">=1.7,<1.7.9.1|>=1.13,<1.13.5.1|>=2.5,<2.5.4", "ezsystems/ezplatform-admin-ui": ">=1.3,<1.3.5|>=1.4,<1.4.6", "ezsystems/ezplatform-admin-ui-assets": ">=4,<4.2.1|>=5,<5.0.1|>=5.1,<5.1.1", - "ezsystems/ezplatform-kernel": ">=1,<1.0.2.1", + "ezsystems/ezplatform-kernel": "<=1.2.5|>=1.3,<=1.3.1", "ezsystems/ezplatform-rest": ">=1.2,<=1.2.2|>=1.3,<=1.3.1", "ezsystems/ezplatform-user": ">=1,<1.0.1", - "ezsystems/ezpublish-kernel": ">=5.3,<5.3.12.1|>=5.4,<5.4.14.2|>=6,<6.7.9.1|>=6.8,<=6.13.8|>=7,<7.2.4.1|>=7.3,<7.3.2.1|>=7.5,<=7.5.15", + "ezsystems/ezpublish-kernel": "<=6.13.8.1|>=7,<=7.5.15.1", "ezsystems/ezpublish-legacy": ">=5.3,<5.3.12.6|>=5.4,<5.4.14.2|>=2011,<2017.12.7.3|>=2018.6,<2018.6.1.4|>=2018.9,<2018.9.1.3|>=2019.3,<2019.3.5.1", "ezsystems/platform-ui-assets-bundle": ">=4.2,<4.2.3", "ezsystems/repository-forms": ">=2.3,<2.3.2.1", "ezyang/htmlpurifier": "<4.1.1", - "facade/ignition": "<=2.5.1,>=2.0|<=1.16.13", + "facade/ignition": "<1.16.14|>=2,<2.4.2|>=2.5,<2.5.2", "firebase/php-jwt": "<2", "flarum/sticky": ">=0.1-beta.14,<=0.1-beta.15", "flarum/tags": "<=0.1-beta.13", + "fluidtypo3/vhs": "<5.1.1", "fooman/tcpdf": "<6.2.22", "fossar/tcpdf-parser": "<6.2.22", "friendsofsymfony/oauth2-php": "<1.3", @@ -5794,7 +5838,7 @@ "friendsofsymfony/user-bundle": ">=1.2,<1.3.5", "friendsoftypo3/mediace": ">=7.6.2,<7.6.5", "fuel/core": "<1.8.1", - "getgrav/grav": "<1.7-beta.8", + "getgrav/grav": "<1.7.11", "getkirby/cms": ">=3,<3.4.5", "getkirby/panel": "<2.5.14", "gos/web-socket-bundle": "<1.10.4|>=2,<2.6.1|>=3,<3.3", @@ -5826,11 +5870,15 @@ "magento/magento1ee": ">=1,<1.14.4.3", "magento/product-community-edition": ">=2,<2.2.10|>=2.3,<2.3.2-p.2", "marcwillmann/turn": "<0.3.3", - "mautic/core": "<2.16.5|>=3,<3.2.4|= 2.13.1", + "mautic/core": "<3.3.2|= 2.13.1", "mediawiki/core": ">=1.27,<1.27.6|>=1.29,<1.29.3|>=1.30,<1.30.2|>=1.31,<1.31.9|>=1.32,<1.32.6|>=1.32.99,<1.33.3|>=1.33.99,<1.34.3|>=1.34.99,<1.35", "mittwald/typo3_forum": "<1.2.1", "monolog/monolog": ">=1.8,<1.12", + "moodle/moodle": "<3.5.17|>=3.7,<3.7.9|>=3.8,<3.8.8|>=3.9,<3.9.5|>=3.10,<3.10.2", "namshi/jose": "<2.2", + "neos/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.12|>=3.1,<3.1.10|>=3.2,<3.2.13|>=3.3,<3.3.13|>=4,<4.0.6", + "neos/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<2.9.99|>=3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<3.3.23|>=4,<4.0.17|>=4.1,<4.1.16|>=4.2,<4.2.12|>=4.3,<4.3.3", + "neos/swiftmailer": ">=4.1,<4.1.99|>=5.4,<5.4.5", "nette/application": ">=2,<2.0.19|>=2.1,<2.1.13|>=2.2,<2.2.10|>=2.3,<2.3.14|>=2.4,<2.4.16|>=3,<3.0.6", "nette/nette": ">=2,<2.0.19|>=2.1,<2.1.13", "nystudio107/craft-seomatic": "<3.3", @@ -5859,21 +5907,25 @@ "phpmyadmin/phpmyadmin": "<4.9.6|>=5,<5.0.3", "phpoffice/phpexcel": "<1.8.2", "phpoffice/phpspreadsheet": "<1.16", + "phpseclib/phpseclib": "<2.0.31|>=3,<3.0.7", "phpunit/phpunit": ">=4.8.19,<4.8.28|>=5.0.10,<5.6.3", "phpwhois/phpwhois": "<=4.2.5", "phpxmlrpc/extras": "<0.6.1", "pimcore/pimcore": "<6.8.8", "pocketmine/pocketmine-mp": "<3.15.4", + "pressbooks/pressbooks": "<5.18", "prestashop/autoupgrade": ">=4,<4.10.1", "prestashop/contactform": ">1.0.1,<4.3", "prestashop/gamification": "<2.3.2", "prestashop/productcomments": ">=4,<4.2.1", + "prestashop/ps_emailsubscription": "<2.6.1", "prestashop/ps_facetedsearch": "<3.4.1", "privatebin/privatebin": "<1.2.2|>=1.3,<1.3.2", "propel/propel": ">=2-alpha.1,<=2-alpha.7", "propel/propel1": ">=1,<=1.7.1", "pterodactyl/panel": "<0.7.19|>=1-rc.0,<=1-rc.6", "pusher/pusher-php-server": "<2.2.1", + "pwweb/laravel-core": "<=0.3.6-beta", "rainlab/debugbar-plugin": "<3.1", "robrichards/xmlseclibs": "<3.0.4", "sabberworm/php-css-parser": ">=1,<1.0.1|>=2,<2.0.1|>=3,<3.0.1|>=4,<4.0.1|>=5,<5.0.9|>=5.1,<5.1.3|>=5.2,<5.2.1|>=6,<6.0.2|>=7,<7.0.4|>=8,<8.0.1|>=8.1,<8.1.1|>=8.2,<8.2.1|>=8.3,<8.3.1", @@ -5881,8 +5933,9 @@ "scheb/two-factor-bundle": ">=0,<3.26|>=4,<4.11", "sensiolabs/connect": "<4.2.3", "serluck/phpwhois": "<=4.2.6", - "shopware/core": "<=6.3.4", - "shopware/platform": "<=6.3.5.1", + "shopware/core": "<=6.3.5.2", + "shopware/platform": "<=6.3.5.2", + "shopware/production": "<=6.3.5.2", "shopware/shopware": "<5.6.9", "silverstripe/admin": ">=1.0.3,<1.0.4|>=1.1,<1.1.1", "silverstripe/assets": ">=1,<1.4.7|>=1.5,<1.5.2", @@ -5956,16 +6009,20 @@ "truckersmp/phpwhois": "<=4.3.1", "twig/twig": "<1.38|>=2,<2.7", "typo3/cms": ">=6.2,<6.2.30|>=7,<7.6.32|>=8,<8.7.38|>=9,<9.5.25|>=10,<10.4.14|>=11,<11.1.1", - "typo3/cms-core": ">=8,<8.7.38|>=9,<9.5.25|>=10,<10.4.14|>=11,<11.1.1", - "typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.10|>=3.1,<3.1.7|>=3.2,<3.2.7|>=3.3,<3.3.5", - "typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4", + "typo3/cms-backend": ">=7,<=7.6.50|>=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", + "typo3/cms-core": ">=6.2,<=6.2.56|>=7,<=7.6.50|>=8,<=8.7.39|>=9,<9.5.25|>=10,<10.4.14|>=11,<11.1.1", + "typo3/cms-form": ">=8,<=8.7.39|>=9,<=9.5.24|>=10,<=10.4.13|>=11,<=11.1", + "typo3/flow": ">=1,<1.0.4|>=1.1,<1.1.1|>=2,<2.0.1|>=2.3,<2.3.16|>=3,<3.0.12|>=3.1,<3.1.10|>=3.2,<3.2.13|>=3.3,<3.3.13|>=4,<4.0.6", + "typo3/neos": ">=1.1,<1.1.3|>=1.2,<1.2.13|>=2,<2.0.4|>=2.3,<2.3.99|>=3,<3.0.20|>=3.1,<3.1.18|>=3.2,<3.2.14|>=3.3,<3.3.23|>=4,<4.0.17|>=4.1,<4.1.16|>=4.2,<4.2.12|>=4.3,<4.3.3", "typo3/phar-stream-wrapper": ">=1,<2.1.1|>=3,<3.1.1", + "typo3/swiftmailer": ">=4.1,<4.1.99|>=5.4,<5.4.5", "typo3fluid/fluid": ">=2,<2.0.8|>=2.1,<2.1.7|>=2.2,<2.2.4|>=2.3,<2.3.7|>=2.4,<2.4.4|>=2.5,<2.5.11|>=2.6,<2.6.10", "ua-parser/uap-php": "<3.8", "usmanhalalit/pixie": "<1.0.3|>=2,<2.0.2", "verot/class.upload.php": "<=1.0.3|>=2,<=2.0.4", "vrana/adminer": "<4.7.9", "wallabag/tcpdf": "<6.2.22", + "wikimedia/parsoid": "<0.12.2", "willdurand/js-translation-bundle": "<2.1.1", "yii2mod/yii2-cms": "<1.9.2", "yiisoft/yii": ">=1.1.14,<1.1.15", @@ -6031,7 +6088,7 @@ "type": "tidelift" } ], - "time": "2021-03-16T14:08:12+00:00" + "time": "2021-04-16T20:01:44+00:00" }, { "name": "sabre/dav", @@ -8914,16 +8971,16 @@ }, { "name": "composer/xdebug-handler", - "version": "1.4.5", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/composer/xdebug-handler.git", - "reference": "f28d44c286812c714741478d968104c5e604a1d4" + "reference": "31d57697eb1971712a08031cfaff5a846d10bdf5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/f28d44c286812c714741478d968104c5e604a1d4", - "reference": "f28d44c286812c714741478d968104c5e604a1d4", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/31d57697eb1971712a08031cfaff5a846d10bdf5", + "reference": "31d57697eb1971712a08031cfaff5a846d10bdf5", "shasum": "" }, "require": { @@ -8931,7 +8988,8 @@ "psr/log": "^1.0" }, "require-dev": { - "phpunit/phpunit": "^4.8.35 || ^5.7 || 6.5 - 8" + "phpstan/phpstan": "^0.12.55", + "symfony/phpunit-bridge": "^4.2 || ^5" }, "type": "library", "autoload": { @@ -8954,7 +9012,21 @@ "Xdebug", "performance" ], - "time": "2020-11-13T08:04:11+00:00" + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2021-04-09T19:40:06+00:00" }, { "name": "doctrine/annotations", @@ -9141,20 +9213,22 @@ }, { "name": "fakerphp/faker", - "version": "v1.13.0", + "version": "v1.14.1", "source": { "type": "git", "url": "https://github.com/FakerPHP/Faker.git", - "reference": "ab3f5364d01f2c2c16113442fb987d26e4004913" + "reference": "ed22aee8d17c7b396f74a58b1e7fefa4f90d5ef1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/ab3f5364d01f2c2c16113442fb987d26e4004913", - "reference": "ab3f5364d01f2c2c16113442fb987d26e4004913", + "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/ed22aee8d17c7b396f74a58b1e7fefa4f90d5ef1", + "reference": "ed22aee8d17c7b396f74a58b1e7fefa4f90d5ef1", "shasum": "" }, "require": { - "php": "^7.1 || ^8.0" + "php": "^7.1 || ^8.0", + "psr/container": "^1.0", + "symfony/deprecation-contracts": "^2.2" }, "conflict": { "fzaninotto/faker": "*" @@ -9162,9 +9236,20 @@ "require-dev": { "bamarni/composer-bin-plugin": "^1.4.1", "ext-intl": "*", - "phpunit/phpunit": "^7.5.20 || ^8.5.8 || ^9.4.2" + "symfony/phpunit-bridge": "^4.4 || ^5.2" + }, + "suggest": { + "ext-curl": "Required by Faker\\Provider\\Image to download images.", + "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.", + "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.", + "ext-mbstring": "Required for multibyte Unicode string functionality." }, "type": "library", + "extra": { + "branch-alias": { + "dev-main": "v1.15-dev" + } + }, "autoload": { "psr-4": { "Faker\\": "src/Faker/" @@ -9185,25 +9270,25 @@ "faker", "fixtures" ], - "time": "2020-12-18T16:50:48+00:00" + "time": "2021-03-30T06:27:33+00:00" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v2.18.3", + "version": "v2.18.6", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "ab99202fccff2a9f97592fbe1b5c76dd06df3513" + "reference": "5fed214993e7863cef88a08f214344891299b9e4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/ab99202fccff2a9f97592fbe1b5c76dd06df3513", - "reference": "ab99202fccff2a9f97592fbe1b5c76dd06df3513", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/5fed214993e7863cef88a08f214344891299b9e4", + "reference": "5fed214993e7863cef88a08f214344891299b9e4", "shasum": "" }, "require": { "composer/semver": "^1.4 || ^2.0 || ^3.0", - "composer/xdebug-handler": "^1.2", + "composer/xdebug-handler": "^1.2 || ^2.0", "doctrine/annotations": "^1.2", "ext-json": "*", "ext-tokenizer": "*", @@ -9285,7 +9370,7 @@ "type": "github" } ], - "time": "2021-03-10T19:39:05+00:00" + "time": "2021-04-19T19:45:11+00:00" }, { "name": "phar-io/manifest", @@ -10661,16 +10746,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.5.8", + "version": "3.6.0", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "9d583721a7157ee997f235f327de038e7ea6dac4" + "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4", - "reference": "9d583721a7157ee997f235f327de038e7ea6dac4", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625", + "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625", "shasum": "" }, "require": { @@ -10708,7 +10793,7 @@ "phpcs", "standards" ], - "time": "2020-10-23T02:01:07+00:00" + "time": "2021-04-09T00:54:41+00:00" }, { "name": "symfony/browser-kit", @@ -10780,16 +10865,16 @@ }, { "name": "symfony/console", - "version": "v4.4.20", + "version": "v4.4.21", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "c98349bda966c70d6c08b4cd8658377c94166492" + "reference": "1ba4560dbbb9fcf5ae28b61f71f49c678086cf23" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/c98349bda966c70d6c08b4cd8658377c94166492", - "reference": "c98349bda966c70d6c08b4cd8658377c94166492", + "url": "https://api.github.com/repos/symfony/console/zipball/1ba4560dbbb9fcf5ae28b61f71f49c678086cf23", + "reference": "1ba4560dbbb9fcf5ae28b61f71f49c678086cf23", "shasum": "" }, "require": { @@ -10862,7 +10947,7 @@ "type": "tidelift" } ], - "time": "2021-02-22T18:44:15+00:00" + "time": "2021-03-26T09:23:24+00:00" }, { "name": "symfony/css-selector", @@ -10928,16 +11013,16 @@ }, { "name": "symfony/deprecation-contracts", - "version": "v2.2.0", + "version": "v2.4.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665" + "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5fa56b4074d1ae755beb55617ddafe6f5d78f665", - "reference": "5fa56b4074d1ae755beb55617ddafe6f5d78f665", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", + "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", "shasum": "" }, "require": { @@ -10946,7 +11031,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-main": "2.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -10974,7 +11059,21 @@ ], "description": "A generic function and convention to trigger deprecation notices", "homepage": "https://symfony.com", - "time": "2020-09-07T11:33:47+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": "2021-03-23T23:28:01+00:00" }, { "name": "symfony/dom-crawler", @@ -11190,16 +11289,16 @@ }, { "name": "symfony/filesystem", - "version": "v5.2.4", + "version": "v5.2.6", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "710d364200997a5afde34d9fe57bd52f3cc1e108" + "reference": "8c86a82f51658188119e62cff0a050a12d09836f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/710d364200997a5afde34d9fe57bd52f3cc1e108", - "reference": "710d364200997a5afde34d9fe57bd52f3cc1e108", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/8c86a82f51658188119e62cff0a050a12d09836f", + "reference": "8c86a82f51658188119e62cff0a050a12d09836f", "shasum": "" }, "require": { @@ -11245,7 +11344,7 @@ "type": "tidelift" } ], - "time": "2021-02-12T10:38:38+00:00" + "time": "2021-03-28T14:30:26+00:00" }, { "name": "symfony/finder", @@ -11580,21 +11679,21 @@ }, { "name": "symfony/service-contracts", - "version": "v2.2.0", + "version": "v2.4.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1" + "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d15da7ba4957ffb8f1747218be9e1a121fd298a1", - "reference": "d15da7ba4957ffb8f1747218be9e1a121fd298a1", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", + "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", "shasum": "" }, "require": { "php": ">=7.2.5", - "psr/container": "^1.0" + "psr/container": "^1.1" }, "suggest": { "symfony/service-implementation": "" @@ -11602,7 +11701,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "2.2-dev" + "dev-main": "2.4-dev" }, "thanks": { "name": "symfony/contracts", @@ -11638,7 +11737,21 @@ "interoperability", "standards" ], - "time": "2020-09-07T11:33:47+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": "2021-04-01T10:43:52+00:00" }, { "name": "symfony/stopwatch", @@ -11701,16 +11814,16 @@ }, { "name": "symfony/yaml", - "version": "v4.4.20", + "version": "v4.4.21", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "29e61305e1c79d25f71060903982ead8f533e267" + "reference": "3871c720871029f008928244e56cf43497da7e9d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/29e61305e1c79d25f71060903982ead8f533e267", - "reference": "29e61305e1c79d25f71060903982ead8f533e267", + "url": "https://api.github.com/repos/symfony/yaml/zipball/3871c720871029f008928244e56cf43497da7e9d", + "reference": "3871c720871029f008928244e56cf43497da7e9d", "shasum": "" }, "require": { @@ -11765,7 +11878,7 @@ "type": "tidelift" } ], - "time": "2021-02-22T15:36:50+00:00" + "time": "2021-03-05T17:58:50+00:00" }, { "name": "theseer/tokenizer", diff --git a/src/composer.phd5.json b/src/composer.phd5.json index 2661b7e..953493c 100644 --- a/src/composer.phd5.json +++ b/src/composer.phd5.json @@ -20,6 +20,7 @@ "dmstr/yii2-publication-module": "^1.0.0-rc1", "dmstr/yii2-resque-module": "^2.0.0-alpha2", "dmstr/yii2-widgets2-module": "^2.2.0-rc1", + "dmstr/yii2-willnorris-imageproxy": "^1.0.0", "ignatenkovnikita/yii2-queuemanager": "^0.1.0", "league/flysystem-aws-s3-v3": "^1.0", "loveorigami/yii2-notification-wrapper": "^6.7.1", From 136e4a875e500153a4fe4a412b0a599c8d956b09 Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Wed, 21 Apr 2021 11:13:34 +0200 Subject: [PATCH 09/13] ability to use a secure db connection --- config/common.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/config/common.php b/config/common.php index 8e1b828..8205805 100644 --- a/config/common.php +++ b/config/common.php @@ -14,6 +14,7 @@ use Da\User\Controller\PermissionController; use Da\User\Controller\RoleController; use Da\User\Controller\RuleController; +use Da\User\Model\User as UserModel; use Da\User\Module as UserModule; use dmstr\helpers\AssetHash; use dmstr\lajax\translatemanager\services\scanners\ScannerDatabase; @@ -88,6 +89,14 @@ $isHttps = getenv('HTTPS') === 'on'; +$dbAttributes = [ + PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => 0 +]; + +if (getenv('MYSQL_ATTR_SSL_CA')) { + $dbAttributes[PDO::MYSQL_ATTR_SSL_CA] = getenv('MYSQL_ATTR_SSL_CA'); +} + $boxLayout = '@backend/views/layouts/box'; // Basic configuration, used in web and console applications @@ -169,7 +178,8 @@ 'password' => getenv('DATABASE_PASSWORD'), 'charset' => 'utf8', 'tablePrefix' => getenv('DATABASE_TABLE_PREFIX'), - 'enableSchemaCache' => !getenv('APP_DB_DISABLE_SCHEMA_CACHE') + 'enableSchemaCache' => !getenv('APP_DB_DISABLE_SCHEMA_CACHE'), + 'attributes' => $dbAttributes ], 'dbSystem' => [ 'class' => DbConnection::class, @@ -179,7 +189,8 @@ 'charset' => 'utf8', 'tablePrefix' => getenv('DATABASE_TABLE_PREFIX'), 'enableSchemaCache' => true, - 'schemaCache' => 'cacheSystem' + 'schemaCache' => 'cacheSystem', + 'attributes' => $dbAttributes ], 'fsLocal' => [ 'class' => LocalFilesystem::class, @@ -274,7 +285,7 @@ 'class' => User::class, 'enableAutoLogin' => true, 'loginUrl' => ['/user/security/login'], - 'identityClass' => Da\User\Model\User::class, + 'identityClass' => UserModel::class, 'rootUsers' => ['admin'] ], 'urlManager' => [ From 63fa4f10a9d23129b73a810d57ead1b2eadfce99 Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Wed, 21 Apr 2021 11:19:23 +0200 Subject: [PATCH 10/13] enable gdpr compliance for user module --- config/common.php | 1 + 1 file changed, 1 insertion(+) diff --git a/config/common.php b/config/common.php index 8205805..7f79a29 100644 --- a/config/common.php +++ b/config/common.php @@ -467,6 +467,7 @@ 'user' => [ 'class' => UserModule::class, 'layout' => '@app/views/layouts/container', + 'enableGdprCompliance' => true, 'defaultRoute' => 'admin', 'administratorPermissionName' => 'user-module', 'administrators' => ['admin'], From db55a10ebd28da653c94a55da43834f7bbb9c0cc Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Wed, 21 Apr 2021 11:22:20 +0200 Subject: [PATCH 11/13] improved alias --- config/common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/common.php b/config/common.php index 7f79a29..e4993ea 100644 --- a/config/common.php +++ b/config/common.php @@ -163,7 +163,7 @@ 'hashCallback' => getenv('APP_ASSET_FORCE_PUBLISH') ? AssetHash::byFileTime(!YII_DEBUG) : null, // Note: You need to bundle asset with `yii asset` for development/debugging 'bundles' => $bundles, - 'basePath' => '@app/../web/assets/' + 'basePath' => '@web/assets/' ], 'cache' => [ 'class' => getenv('APP_NO_CACHE') ? DummyCache::class : Cache::class From 7ef4c06045bf2f66cecc8183156b30ce47e3f7f5 Mon Sep 17 00:00:00 2001 From: Elias Luhr Date: Wed, 21 Apr 2021 11:55:11 +0200 Subject: [PATCH 12/13] cleanup imports, added translations and general cleanup --- config/common.php | 2 +- src/assets/AppAsset.php | 17 +++++---- src/assets/AppJsAsset.php | 17 +++++---- src/commands/AppController.php | 13 ++++--- src/controllers/ErrorController.php | 13 ++++--- src/controllers/SiteController.php | 10 +++--- src/views/error/index.php | 27 ++++++-------- src/views/layouts/_modal.php | 2 +- src/views/layouts/_navbar.php | 40 ++++++++++++++------- src/views/layouts/container-fluid.php | 18 ++++++---- src/views/layouts/container.php | 17 +++++---- src/views/layouts/main.php | 51 ++++++++++++++------------- src/views/layouts/plain.php | 17 ++++----- src/views/site/index.php | 7 ++-- 14 files changed, 139 insertions(+), 112 deletions(-) diff --git a/config/common.php b/config/common.php index e4993ea..7f79a29 100644 --- a/config/common.php +++ b/config/common.php @@ -163,7 +163,7 @@ 'hashCallback' => getenv('APP_ASSET_FORCE_PUBLISH') ? AssetHash::byFileTime(!YII_DEBUG) : null, // Note: You need to bundle asset with `yii asset` for development/debugging 'bundles' => $bundles, - 'basePath' => '@web/assets/' + 'basePath' => '@app/../web/assets/' ], 'cache' => [ 'class' => getenv('APP_NO_CACHE') ? DummyCache::class : Cache::class diff --git a/src/assets/AppAsset.php b/src/assets/AppAsset.php index f9492ad..d6f0846 100644 --- a/src/assets/AppAsset.php +++ b/src/assets/AppAsset.php @@ -1,20 +1,23 @@ stdout('Application Version: '); $this->stdout(getenv('APP_NAME') . ' '); - $this->stdout(APP_VERSION); - echo "\n"; + $this->stdout(APP_VERSION . "\n"); } /** @@ -84,7 +83,7 @@ public function actionSetup() $adminPassword = $this->prompt( 'Enter admin password', [ - 'default' => getenv('APP_ADMIN_PASSWORD') ?: \Yii::$app->security->generateRandomString(8), + 'default' => getenv('APP_ADMIN_PASSWORD') ?: Yii::$app->security->generateRandomString(8), ] ); $this->run('user/create', [getenv('APP_ADMIN_EMAIL'), 'admin', $adminPassword]); @@ -111,7 +110,7 @@ public function actionCleanup() */ public function actionClearAssets() { - $assets = \Yii::getAlias('@web/assets'); + $assets = Yii::getAlias('@web/assets'); // Matches from 7-8 char folder names, the 8. char is optional $matchRegex = '"^[a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9][a-z0-9]\?[a-z0-9]$"'; @@ -128,10 +127,10 @@ public function actionClearAssets() if ($delete) { // Try to execute $command if ($command->execute()) { - echo "Web assets have been deleted.\n\n"; + $this->stdout("Web assets have been deleted.\n\n"); } else { - echo "\n" . $command->getError() . "\n"; - echo $command->getStdErr(); + $this->stderr("\n" . $command->getError() . "\n"); + $this->stderr($command->getStdErr()); } } } diff --git a/src/controllers/ErrorController.php b/src/controllers/ErrorController.php index 58ed1df..e3ef35c 100644 --- a/src/controllers/ErrorController.php +++ b/src/controllers/ErrorController.php @@ -1,8 +1,5 @@ [ - 'class' => 'yii\web\ErrorAction', - ], + 'class' => ErrorAction::class, + ] ]; } } diff --git a/src/controllers/SiteController.php b/src/controllers/SiteController.php index 002e027..9d8811a 100644 --- a/src/controllers/SiteController.php +++ b/src/controllers/SiteController.php @@ -1,8 +1,5 @@ where(['domain_id' => 'root']); + $rootNodeQuery = Tree::find()->where(['domain_id' => 'root']); $rootNode = $rootNodeQuery->one(); return $this->run('/pages/default/page', ['pageId' => $rootNode->id]); } diff --git a/src/views/error/index.php b/src/views/error/index.php index e8b70be..ea53e84 100644 --- a/src/views/error/index.php +++ b/src/views/error/index.php @@ -8,6 +8,7 @@ * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code */ + use yii\helpers\Html; /* @var $this yii\web\View */ @@ -17,23 +18,17 @@ $this->title = $name; ?> -
- -

title) ?>

+
+
+

title) ?>

-
- -
+
+ +
-

- The above error occurred while the Web server was processing your request. -

-

- Please contact us if you think this is a server error. Thank you. -

- -

- homeUrl) ?> -

+

+

+

homeUrl) ?>

+
diff --git a/src/views/layouts/_modal.php b/src/views/layouts/_modal.php index 12dfebb..5165cd7 100644 --- a/src/views/layouts/_modal.php +++ b/src/views/layouts/_modal.php @@ -8,7 +8,7 @@