main.php 7.51 KB
<?php
$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/../../common/config/params-local.php'),
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php')
);

return [
    'id' => 'app-frontend',
    'basePath' => dirname(__DIR__),
//    'bootstrap' => [
//
//        'frontend\components\SeoComponent',
//    ],
    'controllerNamespace' => 'frontend\controllers',
    'modules' => [
        'artbox-comment' => [
            'class' => 'common\modules\comment\Module',
        ],
//        'comment' => [
//            'class' => 'common\modules\comment\Module',
//            'useRbac' => false,
//            'rbac' => [
//                'rules' => [
//                    \common\modules\comment\rbac\ArtboxCommentCreateRule::className(),
//                    \common\modules\comment\rbac\ArtboxCommentDeleteRule::className(),
//                    \common\modules\comment\rbac\ArtboxCommentUpdateRule::className(),
//                    \common\modules\comment\rbac\ArtboxCommentUpdateOwnRule::className(),
//                    \common\modules\comment\rbac\ArtboxCommentDeleteOwnRule::className(),
//                ],
//                'permissions' => [
//                    [
//                        'name' => common\modules\comment\Permissions::CREATE,
//                        'description' => 'Can create comments',
//                        'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentCreateRule())->name,
//                    ],
//                    [
//                        'name' => common\modules\comment\Permissions::UPDATE,
//                        'description' => 'Can update comments',
//                        'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentUpdateRule())->name,
//                    ],
//                    [
//                        'name' => common\modules\comment\Permissions::DELETE,
//                        'description' => 'Can delete comments',
//                        'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentDeleteRule())->name,
//                    ],
//                    [
//                        'name' => common\modules\comment\Permissions::UPDATE_OWN,
//                        'description' => 'Can update own comments',
//                        'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentUpdateOwnRule())->name,
//                    ],
//                    [
//                        'name' => common\modules\comment\Permissions::DELETE_OWN,
//                        'description' => 'Can delete own comments',
//                        'ruleName' =>(new \common\modules\comment\rbac\ArtboxCommentDeleteOwnRule())->name,
//                    ],
//                ],
//            ],
//
//        ],
    ],
    'components' => [

        'authManager' => [
            'class' => 'yii\rbac\DbManager',
        ],
        'user' => [
            'identityClass'   => 'common\models\Customer',
            'enableAutoLogin' => true,
            'loginUrl'        => ['login'],
        ],
        'request'=>[
            'cookieValidationKey' => 'ndahjhjjidasuidrqeswuiuirqw89',
            'csrfParam' => '_frontendCSRF',
            'class' => 'common\components\Request',

            'web'=> '/frontend/web'

        ],

        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        /*'imageCache' => [
            'class' => 'iutbay\yii2imagecache\ImageCache',
            'sourcePath' => '@app/web/images',
            'sourceUrl' => '@web/images',
            'thumbsPath' => '@app/web/thumbs',
            'thumbsUrl' => '@web/thumbs',
            'resizeMode' => 'inset',
            'sizes' => [
                'brandlist' => [128, 128],
                'product' => [300, 300],
                'product_trumb' => [80, 80],
                'product_trumb2' => [100, 100],
                'list' => [134, 200],
                'product_list2' => [130, 70],
                'product_variant' => [42, 42],
                'mainmenu' => [160, 170],
                'large' => [600, 600],
            ],
        ],*/
        'urlManager'   => [
            'baseUrl' => 'http://www.rukzachok.com.ua',
            'enablePrettyUrl' => true,
            'showScriptName'  => false,
            'rules'           => [
                ''                                                                 => 'site/index',
                'login'                                                            => 'login/index',
                'iam'                                                              => 'iam/index',
                'text/<translit:[\w\_\-]+>'                                              => 'text/index',
                '<language:(ru|ua|en)>/text/<translit:\w+>'                        => 'text/index',
                [
                    'class' => '\common\modules\product\CatalogUrlManager',
                    'route_map' => [
                        'catalog' => 'catalog/category',
                        'product' => 'catalog/product',

                    ]
                ],
                'priceparam.xml'    => 'site/priceparam',
                'price.xml'         => 'site/price',
                'smstest'           => 'site/sms',
                'search' => 'search/index',
//                'catalog'                                                          => 'catalog/all',
//                'catalog/<translit:\w+>'                                           => 'catalog/index',
//                'products/search'                                                  => 'products/search',
//                'products/compare'                                                 => 'products/compare',
//                'products/<translit:\w+>'                                          => 'products/index',
//                'products/<translit_rubric:\w+>/<translit:[\w\-]+>-<id:\d+>'       => 'products/show',
                'news/<translit:\w+>-<id:\d+>'                                     => 'news/show',
                'brands'                                                           => 'catalog/brands',
                'brands/<brand:[\w\-]+>'                                           => 'catalog/brand',
                'blog'                                                             => 'articles/index',
                'blog/<translit:[\w\-\_]+>'                                 => 'articles/show',
                'event'                                                             => 'event/index',
                'event/<alias:[\w\-]+>'                                   => 'event/show',
                '<language:(ru|ua|en)>/<module:\w+>/<controller:\w+>/<action:\w+>' => '<module>/<controller>/<action>',
                '<language:(ru|ua|en)>/<controller:\w+>/<action:\w+>'              => '<controller>/<action>',
                '<language:(ru|ua|en)>/admin'                                      => 'admin/default/index',
                '<language:(ru|ua|en)>/admin/users'                                => 'admin/users/index',
                'thumbs/<path:.*>' => 'site/thumb',
            ],

        ],

    ],
    'params' => $params,
];