From 34a8ab231f3772859cfeca07123bd761d523a493 Mon Sep 17 00:00:00 2001 From: Varakh Date: Thu, 5 Apr 2018 13:33:43 +0200 Subject: [PATCH] fix session error; add selected server name to menu --- public/index.php | 2 -- src/Control/Actions/ServerSelectAction.php | 2 ++ src/View/material/layout/menu.twig | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/public/index.php b/public/index.php index 48e0883..9e94c56 100644 --- a/public/index.php +++ b/public/index.php @@ -21,8 +21,6 @@ if (PHP_SAPI === 'cli-server' && $_SERVER['SCRIPT_FILENAME'] !== __FILE__) { require __DIR__ . DIRECTORY_SEPARATOR . '../vendor/autoload.php'; -session_start(); - /** * Step 2: Bootstrap database, ACL, Twig, FlashMessages, Logger */ diff --git a/src/Control/Actions/ServerSelectAction.php b/src/Control/Actions/ServerSelectAction.php index 93fde77..14b3b40 100644 --- a/src/Control/Actions/ServerSelectAction.php +++ b/src/Control/Actions/ServerSelectAction.php @@ -11,8 +11,10 @@ final class ServerSelectAction extends AbstractAction $this->ts->login($this->auth->getIdentity()['user'], $this->auth->getIdentity()['password']); $selectResult = $this->ts->getInstance()->selectServer($sid, 'serverId'); + $dataResult = $this->ts->getInstance()->serverInfo(); $this->session->set('sid', $sid); + $this->session->set('sname', $this->ts->getInstance()->getElement('data', $dataResult)['virtualserver_name']); $this->flash->addMessage('success', $this->translator->trans('done')); return $response->withRedirect('/servers'); diff --git a/src/View/material/layout/menu.twig b/src/View/material/layout/menu.twig index 4045d1b..d570de3 100644 --- a/src/View/material/layout/menu.twig +++ b/src/View/material/layout/menu.twig @@ -13,6 +13,9 @@ {% if session_exists('sid') %}
+ {% if session_exists('sname') %} +
{{ session_get('sname') }}
+ {% endif %}
  • {% trans %}menu.servers.info{% endtrans %}