-
Notifications
You must be signed in to change notification settings - Fork 1
/
Bootstrap.php
66 lines (59 loc) · 2.01 KB
/
Bootstrap.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
/**
* @link http://www.tintsoft.com/
* @copyright Copyright (c) 2012 TintSoft Technology Co. Ltd.
* @license http://www.tintsoft.com/license/
*/
namespace yuncms\admin;
use Yii;
use yii\web\Cookie;
use yii\i18n\PhpMessageSource;
use yii\base\BootstrapInterface;
use yuncms\admin\helpers\SettingHelper;
/**
* Class Bootstrap
* @package backend
*/
class Bootstrap implements BootstrapInterface
{
/**
* Bootstrap method to be called during application bootstrap stage.
* @param \yuncms\admin\Application $app the application currently running
*/
public function bootstrap($app)
{
if ($app instanceof \yuncms\admin\Application) {
// Yii::$container->set('yii\web\User', [
// 'enableAutoLogin' => true,
// 'loginUrl' => ['/admin/security/login'],
// 'identityClass' => 'yuncms\admin\models\Admin',
// 'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
// ]);
//$app->set('authManager', [
// 'class' => 'yuncms\admin\components\RbacManager',
// 'cache' => 'cache',
//]);
//设置前台URL
$app->frontUrlManager->baseUrl = Yii::$app->settings->get('url','system');
//附加权限验证行为
// $app->attachBehavior('access', Yii::createObject([
// 'class' => 'yuncms\admin\components\AccessControl'
// ]));
// $app->urlManager->addRules([
// 'login' => '/site/login',
// 'logout' => '/site/logout',
// 'error' => '/site/error',
// ], false);
}
/**
* 注册语言包
*/
if (!isset($app->get('i18n')->translations['admin*'])) {
$app->get('i18n')->translations['admin*'] = [
'class' => PhpMessageSource::className(),
'sourceLanguage' => 'en-US',
'basePath' => __DIR__ . '/messages',
];
}
}
}