diff --git a/config/params.php b/config/params.php index 15815c50..caf9b4c2 100644 --- a/config/params.php +++ b/config/params.php @@ -2,6 +2,7 @@ return [ 'adminEmail' => 'admin@example.com', + "type" => "BiFace", // BiFace, BiTable "maxLogs" => 50000, "maxPicture" => 9999, "version" => "1.0.7", diff --git a/controllers/ConfigController.php b/controllers/ConfigController.php index 2a2103d0..4054df30 100644 --- a/controllers/ConfigController.php +++ b/controllers/ConfigController.php @@ -159,6 +159,8 @@ class ConfigController extends Controller { public function actionIndex() { $this->view->title = Yii::t("app", "CAU_HINH_MAY_CHU"); + if (Yii::$app->params['type'] != "BiFace") + return $this->redirect(['cau-hinh-ip']); $options = [ 'http' => [ 'header' => "Content-Type: application/json", @@ -260,6 +262,8 @@ class ConfigController extends Controller { return true; } else { $this->view->title = Yii::t("app", "CAU_HINH_NHAN_DIEN"); + if (Yii::$app->params['type'] != "BiFace") + return $this->redirect(['cau-hinh-ip']); $tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([ 'http' => [ 'header' => "Content-Type: application/json", @@ -424,6 +428,8 @@ class ConfigController extends Controller { public function actionCauHinhThietBi() { $this->view->title = Yii::t("app", "CAU_HINH_THIET_BI"); + if (Yii::$app->params['type'] != "BiFace") + return $this->redirect(['cau-hinh-ip']); $tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([ 'http' => [ @@ -529,9 +535,9 @@ class ConfigController extends Controller { if (Yii::$app->request->post()) { Yii::$app->response->format = "json"; $post = Yii::$app->request->post(); - if (!isset($this->subnet[$post['subnet_mask']])) + if (!$post['dhcp'] && !isset($this->subnet[$post['subnet_mask']])) return ["status" => false]; - $post['subnet_mask'] = $this->subnet[$post['subnet_mask']]; + $post['subnet_mask'] = isset($this->subnet[$post['subnet_mask']]) ? $this->subnet[$post['subnet_mask']] : ""; $options = [ 'http' => [ 'header' => "Content-Type: application/json", diff --git a/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php b/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php index 739149f6..a5c8cc03 100644 --- a/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php +++ b/vendor/dmstr/yii2-adminlte-asset/example-views/yiisoft/yii2-app/layouts/header.php @@ -41,26 +41,28 @@ use yii\widgets\ActiveForm; -
  • - - - -
  • -
  • "> - - - -
  • - + params['type'] === "BiFace") { ?> +
  • + + + +
  • +
  • "> + + + +
  • + +