MOON
Server: Apache
System: Linux u18017238.onlinehome-server.com 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64
User: emblazeone (1003)
PHP: 7.3.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/emblazeone/www/master-template/frontend/controllers/BaseController.php
<?php


namespace frontend\controllers;


use backend\modules\sites\models\Sites;
use frontend\models\LoginForm;
use yii\web\Controller;
use yii\web\HttpException;
use yii\web\NotFoundHttpException;

class BaseController extends Controller
{
    public $site;
    public $loginForm=false;

    public function beforeAction($action)
    {
        $name = trim($_SERVER['SERVER_NAME']);
        $this->site = Sites::findOne(['url' => $name, 'status' => Sites::STATUS_ACTIVE]);
        if ( $action->id == 'error' ) {
            if (!$this->site) $this->layout='error';
            return true;
        }
        if (!$this->site) throw new NotFoundHttpException('Page not found.');

        $this->loginForm=new LoginForm();

        return parent::beforeAction($action); // TODO: Change the autogenerated stub
    }
}