@@ -16,12 +16,12 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | // Load default settings via dotenv from file, load local environment first, if available |
| 18 | 18 | if (getenv('ENV_LOCAL_FILE')) { |
| 19 | - $localEnv = FileHelper::normalizePath($configPath . '/' . getenv('ENV_LOCAL_FILE')); |
|
| 19 | + $localEnv = FileHelper::normalizePath($configPath.'/'.getenv('ENV_LOCAL_FILE')); |
|
| 20 | 20 | if (is_file($localEnv)) { |
| 21 | 21 | $dotenvLocal = Dotenv::createUnsafeImmutable($configPath, getenv('ENV_LOCAL_FILE')); |
| 22 | 22 | $dotenvLocal->load(); |
| 23 | 23 | } else { |
| 24 | - exit("Error: ENV_LOCAL_FILE '{$localEnv}' not found" . PHP_EOL); |
|
| 24 | + exit("Error: ENV_LOCAL_FILE '{$localEnv}' not found".PHP_EOL); |
|
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | 27 | |
@@ -30,8 +30,8 @@ discard block |
||
| 30 | 30 | $dotenv->load(); |
| 31 | 31 | |
| 32 | 32 | // Basic checks & validation |
| 33 | -$dotenv->required('YII_DEBUG', ['', '0', '1', 'true', true]); |
|
| 34 | -$dotenv->required('YII_ENV', ['dev', 'prod', 'test']); |
|
| 33 | +$dotenv->required('YII_DEBUG', [ '', '0', '1', 'true', true ]); |
|
| 34 | +$dotenv->required('YII_ENV', [ 'dev', 'prod', 'test' ]); |
|
| 35 | 35 | $dotenv->required([ |
| 36 | 36 | 'YII_TRACE_LEVEL', |
| 37 | 37 | 'APP_NAME', |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | $languages = explode(',', getenv('APP_LANGUAGES')); |
| 78 | 78 | |
| 79 | 79 | // prepare asset bundle config |
| 80 | -$bundles = []; |
|
| 80 | +$bundles = [ ]; |
|
| 81 | 81 | if (getenv('APP_ASSET_USE_BUNDLED')) { |
| 82 | 82 | // include generated asset-bundle configuration |
| 83 | - $bundles = include Yii::getAlias('@web/bundles') . '/config.php'; |
|
| 83 | + $bundles = include Yii::getAlias('@web/bundles').'/config.php'; |
|
| 84 | 84 | // disable loading of bundles skin file, when using bundled assets |
| 85 | 85 | Yii::$container->set( |
| 86 | 86 | AdminLteAsset::class, |
@@ -97,18 +97,18 @@ discard block |
||
| 97 | 97 | PDO::MYSQL_ATTR_SSL_VERIFY_SERVER_CERT => 0 |
| 98 | 98 | ]; |
| 99 | 99 | if (getenv('MYSQL_ATTR_SSL_CA')) { |
| 100 | - $dbAttributes[PDO::MYSQL_ATTR_SSL_CA] = getenv('MYSQL_ATTR_SSL_CA'); |
|
| 100 | + $dbAttributes[ PDO::MYSQL_ATTR_SSL_CA ] = getenv('MYSQL_ATTR_SSL_CA'); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | // update Redis increment counter according to queue_manager db (workaround) |
| 104 | -Event::on(Queue::class, Queue::EVENT_BEFORE_PUSH, function ($event) { |
|
| 104 | +Event::on(Queue::class, Queue::EVENT_BEFORE_PUSH, function($event) { |
|
| 105 | 105 | if (Yii::$app->cache->get('queue_id_synced') !== true) { |
| 106 | 106 | $lastQueueIdSql = <<<SQL |
| 107 | 107 | SELECT `AUTO_INCREMENT` |
| 108 | 108 | FROM INFORMATION_SCHEMA.TABLES |
| 109 | 109 | WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = '{table_prefix}queue_manager' |
| 110 | 110 | SQL; |
| 111 | - $lastModelId = Yii::$app->db->createCommand($lastQueueIdSql, ['{table_prefix}'=>getenv('DATABASE_TABLE_PREFIX')])->queryScalar(); |
|
| 111 | + $lastModelId = Yii::$app->db->createCommand($lastQueueIdSql, [ '{table_prefix}'=>getenv('DATABASE_TABLE_PREFIX') ])->queryScalar(); |
|
| 112 | 112 | Yii::$app->redis->set("queue.message_id", $lastModelId); |
| 113 | 113 | Yii::$app->cache->set('queue_id_synced', true); |
| 114 | 114 | Yii::info("Synced redis queue id with database ($lastModelId)"); |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | return [ |
| 122 | 122 | 'id' => 'app', |
| 123 | 123 | 'name' => getenv('APP_TITLE'), |
| 124 | - 'language' => $languages[0], |
|
| 124 | + 'language' => $languages[ 0 ], |
|
| 125 | 125 | 'basePath' => '@app', |
| 126 | 126 | 'vendorPath' => '@root/vendor', |
| 127 | 127 | 'runtimePath' => '@root/runtime', |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | ], |
| 140 | 140 | 'params' => [ |
| 141 | 141 | 'adminEmail' => getenv('APP_ADMIN_EMAIL'), |
| 142 | - 'context.menuItems' => [], |
|
| 142 | + 'context.menuItems' => [ ], |
|
| 143 | 143 | 'backend.iframe.name' => getenv('APP_PARAMS_BACKEND_IFRAME_NAME') ?: '_self', |
| 144 | 144 | 'backend.browserSupport' => [ |
| 145 | 145 | 'Chrome' => 87, |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | 'container' => [ |
| 156 | 156 | 'definitions' => [ |
| 157 | 157 | AuthDbManagerComponent::class => [ |
| 158 | - 'defaultRoles' => ['Default'], |
|
| 158 | + 'defaultRoles' => [ 'Default' ], |
|
| 159 | 159 | 'cache' => 'cache' |
| 160 | 160 | ], |
| 161 | 161 | AdminController::class => [ |
@@ -179,12 +179,12 @@ discard block |
||
| 179 | 179 | 'rules' => [ |
| 180 | 180 | [ |
| 181 | 181 | 'allow' => true, |
| 182 | - 'actions' => ['index'], |
|
| 183 | - 'roles' => ['@'], |
|
| 182 | + 'actions' => [ 'index' ], |
|
| 183 | + 'roles' => [ '@' ], |
|
| 184 | 184 | ], |
| 185 | 185 | [ |
| 186 | 186 | 'allow' => true, |
| 187 | - 'actions' => ['show'], |
|
| 187 | + 'actions' => [ 'show' ], |
|
| 188 | 188 | // allow for all logged in users |
| 189 | 189 | #'roles' => ['@'], |
| 190 | 190 | // allow only if user has 'user' grant or requested his own profile (check by user->id) |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | if (\Yii::$app->user->can('user')) { |
| 196 | 196 | return true; |
| 197 | 197 | } |
| 198 | - if (\Yii::$app->user->id === (int)Yii::$app->request->getQueryParam('id')) { |
|
| 198 | + if (\Yii::$app->user->id === (int) Yii::$app->request->getQueryParam('id')) { |
|
| 199 | 199 | return true; |
| 200 | 200 | } |
| 201 | 201 | return false; |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | 'converter' => [ |
| 217 | 217 | 'class' => 'yii\web\AssetConverter', |
| 218 | 218 | 'commands' => [ |
| 219 | - 'less' => ['css', 'nodepkg-linuxstatic lessc {from} {to} --no-color --source-map'], |
|
| 219 | + 'less' => [ 'css', 'nodepkg-linuxstatic lessc {from} {to} --no-color --source-map' ], |
|
| 220 | 220 | ], |
| 221 | 221 | ], |
| 222 | 222 | ], |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | 'key' => getenv('AMAZON_S3_BUCKET_PUBLIC_KEY'), |
| 257 | 257 | 'secret' => getenv('AMAZON_S3_BUCKET_SECRET_KEY'), |
| 258 | 258 | 'bucket' => getenv('AMAZON_S3_BUCKET_NAME'), |
| 259 | - 'prefix' => getenv('APP_NAME') . '/public', |
|
| 259 | + 'prefix' => getenv('APP_NAME').'/public', |
|
| 260 | 260 | 'region' => getenv('AMAZON_S3_BUCKET_REGION') |
| 261 | 261 | ], |
| 262 | 262 | 'fsRuntime' => [ |
@@ -303,8 +303,8 @@ discard block |
||
| 303 | 303 | 'common' => [ |
| 304 | 304 | 'class' => Target::class, |
| 305 | 305 | 'url' => 'php://stderr', |
| 306 | - 'levels' => ['error', 'warning'], |
|
| 307 | - 'logVars' => [], |
|
| 306 | + 'levels' => [ 'error', 'warning' ], |
|
| 307 | + 'logVars' => [ ], |
|
| 308 | 308 | 'replaceNewline' => APP_TYPE === 'console' ? null : '' |
| 309 | 309 | ] |
| 310 | 310 | ] |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | 'transport' => [ |
| 317 | 317 | 'scheme' => getenv('APP_MAILER_SCHEME') ?: 'smtp', |
| 318 | 318 | 'host' => getenv('APP_MAILER_HOST'), |
| 319 | - 'port' => (int)getenv('APP_MAILER_PORT'), |
|
| 319 | + 'port' => (int) getenv('APP_MAILER_PORT'), |
|
| 320 | 320 | 'encryption' => getenv('APP_MAILER_ENCRYPTION'), |
| 321 | 321 | 'username' => getenv('APP_MAILER_USERNAME'), |
| 322 | 322 | 'password' => getenv('APP_MAILER_PASSWORD') |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | 'charset' => 'UTF-8', |
| 326 | 326 | 'replyTo' => getenv('APP_MAILER_REPLY_TO'), |
| 327 | 327 | 'returnPath' => getenv('APP_MAILER_RETURN_PATH'), |
| 328 | - 'from' => [getenv('APP_MAILER_FROM') => getenv('APP_TITLE')] |
|
| 328 | + 'from' => [ getenv('APP_MAILER_FROM') => getenv('APP_TITLE') ] |
|
| 329 | 329 | ] |
| 330 | 330 | ], |
| 331 | 331 | 'queue' => [ |
@@ -352,9 +352,9 @@ discard block |
||
| 352 | 352 | 'user' => [ |
| 353 | 353 | 'class' => User::class, |
| 354 | 354 | 'enableAutoLogin' => true, |
| 355 | - 'loginUrl' => ['/user/security/login'], |
|
| 355 | + 'loginUrl' => [ '/user/security/login' ], |
|
| 356 | 356 | 'identityClass' => UserModel::class, |
| 357 | - 'rootUsers' => ['admin'] |
|
| 357 | + 'rootUsers' => [ 'admin' ] |
|
| 358 | 358 | ], |
| 359 | 359 | 'urlManager' => [ |
| 360 | 360 | 'class' => UrlManager::class, |
@@ -389,18 +389,18 @@ discard block |
||
| 389 | 389 | 'auto_reload' => true |
| 390 | 390 | ], |
| 391 | 391 | 'globals' => [ |
| 392 | - 'Html' => ['class' => Html::class], |
|
| 393 | - 'Json' => ['class' => Json::class], |
|
| 394 | - 'Tree' => ['class' => Tree::class], |
|
| 395 | - 'FA' => ['class' => FA::class], |
|
| 396 | - 'Url' => ['class' => Url::class], |
|
| 397 | - 'Markdown' => ['class' => Markdown::class] |
|
| 392 | + 'Html' => [ 'class' => Html::class ], |
|
| 393 | + 'Json' => [ 'class' => Json::class ], |
|
| 394 | + 'Tree' => [ 'class' => Tree::class ], |
|
| 395 | + 'FA' => [ 'class' => FA::class ], |
|
| 396 | + 'Url' => [ 'class' => Url::class ], |
|
| 397 | + 'Markdown' => [ 'class' => Markdown::class ] |
|
| 398 | 398 | ], |
| 399 | 399 | 'functions' => [ |
| 400 | - 'image' => function ($imageSource, $preset = null) { |
|
| 400 | + 'image' => function($imageSource, $preset = null) { |
|
| 401 | 401 | return ImageUrlHelper::image($imageSource, $preset); |
| 402 | 402 | }, |
| 403 | - 't' => function ($category, $message, $params = [], $language = null) { |
|
| 403 | + 't' => function($category, $message, $params = [ ], $language = null) { |
|
| 404 | 404 | return Yii::t($category, $message, $params, $language); |
| 405 | 405 | } |
| 406 | 406 | ], |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | 'modules' => [ |
| 415 | 415 | 'audit' => [ |
| 416 | 416 | 'class' => AuditModule::class, |
| 417 | - 'accessRoles' => ['audit-module'], |
|
| 417 | + 'accessRoles' => [ 'audit-module' ], |
|
| 418 | 418 | 'layout' => $boxLayout, |
| 419 | 419 | 'panels' => [ |
| 420 | 420 | 'audit/trail' => [ |
@@ -516,12 +516,12 @@ discard block |
||
| 516 | 516 | [ |
| 517 | 517 | 'connection' => 'db', |
| 518 | 518 | 'table' => '{{%hrzg_widget_template}}', |
| 519 | - 'columns' => ['twig_template'] |
|
| 519 | + 'columns' => [ 'twig_template' ] |
|
| 520 | 520 | ], |
| 521 | 521 | [ |
| 522 | 522 | 'connection' => 'db', |
| 523 | 523 | 'table' => '{{%twig}}', |
| 524 | - 'columns' => ['value'] |
|
| 524 | + 'columns' => [ 'value' ] |
|
| 525 | 525 | ] |
| 526 | 526 | ], |
| 527 | 527 | 'scanners' => [ |
@@ -530,8 +530,8 @@ discard block |
||
| 530 | 530 | ScannerJavaScriptFunction::class, |
| 531 | 531 | ScannerDatabase::class |
| 532 | 532 | ], |
| 533 | - 'allowedIPs' => ['*'], |
|
| 534 | - 'roles' => ['translate-module'] |
|
| 533 | + 'allowedIPs' => [ '*' ], |
|
| 534 | + 'roles' => [ 'translate-module' ] |
|
| 535 | 535 | ], |
| 536 | 536 | 'user' => [ |
| 537 | 537 | 'class' => UserModule::class, |
@@ -539,12 +539,12 @@ discard block |
||
| 539 | 539 | 'enableGdprCompliance' => true, |
| 540 | 540 | 'defaultRoute' => 'admin', |
| 541 | 541 | 'administratorPermissionName' => 'user-module', |
| 542 | - 'administrators' => ['admin'], |
|
| 542 | + 'administrators' => [ 'admin' ], |
|
| 543 | 543 | 'enableFlashMessages' => false, |
| 544 | 544 | 'generatePasswords' => true, |
| 545 | 545 | 'enableRegistration' => getenv('APP_USER_ENABLE_REGISTRATION'), |
| 546 | 546 | 'mailParams' => [ |
| 547 | - 'fromEmail' => [getenv('APP_MAILER_FROM')=>getenv('APP_TITLE')] |
|
| 547 | + 'fromEmail' => [ getenv('APP_MAILER_FROM')=>getenv('APP_TITLE') ] |
|
| 548 | 548 | ], |
| 549 | 549 | ], |
| 550 | 550 | 'widgets' => [ |
@@ -1,37 +1,37 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Prepare environment |
| 4 | -$rootPath = realpath(__DIR__ . '/..'); |
|
| 5 | -require($rootPath . '/vendor/autoload.php'); |
|
| 6 | -require($rootPath . '/config/env.php'); |
|
| 4 | +$rootPath = realpath(__DIR__.'/..'); |
|
| 5 | +require($rootPath.'/vendor/autoload.php'); |
|
| 6 | +require($rootPath.'/config/env.php'); |
|
| 7 | 7 | |
| 8 | 8 | // Enable YII_DEBUG by key/token cookie |
| 9 | 9 | if (strlen(getenv('APP_DEBUG_KEY') > 10) && |
| 10 | 10 | strlen(getenv('APP_DEBUG_TOKEN') > 10)) { |
| 11 | - if (isset($_COOKIE[getenv('APP_DEBUG_KEY')]) && |
|
| 12 | - ($_COOKIE[getenv('APP_DEBUG_KEY')] === getenv('APP_DEBUG_TOKEN'))) { |
|
| 11 | + if (isset($_COOKIE[ getenv('APP_DEBUG_KEY') ]) && |
|
| 12 | + ($_COOKIE[ getenv('APP_DEBUG_KEY') ] === getenv('APP_DEBUG_TOKEN'))) { |
|
| 13 | 13 | putenv('YII_DEBUG=1'); |
| 14 | 14 | } |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Define framework & application constants |
| 18 | -defined('YII_DEBUG') or define('YII_DEBUG', (boolean)getenv('YII_DEBUG')); |
|
| 18 | +defined('YII_DEBUG') or define('YII_DEBUG', (boolean) getenv('YII_DEBUG')); |
|
| 19 | 19 | defined('YII_ENV') or define('YII_ENV', getenv('YII_ENV')); |
| 20 | 20 | defined('APP_TYPE') or define('APP_TYPE', 'web'); |
| 21 | 21 | |
| 22 | 22 | // Load framework |
| 23 | -require($rootPath . '/vendor/yiisoft/yii2/Yii.php'); |
|
| 23 | +require($rootPath.'/vendor/yiisoft/yii2/Yii.php'); |
|
| 24 | 24 | |
| 25 | 25 | // Codeception testing routes |
| 26 | -if (YII_ENV_TEST && file_exists($rootPath . '/tests/c3.php')) { |
|
| 26 | +if (YII_ENV_TEST && file_exists($rootPath.'/tests/c3.php')) { |
|
| 27 | 27 | define( |
| 28 | 28 | 'C3_CODECOVERAGE_ERROR_LOG_FILE', |
| 29 | 29 | getenv('C3_CODECOVERAGE_ERROR_LOG_FILE')); //Optional (if not set the default c3 output dir will be used) |
| 30 | 30 | define( |
| 31 | 31 | 'C3_CODECEPTION_CONFIG_PATH', |
| 32 | 32 | getenv('C3_CODECEPTION_CONFIG_PATH')); //Optional (if not set the default c3 output dir will be used) |
| 33 | - require_once $rootPath . '/tests/c3.php'; |
|
| 33 | + require_once $rootPath.'/tests/c3.php'; |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | // Run application |
| 37 | -(new yii\web\Application(require($rootPath . '/config/main.php')))->run(); |
|
| 37 | +(new yii\web\Application(require($rootPath.'/config/main.php')))->run(); |
|