<?php

$params = require(__DIR__ . '/params.php');

$config = [
    'id' => 'basic',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'components' => [
        'request' => [
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
            'cookieValidationKey' => 'ebf22fc4f3642700914293d4cac31842',
        ],
        'user' => [
            'identityClass' => 'app\models\User',
            'enableAutoLogin' => true,
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
			'useFileTransport' => true,
        ],
        /*'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii\log\FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],*/
        'db' => require(__DIR__ . '/db.php'),
        'urlManager' => [
            'enablePrettyUrl' => true,
            'showScriptName' => false,
			'enableStrictParsing' => false,
            'rules' => [
                '/glnotice/basic/<id:\d+>' => '/glnotice/basic/index',
                '/notice/<id:\d+>' => '/notice/index',
                '/gluser/basic/<id:\d+>' => '/gluser/basic/index',
                '/glspecial/chapter/<id:\d+>' => '/glspecial/chapter/index',
                '/glspecial/section/<id:\d+>-<parentid:\d+>' => '/glspecial/section/index',
                '/glspecial/knowled/<id:\d+>-<parentid:\d+>' => '/glspecial/knowled/index',
                '/glspecial/leader/<id:\d+>' => '/glspecial/leader/index',
                '/glcourse/special/<id:\d+>' => '/glcourse/special/index',
                '/glcourse/tree/<id:\d+>' => '/glcourse/tree/index',
                '/glcourse/list/<id:\d+>' => '/glcourse/list/index',
                '/glcourse/chapter/<id:\d+>' => '/glcourse/chapter/index',
                '/glcourse/section/<id:\d+>-<parentid:\d+>' => '/glcourse/section/index',
                '/glcourse/knowled/<id:\d+>-<parentid:\d+>' => '/glcourse/knowled/index',
                '/glcourse/leader/<id:\d+>' => '/glcourse/leader/index',
                '/glxzclass/student/<id:\d+>' => '/glxzclass/student/index',
                '/glketang/detail/<id:\d+>' => '/glketang/detail/index',
                '/glketang/signlist/<id:\d+>' => '/glketang/signlist/index',
                '/glketang/pptaskq/<id:\d+>' => '/glketang/pptaskq/index',
                '/glketang/topics/<id:\d+>' => '/glketang/topics/index',
                '/glketang/tongji/<id:\d+>' => '/glketang/tongji/index',
                '/glketang/pptlive/<id:\d+>' => '/glketang/pptlive/index',
                '/glketang/confscore/<id:\d+>' => '/glketang/confscore/index',
                '/glketang/student/<id:\d+>' => '/glketang/student/index',
                '/glketang/space/<id:\d+>' => '/glketang/space/index',
                '/doketang/detail/<id:\d+>' => '/doketang/detail/index',
                '/doketang/signlist/<id:\d+>' => '/doketang/signlist/index',
                '/doketang/pptaskq/<id:\d+>' => '/doketang/pptaskq/index',
                '/doketang/topics/<id:\d+>' => '/doketang/topics/index',
                '/doketang/tongji/<id:\d+>' => '/doketang/tongji/index',
                '/doketang/pptlive/<id:\d+>' => '/doketang/pptlive/index',
                '/doketang/space/<id:\d+>' => '/doketang/space/index',
            ],
        ],
        'cache' => [
            'class' => 'yii\caching\FileCache',
            'cachePath' => '@runtime/cache',
        ],
    ],
	'modules' => [
        'api' => [
            'class' => 'app\modules\api\Module',
        ],
        'doketang' => [
            'class' => 'app\modules\doketang\Module',
        ],
        'glconfig' => [
            'class' => 'app\modules\glconfig\Module',
        ],
        'glnotice' => [
            'class' => 'app\modules\glnotice\Module',
        ],
        'glcourse' => [
            'class' => 'app\modules\glcourse\Module',
        ],
        'glketang' => [
            'class' => 'app\modules\glketang\Module',
        ],
        'glspecial' => [
            'class' => 'app\modules\glspecial\Module',
        ],
        'gluser' => [
            'class' => 'app\modules\gluser\Module',
        ],
        'glxzclass' => [
            'class' => 'app\modules\glxzclass\Module',
        ],
        'gltongji' => [
            'class' => 'app\modules\gltongji\Module',
        ],
        'user' => [
            'class' => 'app\modules\user\Module',
        ],
        'secret' => [
            'class' => 'app\modules\secret\Module',
        ],
        'helper' => [
            'class' => 'app\modules\helper\Module',
        ],
        'lespecial' => [
            'class' => 'app\modules\lespecial\Module',
        ],
        'yidong' => [
            'class' => 'app\modules\yidong\Module',
        ]
    ],
    'params' => $params,
];

if (YII_ENV_DEV) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = [
        'class' => 'yii\debug\Module',
        'allowedIPs' => ['127.0.0.1','192.168.1.150']
    ];

    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = [
        'class' => 'yii\gii\Module',
    ];
}

return $config;

?>