Skip to content

Commit

Permalink
FIX check for active languages
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Dausch committed May 14, 2019
1 parent ae6caef commit 8f2b559
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/Middlewares/Middleware.php
Expand Up @@ -42,14 +42,13 @@ public function before(Request $request)
/** @var WebstoreConfigurationService $webstoreService */
$webstoreService = pluginApp(WebstoreConfigurationService::class);
$webstoreConfig = $webstoreService->getWebstoreConfig();
$activeLanguages = $webstoreService->getActiveLanguageList();
$requestLang = $request->get('Lang', null);

if(!is_null($requestLang) && in_array($requestLang, $activeLanguages))
if(!is_null($requestLang) && in_array($requestLang, $webstoreConfig->languageList))
{
$this->setLanguage($requestLang, $webstoreConfig);
}
else if((is_null($splittedURL[0]) || strlen($splittedURL[0]) != 2 || !in_array($splittedURL[0], $activeLanguages)) && strpos(end($splittedURL), '.') === false)
else if((is_null($splittedURL[0]) || strlen($splittedURL[0]) != 2 || !in_array($splittedURL[0], $webstoreConfig->languageList)) && strpos(end($splittedURL), '.') === false)
{
$this->setLanguage($webstoreConfig->defaultLanguage, $webstoreConfig);
}
Expand Down

0 comments on commit 8f2b559

Please sign in to comment.