From 28ce9495b0a55cfffb56847f6196d41066feecc1 Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Fri, 13 Nov 2020 22:15:15 +0100
Subject: [PATCH] FIX #15432 TIME 0:05 Errors on welcome page installer

---
 src/core/controllers/AuthenticationController.php | 7 +++++--
 src/core/controllers/CoreController.php           | 6 +-----
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/src/core/controllers/AuthenticationController.php b/src/core/controllers/AuthenticationController.php
index f27c10cf8ce..0997dce5297 100755
--- a/src/core/controllers/AuthenticationController.php
+++ b/src/core/controllers/AuthenticationController.php
@@ -35,12 +35,15 @@ class AuthenticationController
     const ROUTES_WITHOUT_AUTHENTICATION = [
         'GET/authenticationInformations', 'PUT/versionsUpdateSQL', 'GET/validUrl', 'GET/authenticate/token', 'GET/images', 'POST/password', 'PUT/password', 'GET/passwordRules',
         'GET/jnlp/{jnlpUniqueId}', 'GET/onlyOffice/mergedFile', 'POST/onlyOfficeCallback', 'POST/authenticate',
-        'GET/wopi/files/{id}', 'GET/wopi/files/{id}/contents', 'POST/wopi/files/{id}/contents','GET/onlyOffice/content','GET/languages/{lang}'
+        'GET/wopi/files/{id}', 'GET/wopi/files/{id}/contents', 'POST/wopi/files/{id}/contents','GET/onlyOffice/content', 'GET/languages/{lang}', 'GET/dev/lang'
     ];
 
     public function getInformations(Request $request, Response $response)
     {
-        $path       = CoreConfigModel::getConfigPath();
+        $path = CoreConfigModel::getConfigPath();
+        if (!file_exists($path)) {
+            return $response->withStatus(403)->withJson(['errors' => 'No configuration file found']);
+        }
         $hashedPath = md5($path);
 
         $appName   = CoreConfigModel::getApplicationName();
diff --git a/src/core/controllers/CoreController.php b/src/core/controllers/CoreController.php
index 2030e816c07..3d79d3c3904 100755
--- a/src/core/controllers/CoreController.php
+++ b/src/core/controllers/CoreController.php
@@ -184,13 +184,9 @@ class CoreController
     public static function getAvailableCoreLanguages(Request $request, Response $response)
     {
         $files = array_diff(scandir('src/lang'), ['..', '.']);
-        $languages = [];
         $arrLanguages = [];
         foreach ($files as $value) {
-            $languages[] = str_replace('.json', '', $value) ;
-        }
-
-        foreach ($languages as $file) {
+            $file        = str_replace('.json', '', $value) ;
             $langName    = explode('-', $file)[1];
             $path        = 'src/lang/' . $file . '.json';
             $fileContent = file_get_contents($path);
-- 
GitLab