Code Duplication    Length = 3-4 lines in 4 locations

php/elFinderVolumeDriver.class.php 4 locations

@@ 1501-1503 (lines=3) @@
1498
		}
1499
		
1500
		$mimeByName = elFinderVolumeDriver::mimetypeInternalDetect($name);
1501
		if ($mimeByName && $mimeByName !== 'unknown' && !$this->allowPutMime($mimeByName)) {
1502
			return $this->setError(elFinder::ERROR_INVALID_NAME, $name);
1503
		}
1504
		
1505
		if (!($file = $this->file($hash))) {
1506
			return $this->setError(elFinder::ERROR_FILE_NOT_FOUND);
@@ 1605-1607 (lines=3) @@
1602
			}
1603
		}
1604
1605
		if (!$this->allowPutMime($mime) || ($mimeByName && $mimeByName !== 'unknown' && !$this->allowPutMime($mimeByName))) {
1606
			return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME);
1607
		}
1608
1609
		$tmpsize = sprintf('%u', filesize($tmpname));
1610
		if ($this->uploadMaxSize > 0 && $tmpsize > $this->uploadMaxSize) {
@@ 1816-1818 (lines=3) @@
1813
				fclose($tp);
1814
			}
1815
		}
1816
		if (!$this->allowPutMime($mimeByName) || ($mime && $mime !== 'unknown' && !$this->allowPutMime($mime))) {
1817
			return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME);
1818
		}
1819
		
1820
		$this->clearcache();
1821
		return $this->convEncOut($this->_filePutContents($this->convEncIn($path), $content)) ? $this->stat($path) : false;
@@ 3364-3367 (lines=4) @@
3361
			if ($stat['mime'] === $mimeByName) {
3362
				$mimeByName = '';
3363
			}
3364
			if (!$this->allowPutMime($stat['mime']) || ($mimeByName !== 'unknown' && !$this->allowPutMime($mimeByName))) {
3365
				$this->remove($path, true);
3366
				return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME, $errpath);
3367
			}
3368
		}
3369
		
3370
		return $path;