Code Duplication    Length = 3-4 lines in 4 locations

php/elFinderVolumeDriver.class.php 4 locations

@@ 1505-1507 (lines=3) @@
1502
		}
1503
		
1504
		$mimeByName = elFinderVolumeDriver::mimetypeInternalDetect($name);
1505
		if ($mimeByName && $mimeByName !== 'unknown' && !$this->allowPutMime($mimeByName)) {
1506
			return $this->setError(elFinder::ERROR_INVALID_NAME, $name);
1507
		}
1508
		
1509
		if (!($file = $this->file($hash))) {
1510
			return $this->setError(elFinder::ERROR_FILE_NOT_FOUND);
@@ 1609-1611 (lines=3) @@
1606
			}
1607
		}
1608
1609
		if (!$this->allowPutMime($mime) || ($mimeByName && $mimeByName !== 'unknown' && !$this->allowPutMime($mimeByName))) {
1610
			return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME);
1611
		}
1612
1613
		$tmpsize = sprintf('%u', filesize($tmpname));
1614
		if ($this->uploadMaxSize > 0 && $tmpsize > $this->uploadMaxSize) {
@@ 1820-1822 (lines=3) @@
1817
				fclose($tp);
1818
			}
1819
		}
1820
		if (!$this->allowPutMime($mimeByName) || ($mime && $mime !== 'unknown' && !$this->allowPutMime($mime))) {
1821
			return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME);
1822
		}
1823
		
1824
		$this->clearcache();
1825
		return $this->convEncOut($this->_filePutContents($this->convEncIn($path), $content)) ? $this->stat($path) : false;
@@ 3378-3381 (lines=4) @@
3375
			if ($stat['mime'] === $mimeByName) {
3376
				$mimeByName = '';
3377
			}
3378
			if (!$this->allowPutMime($stat['mime']) || ($mimeByName !== 'unknown' && !$this->allowPutMime($mimeByName))) {
3379
				$this->remove($path, true);
3380
				return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME, $errpath);
3381
			}
3382
		}
3383
		
3384
		return $path;