Code Duplication    Length = 3-5 lines in 4 locations

php/elFinderVolumeDriver.class.php 4 locations

@@ 674-676 (lines=3) @@
671
		}
672
673
		if (!$this->options['allowChmodReadOnly']) {
674
			if (!$this->attr($this->decode($hash), 'write', null, ($file['mime'] === 'directory'))) {
675
				return $this->setError(elFinder::ERROR_PERM_DENIED, $file['name']);
676
			}
677
		}
678
679
		$path = $this->decode($hash);
@@ 1528-1530 (lines=3) @@
1525
			return $this->setError(elFinder::ERROR_EXISTS, $name);
1526
		}
1527
		
1528
		if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) {
1529
			return $this->setError(elFinder::ERROR_PERM_DENIED);
1530
		}
1531
1532
		$this->rmTmb($file); // remove old name tmbs, we cannot do this after dir move
1533
@@ 1563-1565 (lines=3) @@
1560
		$dir  = $this->dirnameCE($path);
1561
		$name = $this->uniqueName($dir, $this->basenameCE($path), ' '.$suffix.' ');
1562
1563
		if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) {
1564
			return $this->setError(elFinder::ERROR_PERM_DENIED);
1565
		}
1566
1567
		return ($path = $this->copy($path, $dir, $name)) == false
1568
			? false
@@ 1628-1632 (lines=5) @@
1625
			// check POST data `overwrite` for 3rd party uploader
1626
			$overwrite = isset($_POST['overwrite'])? (bool)$_POST['overwrite'] : $this->options['uploadOverwrite'];
1627
			if ($overwrite) {
1628
				if (!$file['write']) {
1629
					return $this->setError(elFinder::ERROR_PERM_DENIED);
1630
				} elseif ($file['mime'] == 'directory') {
1631
					return $this->setError(elFinder::ERROR_NOT_REPLACE, $name);
1632
				} 
1633
				$this->remove($test);
1634
			} else {
1635
				$name = $this->uniqueName($dstpath, $name, '-', false);