Skip to content

Commit

Permalink
Fixed issue: File upload not possible on non-linux system
Browse files Browse the repository at this point in the history
Fixed issue: Uppercase file extensions were not allowed
  • Loading branch information
c-schmitz committed May 1, 2020
1 parent 0712041 commit 94f1312
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions application/controllers/admin/LimeSurveyFileManager.php
Expand Up @@ -44,7 +44,7 @@ class LimeSurveyFileManager extends Survey_Common_Action
* @var array<string, string>
*/
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',
];

Expand Down Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -721,15 +721,15 @@ 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) {
if (Permission::model()->hasGlobalPermission('superadmin', 'read')
|| 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;
}

}
Expand Down

0 comments on commit 94f1312

Please sign in to comment.