. Contact: Lyubomir Arsov, liubo (at) web-lobby.com */ include '../system.inc.php'; include 'functions.inc.php'; verifyAction('COPYDIR'); checkAccess('COPYDIR'); $path = RoxyFile::FixPath(trim(empty($_POST['d']) ? '' : $_POST['d'])); $newPath = RoxyFile::FixPath(trim(empty($_POST['n']) ? '' : $_POST['n'])); verifyPath($path); verifyPath($newPath); function copyDir(string $path, string $newPath): void { $items = listDirectory($path); if (!is_dir($newPath)) { mkdir($newPath, (int) octdec(DIRPERMISSIONS)); } foreach ($items as $item) { if ($item == '.' || $item == '..') { continue; } $oldPath = RoxyFile::FixPath($path . '/' . $item); $tmpNewPath = RoxyFile::FixPath($newPath . '/' . $item); if (is_file($oldPath)) { copy($oldPath, $tmpNewPath); } elseif (is_dir($oldPath)) { copyDir($oldPath, $tmpNewPath); } } } if (is_dir(fixPath($path))) { copyDir(fixPath($path . '/'), fixPath($newPath . '/' . basename($path))); echo getSuccessRes(); } else { echo getErrorRes(t('E_CopyDirInvalidPath')); }