public function duplicate($hash, $suffix = 'copy')
{
if ($this->commandDisabled('duplicate')) {
return $this->setError(elFinder::ERROR_COPY, '#' . $hash, elFinder::ERROR_PERM_DENIED);
}
if (($file = $this->file($hash)) == false) {
return $this->setError(elFinder::ERROR_COPY, elFinder::ERROR_FILE_NOT_FOUND);
}
$path = $this->decode($hash);
$dir = $this->_dirname($path);
$name = $this->uniqueName($dir, $this->_basename($path), ' ' . $suffix . ' ');
if (!$this->allowCreate($dir, $name)) {
return $this->setError(elFinder::ERROR_PERM_DENIED);
}
return ($path = $this->copy($path, $dir, $name)) == false ? false : $this->stat($path);
}