示例#1
0
文件: Module.php 项目: oakcms/oakcms
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (Yii::$app->cache === null) {
         throw new \yii\web\ServerErrorHttpException('Please configure Cache component.');
     }
     if (Yii::$app instanceof \yii\web\Application) {
         if (!defined('LIVE_EDIT')) {
             define('LIVE_EDIT', !Yii::$app->user->isGuest && Yii::$app->session->get('oak_live_edit'));
         }
     }
     $rHostInfo = Url::home(true);
     if (!Yii::$app->user->isGuest && strpos(Yii::$app->request->absoluteUrl, $rHostInfo . 'admin') !== false) {
         \Yii::$app->view->theme->basePath = '@app/templates/backend/base';
         \Yii::$app->view->theme->baseUrl = '@web/templates/backend/base/web';
         \Yii::$app->view->theme->pathMap = ['@app/views' => '@app/templates/backend/base/views', '@app/modules' => '@app/templates/backend/base/views/modules', '@app/widgets' => '@app/templates/backend/base/views/widgets'];
     }
 }