Code Duplication    Length = 3-5 lines in 3 locations

php/elFinderVolumeDriver.class.php 3 locations

@@ 1493-1495 (lines=3) @@
1490
			return $this->setError(elFinder::ERROR_EXISTS, $name);
1491
		}
1492
		
1493
		if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) {
1494
			return $this->setError(elFinder::ERROR_PERM_DENIED);
1495
		}
1496
1497
		$this->rmTmb($file); // remove old name tmbs, we cannot do this after dir move
1498
@@ 1528-1530 (lines=3) @@
1525
		$dir  = $this->dirnameCE($path);
1526
		$name = $this->uniqueName($dir, $this->basenameCE($path), ' '.$suffix.' ');
1527
1528
		if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) {
1529
			return $this->setError(elFinder::ERROR_PERM_DENIED);
1530
		}
1531
1532
		return ($path = $this->copy($path, $dir, $name)) == false
1533
			? false
@@ 1593-1597 (lines=5) @@
1590
			// check POST data `overwrite` for 3rd party uploader
1591
			$overwrite = isset($_POST['overwrite'])? (bool)$_POST['overwrite'] : $this->options['uploadOverwrite'];
1592
			if ($overwrite) {
1593
				if (!$file['write']) {
1594
					return $this->setError(elFinder::ERROR_PERM_DENIED);
1595
				} elseif ($file['mime'] == 'directory') {
1596
					return $this->setError(elFinder::ERROR_NOT_REPLACE, $name);
1597
				} 
1598
				$this->remove($test);
1599
			} else {
1600
				$name = $this->uniqueName($dstpath, $name, '-', false);