Code Duplication    Length = 3-5 lines in 3 locations

php/elFinderVolumeDriver.class.php 3 locations

@@ 1483-1485 (lines=3) @@
1480
			return $this->setError(elFinder::ERROR_EXISTS, $name);
1481
		}
1482
		
1483
		if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) {
1484
			return $this->setError(elFinder::ERROR_PERM_DENIED);
1485
		}
1486
1487
		$this->rmTmb($file); // remove old name tmbs, we cannot do this after dir move
1488
@@ 1518-1520 (lines=3) @@
1515
		$dir  = $this->dirnameCE($path);
1516
		$name = $this->uniqueName($dir, $this->basenameCE($path), ' '.$suffix.' ');
1517
1518
		if (!$this->allowCreate($dir, $name, ($file['mime'] === 'directory'))) {
1519
			return $this->setError(elFinder::ERROR_PERM_DENIED);
1520
		}
1521
1522
		return ($path = $this->copy($path, $dir, $name)) == false
1523
			? false
@@ 1583-1587 (lines=5) @@
1580
			// check POST data `overwrite` for 3rd party uploader
1581
			$overwrite = isset($_POST['overwrite'])? (bool)$_POST['overwrite'] : $this->options['uploadOverwrite'];
1582
			if ($overwrite) {
1583
				if (!$file['write']) {
1584
					return $this->setError(elFinder::ERROR_PERM_DENIED);
1585
				} elseif ($file['mime'] == 'directory') {
1586
					return $this->setError(elFinder::ERROR_NOT_REPLACE, $name);
1587
				} 
1588
				$this->remove($test);
1589
			} else {
1590
				$name = $this->uniqueName($dstpath, $name, '-', false);