Code Duplication    Length = 3-4 lines in 4 locations

php/elFinderVolumeDriver.class.php 4 locations

@@ 1484-1486 (lines=3) @@
1481
		}
1482
		
1483
		$mimeByName = elFinderVolumeDriver::mimetypeInternalDetect($name);
1484
		if ($mimeByName && $mimeByName !== 'unknown' && !$this->allowPutMime($mimeByName)) {
1485
			return $this->setError(elFinder::ERROR_INVALID_NAME, $name);
1486
		}
1487
		
1488
		if (!($file = $this->file($hash))) {
1489
			return $this->setError(elFinder::ERROR_FILE_NOT_FOUND);
@@ 1588-1590 (lines=3) @@
1585
			}
1586
		}
1587
1588
		if (!$this->allowPutMime($mime) || ($mimeByName && $mimeByName !== 'unknown' && !$this->allowPutMime($mimeByName))) {
1589
			return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME);
1590
		}
1591
1592
		$tmpsize = sprintf('%u', filesize($tmpname));
1593
		if ($this->uploadMaxSize > 0 && $tmpsize > $this->uploadMaxSize) {
@@ 1799-1801 (lines=3) @@
1796
				fclose($tp);
1797
			}
1798
		}
1799
		if (!$this->allowPutMime($mimeByName) || ($mime && $mime !== 'unknown' && !$this->allowPutMime($mime))) {
1800
			return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME);
1801
		}
1802
		
1803
		$this->clearcache();
1804
		return $this->convEncOut($this->_filePutContents($this->convEncIn($path), $content)) ? $this->stat($path) : false;
@@ 3347-3350 (lines=4) @@
3344
			if ($stat['mime'] === $mimeByName) {
3345
				$mimeByName = '';
3346
			}
3347
			if (!$this->allowPutMime($stat['mime']) || ($mimeByName !== 'unknown' && !$this->allowPutMime($mimeByName))) {
3348
				$this->remove($path, true);
3349
				return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME, $errpath);
3350
			}
3351
		}
3352
		
3353
		return $path;