Code Duplication    Length = 3-5 lines in 3 locations

php/elFinderVolumeDriver.class.php 3 locations

@@ 1507-1509 (lines=3) @@
1504
			return $this->setError(elFinder::ERROR_EXISTS, $name);
1505
		}
1506
		
1507
		if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) {
1508
			return $this->setError(elFinder::ERROR_PERM_DENIED);
1509
		}
1510
1511
		$this->rmTmb($file); // remove old name tmbs, we cannot do this after dir move
1512
@@ 1542-1544 (lines=3) @@
1539
		$dir  = $this->dirnameCE($path);
1540
		$name = $this->uniqueName($dir, $this->basenameCE($path), ' '.$suffix.' ');
1541
1542
		if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) {
1543
			return $this->setError(elFinder::ERROR_PERM_DENIED);
1544
		}
1545
1546
		return ($path = $this->copy($path, $dir, $name)) == false
1547
			? false
@@ 1607-1611 (lines=5) @@
1604
			// check POST data `overwrite` for 3rd party uploader
1605
			$overwrite = isset($_POST['overwrite'])? (bool)$_POST['overwrite'] : $this->options['uploadOverwrite'];
1606
			if ($overwrite) {
1607
				if (!$file['write']) {
1608
					return $this->setError(elFinder::ERROR_PERM_DENIED);
1609
				} elseif ($file['mime'] == 'directory') {
1610
					return $this->setError(elFinder::ERROR_NOT_REPLACE, $name);
1611
				} 
1612
				$this->remove($test);
1613
			} else {
1614
				$name = $this->uniqueName($dstpath, $name, '-', false);