Use Rhymix Framework to decide whether a file can be directly downloaded

xpressengine/xe-core#1997
This commit is contained in:
Kijin Sung 2017-02-06 15:58:10 +09:00
parent f17fa23598
commit e1ffe39a2e
4 changed files with 41 additions and 2 deletions

View file

@ -486,7 +486,7 @@ class ttimport
$file_obj->download_count = $xmlDoc->attachment->downloads->body;
$name = $xmlDoc->attachment->name->body;
// Set upload path by checking if the attachement is an image or other kind of file
if(preg_match("/\.(jpg|jpeg|gif|png|wmv|wma|mpg|mpeg|avi|swf|flv|mp1|mp2|mp3|mp4|asf|wav|asx|mid|midi|asf|mov|moov|qt|rm|ram|ra|rmm|m4v)$/i", $file_obj->source_filename))
if (Rhymix\Framework\Filters\FilenameFilter::isDirectDownload($file_obj->source_filename))
{
$path = sprintf("./files/attach/images/%s/%s", $module_srl,getNumberingPath($upload_target_srl,3));
$filename = $path.$file_obj->source_filename;