From c26cf7711d157f859bc4cdb43895659eb4188aed Mon Sep 17 00:00:00 2001 From: "severoiuliano@gmail.com" Date: Mon, 15 Jun 2020 09:41:01 +0200 Subject: [PATCH] improve environment control --- system/system.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/system/system.php b/system/system.php index ba3b2f6..5e87a21 100644 --- a/system/system.php +++ b/system/system.php @@ -222,7 +222,11 @@ $container['view'] = function ($container) * LOAD TRANSLATIONS * ******************************/ $uri = $_SERVER['REQUEST_URI']; - if(isset($uri) && (strpos($uri,'/tm/') !== false OR strpos($uri,'/setup') !== false)) + + $base_path = $container['request']->getUri()->getBasePath(); + $uri = str_replace($base_path,'',$uri); + $pieces = explode('/',$uri); + if(isset($uri) && ($pieces[1] === 'tm' OR $pieces[1] === 'setup') ) { // Admin environment labels $labels = Typemill\Translations::loadTranslations('admin'); @@ -231,7 +235,6 @@ $container['view'] = function ($container) // For now it is useless, but it will prove useful in the future $labels = Typemill\Translations::loadTranslations('user'); } - $container['translations'] = $labels; $view['translations'] = $labels; $view->addExtension(new Typemill\Extensions\TwigLanguageExtension( $labels ));