1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-13 18:14:26 +02:00

Checking of remote file-types during import and other cleanup.

This commit is contained in:
Cameron
2021-12-17 11:31:37 -08:00
parent d8ce385929
commit 90108eab3c
6 changed files with 34 additions and 9 deletions

View File

@@ -2177,7 +2177,7 @@
/**
* New in v2.1.9
* Check filename or path against filetypes.xml
* Check filename, path or URL against filetypes.xml
*
* @param $file - real path to file.
* @param string $targetFile
@@ -2191,12 +2191,26 @@
$targetFile = $file;
}
$remote = false;
if(strpos($targetFile,'http') === 0) // remote file.
{
$tmp = parse_url($targetFile);
$targetFile = $tmp['path'];
$remote = true;
}
$ext = pathinfo($targetFile, PATHINFO_EXTENSION);
$types = $this->getAllowedFileTypes();
if(isset($types[$ext]))
{
if($remote)
{
return true;
}
$maxSize = $types[$ext] * 1024;
$fileSize = filesize($file);