Browse Source

Revert FrontendController

master
Egorka 6 years ago
parent
commit
ead0a3e0e7
  1. 4
      common/modules/blog/controllers/PostController.php
  2. 4
      common/modules/pages/controllers/PageController.php
  3. 14
      frontend/bootstrap/SetUp.php
  4. 32
      frontend/components/FrontendController.php
  5. 4
      frontend/controllers/ContactController.php
  6. 4
      frontend/controllers/PostController.php
  7. 10
      frontend/controllers/SiteController.php
  8. 6
      frontend/controllers/account/ProfileController.php

4
common/modules/blog/controllers/PostController.php

@ -11,16 +11,16 @@ use common\modules\blog\repositories\read\BlogPostReadRepository;
use common\modules\blog\repositories\read\BlogTagReadRepository; use common\modules\blog\repositories\read\BlogTagReadRepository;
use common\modules\blog\services\BlogCommentService; use common\modules\blog\services\BlogCommentService;
use core\entities\Meta; use core\entities\Meta;
use frontend\components\FrontendController;
use Yii; use Yii;
use yii\base\Security; use yii\base\Security;
use yii\data\ActiveDataProvider; use yii\data\ActiveDataProvider;
use yii\helpers\FileHelper; use yii\helpers\FileHelper;
use yii\helpers\Json; use yii\helpers\Json;
use yii\web\Controller;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use yii\filters\AccessControl; use yii\filters\AccessControl;
class PostController extends Controller class PostController extends FrontendController
{ {
public $layout = 'blog'; public $layout = 'blog';

4
common/modules/pages/controllers/PageController.php

@ -3,12 +3,12 @@
namespace common\modules\pages\controllers; namespace common\modules\pages\controllers;
use common\modules\pages\repositories\read\PageReadRepository; use common\modules\pages\repositories\read\PageReadRepository;
use yii\web\Controller; use frontend\components\FrontendController;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use yii\filters\AccessControl; use yii\filters\AccessControl;
class PageController extends Controller class PageController extends FrontendController
{ {
private $pages; private $pages;

14
frontend/bootstrap/SetUp.php

@ -33,19 +33,5 @@ class SetUp implements BootstrapInterface
'<_c:[\w\-]+>/<_a:[\w-]+>' => '<_c>/<_a>', '<_c:[\w\-]+>/<_a:[\w-]+>' => '<_c>/<_a>',
'<_c:[\w\-]+>/<id:\d+>/<_a:[\w\-]+>' => '<_c>/<_a>', '<_c:[\w\-]+>/<id:\d+>/<_a:[\w\-]+>' => '<_c>/<_a>',
]); ]);
// Set site theme
$theme = isset($app->params['settings']['design']['theme']) ? $app->params['settings']['design']['theme'] : 'start';
$app->view->theme = new Theme([
'basePath' => '@webroot/themes/' . $theme,
'baseUrl' => '@web/themes/' . $theme,
'pathMap' => [
'@common/modules' => '@webroot/themes/' . $theme . '/modules',
'@frontend/views' => '@webroot/themes/' . $theme,
'@frontend/widgets' => '@webroot/themes/' . $theme . '/widgets',
],
]);
} }
} }

32
frontend/components/FrontendController.php

@ -0,0 +1,32 @@
<?php
/**
* Created by Error202
* Date: 23.07.2018
*/
namespace frontend\components;
use yii\base\Theme;
use yii\web\Controller;
use Yii;
class FrontendController extends Controller
{
public function init() {
parent::init();
$theme = isset(Yii::$app->params['settings']['design']['theme']) ? Yii::$app->params['settings']['design']['theme'] : 'start';
Yii::$app->view->theme = new Theme([
'basePath' => '@webroot/themes/' . $theme,
'baseUrl' => '@web/themes/' . $theme,
'pathMap' => [
'@common/modules' => '@webroot/themes/' . $theme . '/modules',
'@frontend/views' => '@webroot/themes/' . $theme,
'@frontend/widgets' => '@webroot/themes/' . $theme . '/widgets',
],
]);
}
}

4
frontend/controllers/ContactController.php

@ -2,11 +2,11 @@
namespace frontend\controllers; namespace frontend\controllers;
use core\services\ContactService; use core\services\ContactService;
use frontend\components\FrontendController;
use Yii; use Yii;
use core\forms\ContactForm; use core\forms\ContactForm;
use yii\web\Controller;
class ContactController extends Controller class ContactController extends FrontendController
{ {
public $layout = 'contacts'; public $layout = 'contacts';

4
frontend/controllers/PostController.php

@ -8,13 +8,13 @@ use core\repositories\post\read\PostCategoryReadRepository;
use core\repositories\post\read\PostReadRepository; use core\repositories\post\read\PostReadRepository;
use core\repositories\post\read\PostTagReadRepository; use core\repositories\post\read\PostTagReadRepository;
use core\services\post\PostCommentService; use core\services\post\PostCommentService;
use frontend\components\FrontendController;
use Yii; use Yii;
use yii\data\ActiveDataProvider; use yii\data\ActiveDataProvider;
use yii\web\Controller;
use yii\web\NotFoundHttpException; use yii\web\NotFoundHttpException;
use yii\filters\AccessControl; use yii\filters\AccessControl;
class PostController extends Controller class PostController extends FrontendController
{ {
public $layout = 'post'; public $layout = 'post';

10
frontend/controllers/SiteController.php

@ -3,16 +3,16 @@ namespace frontend\controllers;
use core\forms\SubscribeForm; use core\forms\SubscribeForm;
use core\services\newsletter\Newsletter; use core\services\newsletter\Newsletter;
use frontend\components\FrontendController;
use yii\filters\VerbFilter; use yii\filters\VerbFilter;
use yii\filters\AccessControl; use yii\filters\AccessControl;
use frontend\components\SiteAccess; use frontend\components\SiteAccess;
use Yii; use Yii;
use yii\web\Controller;
/** /**
* Site controller * Site controller
*/ */
class SiteController extends Controller class SiteController extends FrontendController
{ {
public $newletter; public $newletter;
@ -28,7 +28,7 @@ class SiteController extends Controller
{ {
return [ return [
'access' => [ 'access' => [
'class' => AccessControl::className(), 'class' => AccessControl::class,
'only' => ['subscribe'], 'only' => ['subscribe'],
'rules' => [ 'rules' => [
[ [
@ -38,12 +38,12 @@ class SiteController extends Controller
], ],
], ],
'verbs' => [ 'verbs' => [
'class' => VerbFilter::className(), 'class' => VerbFilter::class,
'actions' => [ 'actions' => [
'logout' => ['post'], 'logout' => ['post'],
], ],
], ],
SiteAccess::className(), SiteAccess::class,
]; ];
} }

6
frontend/controllers/account/ProfileController.php

@ -7,7 +7,7 @@
namespace frontend\controllers\account; namespace frontend\controllers\account;
use yii\web\Controller; use frontend\components\FrontendController;
use core\services\user\ProfileService; use core\services\user\ProfileService;
use core\forms\user\ProfileEditForm; use core\forms\user\ProfileEditForm;
use core\entities\user\User; use core\entities\user\User;
@ -15,7 +15,7 @@ use yii\web\NotFoundHttpException;
use yii\filters\AccessControl; use yii\filters\AccessControl;
use Yii; use Yii;
class ProfileController extends Controller class ProfileController extends FrontendController
{ {
public $layout = 'profile'; public $layout = 'profile';
@ -31,7 +31,7 @@ class ProfileController extends Controller
{ {
return [ return [
'access' => [ 'access' => [
'class' => AccessControl::className(), 'class' => AccessControl::class,
'only' => ['index'], 'only' => ['index'],
'rules' => [ 'rules' => [
[ [

Loading…
Cancel
Save