Merge if statements

This commit is contained in:
Joas Schilling 2014-06-23 18:10:08 +02:00
parent 909e505c2e
commit c98b7fe7fc
1 changed files with 2 additions and 6 deletions

View File

@ -8,20 +8,16 @@ OCP\JSON::callCheck();
// Get data // Get data
$dir = stripslashes($_POST["dir"]); $dir = stripslashes($_POST["dir"]);
$allFiles = isset($_POST["allfiles"]) ? $_POST["allfiles"] : false; $allFiles = isset($_POST["allfiles"]) ? $_POST["allfiles"] : false;
if ($allFiles === 'true') {
$allFiles = true;
} else {
$files = isset($_POST["file"]) ? $_POST["file"] : $_POST["files"];
}
// delete all files in dir ? // delete all files in dir ?
if ($allFiles) { if ($allFiles === 'true') {
$files = array(); $files = array();
$fileList = \OC\Files\Filesystem::getDirectoryContent($dir); $fileList = \OC\Files\Filesystem::getDirectoryContent($dir);
foreach ($fileList as $fileInfo) { foreach ($fileList as $fileInfo) {
$files[] = $fileInfo['name']; $files[] = $fileInfo['name'];
} }
} else { } else {
$files = isset($_POST["file"]) ? $_POST["file"] : $_POST["files"];
$files = json_decode($files); $files = json_decode($files);
} }
$filesWithError = ''; $filesWithError = '';