소스 검색

improve environment control

severoiuliano@gmail.com 5 년 전
부모
커밋
c26cf7711d
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      system/system.php

+ 5 - 2
system/system.php

@@ -222,7 +222,11 @@ $container['view'] = function ($container)
 	* LOAD TRANSLATIONS           *
 	* LOAD TRANSLATIONS           *
 	******************************/
 	******************************/
   	$uri = $_SERVER['REQUEST_URI'];
   	$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
     	// Admin environment labels
     	$labels = Typemill\Translations::loadTranslations('admin');
     	$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
     	// For now it is useless, but it will prove useful in the future
     	$labels = Typemill\Translations::loadTranslations('user');
     	$labels = Typemill\Translations::loadTranslations('user');
   	}
   	}
-  	$container['translations'] = $labels;
   	$view['translations'] = $labels;
   	$view['translations'] = $labels;
 	$view->addExtension(new Typemill\Extensions\TwigLanguageExtension( $labels ));
 	$view->addExtension(new Typemill\Extensions\TwigLanguageExtension( $labels ));