public function AjaxFilesCopy() { $oAccount = $this->getDefaultAccountFromParam(); if (!$this->oApiCapability->isFilesSupported($oAccount)) { throw new \ProjectCore\Exceptions\ClientException(\ProjectCore\Notifications::FilesNotAllowed); } $sFromType = $this->getParamValue('FromType'); $sToType = $this->getParamValue('ToType'); $sFromPath = $this->getParamValue('FromPath'); $sToPath = $this->getParamValue('ToPath'); $aItems = @json_decode($this->getParamValue('Files'), true); $oResult = null; foreach ($aItems as $aItem) { $bFolderIntoItself = $aItem['IsFolder'] && $sToPath === $sFromPath . '/' . $aItem['Name']; if (!$bFolderIntoItself) { $sNewName = $this->oApiFilestorage->getNonExistingFileName($oAccount, $sToType, $sToPath, $aItem['Name']); $oResult = $this->oApiFilestorage->copy($oAccount, $sFromType, $sToType, $sFromPath, $sToPath, $aItem['Name'], $sNewName); } } return $this->DefaultResponse($oAccount, __FUNCTION__, $oResult); }