Code Duplication    Length = 3-5 lines in 4 locations

php/elFinderVolumeDriver.class.php 4 locations

@@ 712-714 (lines=3) @@
709
		}
710
711
		if (!$this->options['allowChmodReadOnly']) {
712
			if (!$this->attr($this->decode($hash), 'write', null, ($file['mime'] === 'directory'))) {
713
				return $this->setError(elFinder::ERROR_PERM_DENIED, $file['name']);
714
			}
715
		}
716
717
		$path = $this->decode($hash);
@@ 1609-1611 (lines=3) @@
1606
			return $this->setError(elFinder::ERROR_EXISTS, $name);
1607
		}
1608
		
1609
		if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) {
1610
			return $this->setError(elFinder::ERROR_PERM_DENIED);
1611
		}
1612
1613
		$this->rmTmb($file); // remove old name tmbs, we cannot do this after dir move
1614
@@ 1644-1646 (lines=3) @@
1641
		$dir  = $this->dirnameCE($path);
1642
		$name = $this->uniqueName($dir, $this->basenameCE($path), ' '.$suffix.' ');
1643
1644
		if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) {
1645
			return $this->setError(elFinder::ERROR_PERM_DENIED);
1646
		}
1647
1648
		return ($path = $this->copy($path, $dir, $name)) == false
1649
			? false
@@ 1709-1713 (lines=5) @@
1706
			// check POST data `overwrite` for 3rd party uploader
1707
			$overwrite = isset($_POST['overwrite'])? (bool)$_POST['overwrite'] : $this->options['uploadOverwrite'];
1708
			if ($overwrite) {
1709
				if (!$file['write']) {
1710
					return $this->setError(elFinder::ERROR_PERM_DENIED);
1711
				} elseif ($file['mime'] == 'directory') {
1712
					return $this->setError(elFinder::ERROR_NOT_REPLACE, $name);
1713
				} 
1714
				$this->remove($test);
1715
			} else {
1716
				$name = $this->uniqueName($dstpath, $name, '-', false);