Code Duplication    Length = 3-4 lines in 4 locations

php/elFinderVolumeDriver.class.php 4 locations

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