Code Duplication    Length = 3-5 lines in 3 locations

php/elFinderVolumeDriver.class.php 3 locations

@@ 1524-1526 (lines=3) @@
1521
			return $this->setError(elFinder::ERROR_EXISTS, $name);
1522
		}
1523
		
1524
		if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) {
1525
			return $this->setError(elFinder::ERROR_PERM_DENIED);
1526
		}
1527
1528
		$this->rmTmb($file); // remove old name tmbs, we cannot do this after dir move
1529
@@ 1559-1561 (lines=3) @@
1556
		$dir  = $this->dirnameCE($path);
1557
		$name = $this->uniqueName($dir, $this->basenameCE($path), ' '.$suffix.' ');
1558
1559
		if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) {
1560
			return $this->setError(elFinder::ERROR_PERM_DENIED);
1561
		}
1562
1563
		return ($path = $this->copy($path, $dir, $name)) == false
1564
			? false
@@ 1624-1628 (lines=5) @@
1621
			// check POST data `overwrite` for 3rd party uploader
1622
			$overwrite = isset($_POST['overwrite'])? (bool)$_POST['overwrite'] : $this->options['uploadOverwrite'];
1623
			if ($overwrite) {
1624
				if (!$file['write']) {
1625
					return $this->setError(elFinder::ERROR_PERM_DENIED);
1626
				} elseif ($file['mime'] == 'directory') {
1627
					return $this->setError(elFinder::ERROR_NOT_REPLACE, $name);
1628
				} 
1629
				$this->remove($test);
1630
			} else {
1631
				$name = $this->uniqueName($dstpath, $name, '-', false);