Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Mar 26, 2020
2 parents 5f4a05f + ec14631 commit 3a04e97
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions application/controllers/admin/LimeSurveyFileManager.php
Expand Up @@ -168,6 +168,11 @@ public function getFolderList($iSurveyId = null)
$this->printJsonResponse($aAllowedFolders);
}

/**
* Delete file.
*
* @return void
*/
public function deleteFile()
{
$iSurveyId = Yii::app()->request->getPost('surveyid');
Expand Down Expand Up @@ -206,6 +211,11 @@ public function deleteFile()
);
}

/**
* Move file(s)
*
* @return void
*/
public function transitFiles()
{
$folder = Yii::app()->request->getPost('targetFolder');
Expand All @@ -215,7 +225,7 @@ public function transitFiles()

$checkDirectory = $this->checkFolder($folder, $iSurveyId);

foreach($files as $file) {
foreach ($files as $file) {
$this->checkChangedFilename($file);

$realTargetPath = dirname(Yii::app()->basePath) . DIRECTORY_SEPARATOR . $folder;
Expand Down Expand Up @@ -256,8 +266,6 @@ public function transitFiles()
'success' => true,
'message' => $successMessage,
]);
return;

}

/**
Expand Down Expand Up @@ -570,6 +578,10 @@ private function extensionAllowed($fileExtension, $purpose = 'show')
}
}

/**
* @param string $fileDestination
* @return boolean
*/
private function checkTargetExists($fileDestination)
{
return is_file($fileDestination);
Expand Down Expand Up @@ -819,12 +831,11 @@ private function composeFolderArray($folder, $level = '0')
$shortName = end($pathArray);

$folderArray = [
'key' => $shortName.'_'.$level,
'folder' => $folder,
'realPath' => $realPath,
'key' => $shortName.'_'.$level,
'folder' => $folder,
'shortName' => $shortName,
'surveyId' => intval($shortName),
'children' => $childFolders,
'surveyId' => intval($shortName), // Will be 0 for 'global' and 'generalfiles'.
'children' => $childFolders,
];
return $folderArray;
}
Expand Down

0 comments on commit 3a04e97

Please sign in to comment.