From 94f1312dc3a930d748b5c5384ab47cd26892147d Mon Sep 17 00:00:00 2001 From: Carsten Schmitz Date: Fri, 1 May 2020 14:44:56 +0200 Subject: [PATCH] Fixed issue: File upload not possible on non-linux system Fixed issue: Uppercase file extensions were not allowed --- .../controllers/admin/LimeSurveyFileManager.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/application/controllers/admin/LimeSurveyFileManager.php b/application/controllers/admin/LimeSurveyFileManager.php index 41f83d9a20e..1719c69547f 100644 --- a/application/controllers/admin/LimeSurveyFileManager.php +++ b/application/controllers/admin/LimeSurveyFileManager.php @@ -44,7 +44,7 @@ class LimeSurveyFileManager extends Survey_Common_Action * @var array */ private $globalDirectoriesMap = [ - 'generalfiles' => 'upload' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . 'survey' . DIRECTORY_SEPARATOR . 'generalfiles', + 'generalfiles' => 'upload' . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . 'survey' . DIRECTORY_SEPARATOR . 'generalfiles', 'global' => 'upload' . DIRECTORY_SEPARATOR . 'global', ]; @@ -570,11 +570,11 @@ private function getZipFilename() private function extensionAllowed($fileExtension, $purpose = 'show') { if ($purpose == 'upload') { - return in_array($fileExtension, $this->allowedFileExtensions) || $fileExtension == 'zip'; + return in_array(strtolower($fileExtension), $this->allowedFileExtensions) || $fileExtension == 'zip'; } if ($purpose == 'show') { - return in_array($fileExtension, $this->allowedFileExtensions); + return in_array(strtolower($fileExtension), $this->allowedFileExtensions); } } @@ -721,7 +721,7 @@ private function collectCompleteFolderList($iSurveyId = null) $folders = $this->globalDirectories; if ($iSurveyId != null) { - $folders[$iSurveyId] = 'upload' . DIRECTORY_SEPARATOR . 'surveys' . DIRECTORY_SEPARATOR . $iSurveyId; + $folders[$iSurveyId] = 'upload/surveys/' . $iSurveyId; } else { $aSurveyIds = Yii::app()->db->createCommand()->select('sid')->from('{{surveys}}')->queryColumn(); foreach ($aSurveyIds as $itrtSsurveyId) { @@ -729,7 +729,7 @@ private function collectCompleteFolderList($iSurveyId = null) || Permission::model()->hasGlobalPermission('surveys', 'update') || Permission::model()->hasSurveyPermission($itrtSsurveyId, 'surveylocale', 'update') ) { - $folders[$itrtSsurveyId] = 'upload' . DIRECTORY_SEPARATOR . 'surveys' . DIRECTORY_SEPARATOR . $itrtSsurveyId; + $folders[$itrtSsurveyId] = 'upload/surveys/'. $itrtSsurveyId; } }